question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow collision with drag overlay node rather than activeNode

See original GitHub issue

In our application it’s a frequent occurrence that things that can be dragged/sorted together are of different sizes. These sizes can differ radically and unpredictably and therefore make the dragging experience with a “presentational component” of the underlying node pretty bad. As an example, imagine dragging a giant rectangle from one container grid into a different container grid of many tiny squares. The large rectangle covers many of the squares during the drag, making it hard, from both the user’s perspective and for the collision detection, to precisely drop where you want.

For this reason, and to provide additional contextual information about the thing being dragged, we’ve opted to go with a statically sized drag overlay that has no relation to the underlying node being dragging. It’s small in size, contains an icon indicating what’s being dragged, and the number of items that will ultimately be affected by the drag.

Our issue is that DragOverlay is sized based on the underlying node that started the drag. We can fix this stylistically by passing a style prop, but the ViewRect that is passed into collision detection is still from the underlying activeNode. This makes collision computation inaccurate in relation to what the user actually sees (our small, statically sized child of DragOverlay).

I can see a few paths forward for making this experience better, but would love to get @clauderic’s input here as, currently, DragOverlay seems fundamentally tied to the activeNode in many ways. Ultimately, the high-level goal is to allow collision to occur with drag overlay rather than the node the started the drag.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
wmaincommented, Aug 9, 2021

Sure, happy to take a crack.

0reactions
claudericcommented, Aug 9, 2021

Is this something you’d be comfortable taking a stab at @wmain? I remember looking at this a while back and I agree with you that this needs a bit of work, just haven’t had time to prioritize this area yet.

Read more comments on GitHub >

github_iconTop Results From Across the Web

useSortable with variable size items and without a drag overlay
We created a vertical list recently, with useSortable, and couldn't get the dragging / collision detection to work with our variable height ...
Read more >
Drag Overlay - dnd-kit – Documentation
If your item needs to move from one container to another while dragging, we strongly recommend you use the <DragOverlay> component so the...
Read more >
Prevent Draggables from overlapping with a recursive function
Trying to check for collisions on drag end will only make it more complicated. What happens if you drop a box in the...
Read more >
The COMSOL Multiphysics User's Guide - ETH Weblog Service
material properties, loads, constraints, sources, and fluxes—rather than by defining the underlying equations. You can always apply these variables, ...
Read more >
Shave and a Haircut version 6.0 - Weltenbauer
Another trick is to use a different set of geometry for collision than you ... This feature allows you to re-comb an existing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found