react-draggable icon indicating copy to clipboard operation
react-draggable copied to clipboard

Partially out-of-view window jumps and changes position when handle is touched

Open HenrikBechmann opened this issue 1 year ago • 0 comments
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?

Screenshot 2024-03-16 at 8 19 15 AM

HenrikBechmann avatar Mar 16 '24 12:03 HenrikBechmann