Skip to content

feat(studio): on-canvas motion-path overlay#1560

Open
miguel-heygen wants to merge 1 commit into
feat/studio-motion-path-helpersfrom
feat/studio-motion-path-overlay-ui
Open

feat(studio): on-canvas motion-path overlay#1560
miguel-heygen wants to merge 1 commit into
feat/studio-motion-path-helpersfrom
feat/studio-motion-path-overlay-ui

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Stack: GSAP keyframe + motion-path editing — on-canvas overlay (#1553#1561).

What

Render the selected element's GSAP motion path over the canvas: a dashed polyline through its x/y keyframes (or motionPath waypoints) with a draggable diamond node at each. Dragging a node rewrites the keyframe and commits to source; clicking a node selects that keyframe and seeks to its time.

Why

Direct, visual editing of motion paths in the Studio, matching the keyframe diamonds in the timeline.

How

  • MotionPathOverlay.tsx + MotionPathNode.tsx: SVG overlay drawn in declared composition coordinates, positioned over the preview iframe (which lives in the player's shadow DOM), so the path doesn't drift under GSAP transforms or canvas zoom/pan.
  • Integrates the geometry/commit helpers; read-only while playing.
  • useDomEditOverlayRects.ts / StudioPreviewArea.tsx / DomEditOverlay.tsx: overlay positioning + wiring.

Test plan

  • Manual studio: path renders, nodes drag + commit, click-to-select-keyframe
  • Verified across canvas zoom levels

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at ba99ae07 per Rames D Jusso "stamp-ready with 3 nits." On-canvas motion-path overlay — UI layer, no architectural concerns. Deferring his 3 nits to inline resolution.

Reminder: PR body is the unfilled template (stack-wide process flag); please fill in before merge.

@miguel-heygen miguel-heygen force-pushed the feat/studio-motion-path-helpers branch from c6c515d to 87a7fd0 Compare June 18, 2026 15:47
@miguel-heygen miguel-heygen force-pushed the feat/studio-motion-path-overlay-ui branch from ba99ae0 to 676ba06 Compare June 18, 2026 15:48
@miguel-heygen miguel-heygen force-pushed the feat/studio-motion-path-helpers branch from 87a7fd0 to 7bb643e Compare June 18, 2026 15:57
@miguel-heygen miguel-heygen force-pushed the feat/studio-motion-path-overlay-ui branch from 676ba06 to f9e5f4f Compare June 18, 2026 15:57

@vanceingalls vanceingalls left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concurring with the consolidated stack review at HEAD 676ba067. One add: where the cheap test-gap-closing units live.

The 559-line overlay is mostly SVG render + pointer-event delegation into already-tested helpers (buildMotionPathGeometry, nearestPointOnPath, commitNode, commitAddWaypoint, parkPlayheadOnKeyframe). Two testable units could be lifted out with low ceremony and would pin the parts most prone to silent regression:

  • elementHome (packages/studio/src/components/editor/MotionPathOverlay.tsx:53-78) — the DOM-walk plus --hf-studio-offset-x/y inclusion rule. A jsdom + manual offset-stubbing test pins the "translate var() detection" branch, which is exactly the clever-but-fragile heuristic prone to silent regression on iframe-realm changes.
  • isPreviewHtmlElement (MotionPathOverlay.tsx:84-91) — the cross-realm constructor check. Four lines of test demonstrate the iframe-realm path.

The orchestrating render is genuinely event-delegation glue where unit value is low; an @testing-library/react smoke test that asserts "given a geometry, N nodes render at the expected coordinates" would be a cheap follow-up but is the lower-priority option. Not a blocker — these closures sharpen confidence post-merge rather than gate it.

Review by Via

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-approved at f9e5f4fd post-restack. On-canvas motion-path overlay; clean UI layer.

Echoing Via's R2 finding: two testable units worth extracting for cheap coverage closure — elementHome (MotionPathOverlay.tsx:53-78, DOM-walk + offset-rule, jsdom-testable) and isPreviewHtmlElement (:84-91, cross-realm constructor check, 4-line test). Non-blocking, fine as a follow-up.

SVG overlay with draggable keyframe-diamond nodes, hover-add, right-click
remove, and context menu; mounted in the preview area.
@miguel-heygen miguel-heygen force-pushed the feat/studio-motion-path-overlay-ui branch from f9e5f4f to 789f860 Compare June 18, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants