react-draggable
react-draggable copied to clipboard
Partially out-of-view window jumps and changes position when handle is touched
trafficstars
Hi, I'm making a windowing system (for which, thanks for your utility).
But there's something odd. When I click on the title (which is the handle) of the pictured window, then it jumps fully into view (by scrolling the parent), and also changes its top/left co-ordinates (moving it away from its peers).
I've had to compensate by adding the following code to the onStop method (note the reversal of the deltaY values, and the counter-scroll operation):
const onDragStop = (e, data) => {
if (data.deltaY) {
panelFrameElementRef.current.scrollTop -= data.deltaY
}
setWindowConfigSpecs((oldState) => {
return {...oldState, top:data.y - data.deltaY, left: data.x}
})
}
Any suggestions?