Skip to content

feat: add smooth scroll-to-selected for layer tree and canvas#62

Merged
liamwalder merged 1 commit intodevelopfrom
feat/canvas-auto-scroll
Mar 19, 2026
Merged

feat: add smooth scroll-to-selected for layer tree and canvas#62
liamwalder merged 1 commit intodevelopfrom
feat/canvas-auto-scroll

Conversation

@tristan-mouchet
Copy link
Copy Markdown
Collaborator

Summary

Add smooth auto-scroll behavior when selecting layers, both in the layer
tree panel and on the canvas/iframe viewport.

Changes

  • Replace row-level scrollIntoView with virtualizer-based two-step scroll (instant jump + smooth centering) in LayersTree
  • Skip scrolling when the selected layer is already visible within a 64px margin
  • Add canvas auto-scroll to the selected element with zoom-aware position calculation
  • Handle initial page load with retry mechanism for elements not yet in the DOM
  • Re-scroll on content height changes during the first 5s to correct image loading layout shifts
  • Clean up unused scrollToSelected prop and rowRef from LayerRow
  • Fix Tailwind lint warning and missing useMemo dependency

Test plan

  • Click an element on the canvas — layer tree should smoothly scrolls to it if it was not visible
  • Click a layer in the layer tree — canvas should smoothly scrolls to the element
  • Select a layer already visible in both panels — no unnecessary scroll
  • Reload the builder with a pre-selected layer deep in the page — both panels scroll to it on load
  • Test with a page containing many images — scroll position corrects after images load
  • Test at different zoom levels — canvas scroll lands on the correct element

- Replace row-level scrollIntoView with virtualizer-based smooth centering
- Add canvas auto-scroll to selected element with zoom-aware positioning
- Re-scroll on content height changes to correct image loading shifts
@liamwalder liamwalder merged commit a37549b into develop Mar 19, 2026
2 checks passed
@liamwalder liamwalder deleted the feat/canvas-auto-scroll branch March 19, 2026 10:59
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.

2 participants