浏览代码

fix: disable UI pointer-events on canvas drag (#2856)

David Luzar 4 年之前
父节点
当前提交
627c56ef1c
共有 4 个文件被更改,包括 9 次插入12 次删除
  1. 5 1
      src/components/LayerUI.tsx
  2. 1 9
      src/components/Tooltip.scss
  3. 2 2
      src/css/styles.scss
  4. 1 0
      src/packages/excalidraw/CHANGELOG.md

+ 5 - 1
src/components/LayerUI.tsx

@@ -602,7 +602,11 @@ const LayerUI = ({
       />
     </>
   ) : (
-    <div className="layer-ui__wrapper">
+    <div
+      className={clsx("layer-ui__wrapper", {
+        "disable-pointerEvents": appState.cursorButton === "down",
+      })}
+    >
       {dialogs}
       {renderFixedSideContainer()}
       {renderBottomAppMenu()}

+ 1 - 9
src/components/Tooltip.scss

@@ -48,15 +48,7 @@
     }
   }
 
-  // the following 3 rules ensure that the tooltip doesn't show (nor affect
-  // the cursor) when you drag over when you draw on canvas, but at the same
-  // time it still works when clicking on the link/shield
-
-  body:active & .Tooltip:not(:hover) {
-    pointer-events: none;
-  }
-
-  body:not(:active) & .Tooltip:hover .Tooltip__label {
+  .Tooltip:hover .Tooltip__label {
     visibility: visible;
   }
 

+ 2 - 2
src/css/styles.scss

@@ -282,7 +282,7 @@
     pointer-events: none !important;
   }
 
-  .App-menu_top > * {
+  .layer-ui__wrapper:not(.disable-pointerEvents) .App-menu_top > * {
     pointer-events: all;
   }
 
@@ -323,7 +323,7 @@
     }
   }
 
-  .App-menu_bottom > * {
+  .layer-ui__wrapper:not(.disable-pointerEvents) .App-menu_bottom > * {
     pointer-events: all;
   }
 

+ 1 - 0
src/packages/excalidraw/CHANGELOG.md

@@ -27,6 +27,7 @@ Please add the latest change on the top under the correct section.
 
 ### Fixes
 
+- Fix UI pointer-events not disabled when dragging on canvas [#2856](https://github.com/excalidraw/excalidraw/pull/2856).
 - Fix remote pointers not accounting for offset [#2855](https://github.com/excalidraw/excalidraw/pull/2855).
 
 ## 0.2.1