Internal Offset in onDragEnd #283
Unanswered
lucafanselau
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to build an interface, where the user is able to drag and drop page elements along the vertical axis, I am currently using the Sortable preset with a slightly modified version of the verticalListSorting strategy. For one specific use case, I need to handle the onDragEnd event differently, depending on the position where the users cursor was above the "over"-droppable.
Currently I am trying to get the top offset from the top of the droppable, by computing
const topOffset = pos.current.offsetTop + pos.current.height / 2 - e.over.rect.offsetTop
where pos is just a ref with the last position of e.active (because of this issue: #238)
A Problem now arises, if you scroll inside of the window, while currently dragging, because pos.current.offsetTop does not seem to be updated while scrolling (although I'm sure that's on purpose)
how I can take the scroll offsets into account
So my question is, is there some way to access such an internal offset? Or maybe even if can incorporate the scroll offset into the calculation
Beta Was this translation helpful? Give feedback.
All reactions