From e88ae4c872e107fe8b2bb36ce775200dc5af3965 Mon Sep 17 00:00:00 2001 From: Steve Ruiz Date: Sun, 12 May 2024 17:50:09 +0100 Subject: [PATCH] ok --- .../SimpleEraserTool/SimpleEraserTool.tsx | 26 +++++++------------ 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/apps/examples/src/examples/new-tool/SimpleEraserTool/SimpleEraserTool.tsx b/apps/examples/src/examples/new-tool/SimpleEraserTool/SimpleEraserTool.tsx index 2889b146b..cfd157755 100644 --- a/apps/examples/src/examples/new-tool/SimpleEraserTool/SimpleEraserTool.tsx +++ b/apps/examples/src/examples/new-tool/SimpleEraserTool/SimpleEraserTool.tsx @@ -233,27 +233,19 @@ export class SimpleEraserToolUtil extends ToolUtil -1; i--) { const shape = shapes[i] - - // If the shape is locked, exclude it - if (editor.isShapeOrAncestorLocked(shape)) { - excludedShapeIds.add(shape.id) - continue - } - - // If the shape is a group or a frame and the click began inside the shape, exclude it if ( - editor.isShapeOfType(shape, 'group') || - editor.isShapeOfType(shape, 'frame') - ) { - if ( + // If the shape is locked, or its ancestor is locked... + editor.isShapeOrAncestorLocked(shape) || + // ...or if it's a group or a frame and the click began inside the shape + ((editor.isShapeOfType(shape, 'group') || + editor.isShapeOfType(shape, 'frame')) && editor.isPointInShape(shape, originPagePoint, { hitInside: true, margin: 0, - }) - ) { - excludedShapeIds.add(shape.id) - } - continue + })) + ) { + // exclude it from being erased + excludedShapeIds.add(shape.id) } } }