Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle Nested Grid Dragging #6526

Merged
merged 14 commits into from
Oct 16, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(grids) Order by the grids by depth so that the animation works co…
…rrectly.
seanparsons committed Oct 15, 2024
commit 293efe23b4f5696a634e0744f9ef10cceac77db6
9 changes: 8 additions & 1 deletion editor/src/components/canvas/controls/grid-controls.tsx
Original file line number Diff line number Diff line change
@@ -960,8 +960,15 @@ export const GridControlsComponent = ({ targets }: GridControlsProps) => {
'GridControlsComponent hoveredGrids',
)

// Uniqify the grid paths, and then sort them by depth.
// With the lowest depth grid at the end so that it renders on top and catches the events
// before those above it in the hierarchy.
const grids = useGridData(
uniqBy([...targets, ...ancestorGrids, ...hoveredGrids], (a, b) => EP.pathsEqual(a, b)),
uniqBy([...targets, ...ancestorGrids, ...hoveredGrids], (a, b) => EP.pathsEqual(a, b)).sort(
(a, b) => {
return EP.fullDepth(a) - EP.fullDepth(b)
},
),
)

if (grids.length === 0) {