From dbae33e4f8153a0d3c77c4529f32f9c1a87dbfa2 Mon Sep 17 00:00:00 2001 From: Christophe pasquier Date: Thu, 4 Feb 2021 13:07:29 +0100 Subject: [PATCH] fix: make scrollbars draggable when offsets are set (#2916) Co-authored-by: dwelle --- src/components/App.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/App.tsx b/src/components/App.tsx index c99fddcc0f..4891a94e9c 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -1828,10 +1828,11 @@ class App extends React.Component { if (isHoldingSpace || isPanning || isDraggingScrollBar) { return; } + const isPointerOverScrollBars = isOverScrollBars( currentScrollBars, - event.clientX, - event.clientY, + event.clientX - this.state.offsetLeft, + event.clientY - this.state.offsetTop, ); const isOverScrollBar = isPointerOverScrollBars.isOverEither; if (!this.state.draggingElement && !this.state.multiElement) { @@ -2287,8 +2288,8 @@ class App extends React.Component { ), scrollbars: isOverScrollBars( currentScrollBars, - event.clientX, - event.clientY, + event.clientX - this.state.offsetLeft, + event.clientY - this.state.offsetTop, ), // we need to duplicate because we'll be updating this state lastCoords: { ...origin },