Przeglądaj źródła

fix: include borders when testing insides of a shape (#7865)

Ryan Di 1 rok temu
rodzic
commit
4987cc53d0
1 zmienionych plików z 3 dodań i 1 usunięć
  1. 3 1
      packages/excalidraw/element/collision.ts

+ 3 - 1
packages/excalidraw/element/collision.ts

@@ -62,7 +62,9 @@ export const hitElementItself = ({
   frameNameBound = null,
 }: HitTestArgs) => {
   let hit = shouldTestInside(element)
-    ? isPointInShape([x, y], shape)
+    ? // Since `inShape` tests STRICTLY againt the insides of a shape
+      // we would need `onShape` as well to include the "borders"
+      isPointInShape([x, y], shape) || isPointOnShape([x, y], shape, threshold)
     : isPointOnShape([x, y], shape, threshold);
 
   // hit test against a frame's name