react-grid-layout icon indicating copy to clipboard operation
react-grid-layout copied to clipboard

Drag from outside positioning improvement

Open michaelnesen opened this issue 1 year ago • 2 comments

Description

This PR aims to improve the item positioning within the onDragOver event handler called when dragging an item from outside the layout.

The current experience treats your cursor as the top-left position of the grid item when dragging, meaning the placeholder is always below and to the right of your cursor, this often makes it feel like the library is not tracking your movement correctly, this is especially noticeable when dragging in larger items into the layout:

https://github.com/user-attachments/assets/b5c41304-7644-41dd-a67f-3d7602783dd6

This PR changes this behaviour, making the cursor more inline with the center of the placeholder:

https://github.com/user-attachments/assets/baa1bc2a-1a08-4881-9b1c-7391e0849c95

This PR [adds/removes/fixes/replaces] the [feature/bug/etc].

What type of PR is this? (check all applicable)

  • [ ] 🍕 Feature
  • [x] 🐛 Bug Fix
  • [ ] 📝 Documentation Update
  • [ ] 🎨 Style
  • [ ] 🧑‍💻 Code Refactor
  • [ ] 🔥 Performance Improvements
  • [ ] ✅ Test
  • [ ] 🤖 Build
  • [ ] 🔁 CI
  • [ ] 📦 Chore (Release)
  • [ ] ⏩ Revert

Related Tickets & Documents

Mobile & Desktop Screenshots/Recordings

Added tests?

  • [ ] 👍 yes
  • [ ] 🙅 no, because they aren't needed
  • [ ] 🙋 no, because I need help

Added to documentation?

  • [ ] 📜 README.md
  • [ ] 📓 examples
  • [x] 🙅 no documentation needed

michaelnesen avatar Sep 09 '24 16:09 michaelnesen

@michaelnesen Thanks for this PR! I'm experiencing the same and this does look like a great improvement!

Any update on this?

jeroen-visser avatar Mar 22 '25 19:03 jeroen-visser

Hey @STRML @michaelnesen any chance on proceeding with this PR, as this would be a fantastic addition.

SuhaibProj avatar Aug 14 '25 19:08 SuhaibProj

Fixed in #2196

STRML avatar Dec 14 '25 21:12 STRML