浏览代码

fix: unlocked hit elements to take priority

zsviczian 3 月之前
父节点
当前提交
fe04998f17
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      packages/excalidraw/components/App.tsx

+ 6 - 1
packages/excalidraw/components/App.tsx

@@ -7253,7 +7253,12 @@ class App extends React.Component<AppProps, AppState> {
           });
         }
 
-        if (
+        // Prioritize unlocked elements over locked ones
+        if (unlockedHitElements.length > 0) {
+          // If there are unlocked elements, use the topmost one
+          pointerDownState.hit.element =
+            unlockedHitElements[unlockedHitElements.length - 1];
+        } else if (
           hitElementMightBeLocked &&
           hitElementMightBeLocked.locked &&
           !unlockedHitElements.some(