Quellcode durchsuchen

fix: canvas position on scroll zoom

Konstantinos Kaloutas vor 3 Jahren
Ursprung
Commit
ed22a9104a
1 geänderte Dateien mit 11 neuen und 5 gelöschten Zeilen
  1. 11 5
      tldraw/packages/core/src/lib/TLApp/TLApp.ts

+ 11 - 5
tldraw/packages/core/src/lib/TLApp/TLApp.ts

@@ -831,16 +831,16 @@ export class TLApp<
   }
 
   readonly onWheel: TLEvents<S, K>['wheel'] = (info, e) => {
+    if (e.ctrlKey) {
+      return
+    }
+
     this.viewport.panCamera(info.delta)
     this.inputs.onWheel([...this.viewport.getPagePoint([e.clientX, e.clientY]), 0.5], e)
   }
 
   readonly onPointerDown: TLEvents<S, K>['pointer'] = (info, e) => {
-    // Switch to select on right click to enable contextMenu state
-    if (e.button === 2) {
-      this.transition('select', info)
-      return
-    }
+
 
     // Pan canvas when holding middle click
     if (!this.editingShape && e.button === 1 && !this.isIn('move')) {
@@ -848,6 +848,12 @@ export class TLApp<
       return
     }
 
+    // Switch to select on right click to enable contextMenu state
+    if (e.button === 2) {
+      this.transition('select')
+      return
+    }
+
     if ('clientX' in e) {
       this.inputs.onPointerDown(
         [...this.viewport.getPagePoint([e.clientX, e.clientY]), 0.5],