go to frame with numbers loops

master
Beau Blyth 2019-10-03 18:11:26 -07:00
parent 2e47bde496
commit fc76ad81ab
2 changed files with 13 additions and 3 deletions

View File

@ -103,6 +103,12 @@ export class FrameHandler {
const newDiv = document.createElement('div'); const newDiv = document.createElement('div');
this.frameViewer.appendChild(newDiv); this.frameViewer.appendChild(newDiv);
newDiv.className = 'frame'; newDiv.className = 'frame';
newDiv.addEventListener('click', () => {
this.StopPlayingAnimation();
this.GoToFrame(i);
this.RefreshFrameViewer();
});
} }
}; };

View File

@ -118,12 +118,16 @@ export class Page {
case 56: case 56:
case 57: { case 57: {
// goto frame w 1234567890 // goto frame w 1234567890
let targetFrame: number = event.keyCode - 49;
if (event.keyCode === 48) { if (event.keyCode === 48) {
this.frameHandler.GoToFrame(9); targetFrame = 9;
} else {
this.frameHandler.GoToFrame(event.keyCode - 49);
} }
targetFrame %= this.animationData.frames.length;
this.frameHandler.StopPlayingAnimation(); this.frameHandler.StopPlayingAnimation();
this.frameHandler.GoToFrame(targetFrame);
this.frameHandler.RefreshFrameViewer();
break; break;
} }