From 8daabb29d018362cb8787e5c6a878a0700e98f1c Mon Sep 17 00:00:00 2001 From: Lee-Orr Date: Wed, 20 Mar 2024 18:58:03 -0400 Subject: [PATCH] move timeline to fit playhead --- .../src/app/anim-editor.element.ts | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/studio-frontend/src/app/anim-editor.element.ts b/studio-frontend/src/app/anim-editor.element.ts index 4b57735..c27ff19 100644 --- a/studio-frontend/src/app/anim-editor.element.ts +++ b/studio-frontend/src/app/anim-editor.element.ts @@ -86,6 +86,13 @@ implements TreeSelectionProvider { console.log("Seek Time Changed", time, playing); this.playHead = time; this.playing = playing; + + if (this.playHead < this.timelineStart) { + this.timelineStart = this.playHead - (this.timelineEnd - this.timelineStart) * 0.05; + } + if (this.playHead > this.timelineEnd) { + this.timelineEnd = this.playHead + (this.timelineEnd - this.timelineStart) * 0.05; + } } @on("window:update-animation-targets") @@ -170,17 +177,6 @@ implements TreeSelectionProvider { } } - @on("rangeStart-change") - onRangeStartChange({detail}: {detail:number}): void { - this.timelineStart = detail; - } - - - @on("rangeEnd-change") - onRangeEndChange({detail}: {detail:number}): void { - this.timelineStart = detail; - } - onSidebarResize(event: PointerEvent): void { this.sidebarWidth = Math.max(Math.min(this.sidebarWidth + event.movementX, 512), 128); } @@ -237,7 +233,7 @@ implements TreeSelectionProvider { } } - if (closest_keyframe > this.timelineEnd) { + if (closest_keyframe > this.clipEnd) { return; }