Jelajahi Sumber

fix: make link icon clickable in mobile (#4736)

Aakansha Doshi 3 tahun lalu
induk
melakukan
9be6243873
1 mengubah file dengan 14 tambahan dan 1 penghapusan
  1. 14 1
      src/components/App.tsx

+ 14 - 1
src/components/App.tsx

@@ -1524,7 +1524,20 @@ class App extends React.Component<AppProps, AppState> {
 
   removePointer = (event: React.PointerEvent<HTMLElement> | PointerEvent) => {
     this.lastPointerUp = event;
-
+    if (this.isMobile) {
+      const scenePointer = viewportCoordsToSceneCoords(
+        { clientX: event.clientX, clientY: event.clientY },
+        this.state,
+      );
+      const hitElement = this.getElementAtPosition(
+        scenePointer.x,
+        scenePointer.y,
+      );
+      this.hitLinkElement = this.getElementLinkAtPosition(
+        scenePointer,
+        hitElement,
+      );
+    }
     if (
       this.hitLinkElement &&
       !this.state.selectedElementIds[this.hitLinkElement.id]