From 02d9acd63e0eead0b7dcec191bc9288f45f8443d Mon Sep 17 00:00:00 2001 From: Lee-Orr Date: Tue, 26 Mar 2024 13:51:19 -0400 Subject: [PATCH] snap keyframes --- studio-frontend/src/app/anim-timeline.element.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/studio-frontend/src/app/anim-timeline.element.ts b/studio-frontend/src/app/anim-timeline.element.ts index 5cdd290..33fbd18 100644 --- a/studio-frontend/src/app/anim-timeline.element.ts +++ b/studio-frontend/src/app/anim-timeline.element.ts @@ -240,8 +240,9 @@ export class AnimTimelineElement extends LitElement { let relativeX = event.clientX - elementBounds.left; let ratioX = Math.max(0, Math.min(relativeX / elementBounds.width, 1)); const time = (this.rangeEnd - this.rangeStart) * ratioX + this.rangeStart; + const final_time = Math.round(time * this.clipFps) / this.clipFps; - studio.moveKeyframeTime(id, time); + studio.moveKeyframeTime(id, final_time); } updateRenderWidth(): void {