Skip to content

fix: enable rubber-band hotspot draw on instance screens#49

Merged
trmquang93 merged 1 commit intomainfrom
fix/instance-hotspot-draw
Apr 28, 2026
Merged

fix: enable rubber-band hotspot draw on instance screens#49
trmquang93 merged 1 commit intomainfrom
fix/instance-hotspot-draw

Conversation

@trmquang93
Copy link
Copy Markdown
Collaborator

Summary

  • The image-area mousedown handler in useHotspotInteraction.js short-circuited on instance screens because raw instance state has no imageData/imageHeight — those fields only exist on the canonical and are merged in at render time by resolveInstanceVisuals. Resolved at the call site so the guard sees the inherited image without leaking render-time semantics into write paths.
  • Added test coverage for remaining instance-editing affordances (select / resize / connect-handle drag / alt-shortcut) in a new useHotspotInteraction.test.js.
  • Added a round-trip persistence guard for instance.hotspots[] through importFlow (canonical+instance pair preservation, stringify→import fixed point, orphan demotion preserves locals).

Completes the success criteria from .plans/instance-hotspots-and-connections-plan.md that were missing post-#47.

Test plan

  • npx vitest run src/hooks/useHotspotInteraction.test.js src/utils/importFlow.test.js — 43 passed
  • npx vitest run — full suite 47 files / 846 tests, all green
  • Manual: open a flow with a canonical+instance, drag to draw a hotspot on the instance — confirms a new local hotspot appears only on that placement
  • Manual: save and reload — confirm the instance hotspot persists

The image-area mousedown handler short-circuited on instance screens
because raw instance state has no imageData/imageHeight — those fields
only exist on the canonical and are merged in at render time by
resolveInstanceVisuals. Resolve at the call site so the guard sees the
inherited image without leaking render-time semantics into write paths.

Also adds test coverage for the remaining instance-editing affordances
(select/resize/connect-handle drag) and a round-trip persistence guard
for instance.hotspots[] through importFlow.
@trmquang93 trmquang93 merged commit 672383d into main Apr 28, 2026
1 check passed
@trmquang93 trmquang93 deleted the fix/instance-hotspot-draw branch April 28, 2026 15:49
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.

1 participant