can name file and save as name

master
Beau Blyth 2019-09-27 17:04:01 -07:00
parent 7d4c5ab749
commit 10dd54aed5
2 changed files with 6 additions and 1 deletions

View File

@ -24,6 +24,7 @@ export class Page {
private canvasContext: CanvasRenderingContext2DSettings; private canvasContext: CanvasRenderingContext2DSettings;
private canvasData: ICanvasData; private canvasData: ICanvasData;
private filenameInput: HTMLInputElement;
public Load() { public Load() {
// defining blank slate animation data // defining blank slate animation data
@ -78,6 +79,7 @@ export class Page {
this.frameRateInput.value = this.animationData.frameRate.toString(); this.frameRateInput.value = this.animationData.frameRate.toString();
this.loopingInput = document.getElementById('looping') as HTMLInputElement; this.loopingInput = document.getElementById('looping') as HTMLInputElement;
this.loopingInput.addEventListener('change', this.updateLooping); this.loopingInput.addEventListener('change', this.updateLooping);
this.filenameInput = document.getElementById('filename') as HTMLInputElement;
const dropZone = document.getElementById('dropZone') as HTMLElement; const dropZone = document.getElementById('dropZone') as HTMLElement;
@ -139,7 +141,9 @@ export class Page {
case 83: { case 83: {
// s // s
this.download('.anim', JSON.stringify(this.animationData)); if (document.activeElement !== this.filenameInput) {
this.download(this.filenameInput.value + '.anim', JSON.stringify(this.animationData));
}
break; break;
} }
} }

1
dist/index.html vendored
View File

@ -23,6 +23,7 @@
</div> </div>
<div id="settings"> <div id="settings">
Name: <input type = "text" id="filename"><br>
<div id = "originInfo">Click image to set Origin</div> <div id = "originInfo">Click image to set Origin</div>
Fps: <input type="number" id="framerate" class="numberinput"><br> Fps: <input type="number" id="framerate" class="numberinput"><br>
<input type="checkbox" id="looping" > Looping <br> <input type="checkbox" id="looping" > Looping <br>