Просмотр исходного кода

fix: make scrollbars draggable when offsets are set (#2916)

Co-authored-by: dwelle <luzar.david@gmail.com>
Christophe pasquier 4 лет назад
Родитель
Сommit
dbae33e4f8
1 измененных файлов с 5 добавлено и 4 удалено
  1. 5 4
      src/components/App.tsx

+ 5 - 4
src/components/App.tsx

@@ -1828,10 +1828,11 @@ class App extends React.Component<ExcalidrawProps, AppState> {
     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<ExcalidrawProps, AppState> {
       ),
       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 },