From eb041d516fc708dc6d10ca3850b2e625245c0128 Mon Sep 17 00:00:00 2001 From: Hana Date: Fri, 13 Oct 2023 20:17:42 +0900 Subject: [PATCH] [fix] locked shape of opacity problem with eraser.pointing (#2073) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit locked shape of opacity problem with the pointing state of the eraser tool this is only in the pointing (clicking) state. I don't know if this is intended or a bug, but it's true that it's a little uncomfortable. ![blinks](https://github.com/tldraw/tldraw/assets/59823089/6292aa54-120d-4cbc-b712-a78f408d248b) blinks when the user starts to remove the handwriting on locked content. Defs https://github.com/tldraw/tldraw/pull/2061 ### Change Type - [x] `patch` — Bug fix - [ ] `minor` — New feature - [ ] `major` — Breaking change - [ ] `dependencies` — Changes to package dependencies[^1] - [ ] `documentation` — Changes to the documentation only[^2] - [ ] `tests` — Changes to any test code only[^2] - [ ] `internal` — Any other changes that don't affect the published package[^2] - [ ] I don't know [^1]: publishes a `patch` release, for devDependencies use `internal` [^2]: will not publish a new version ### Test Plan 1. Make a locked shape 2. Click erase over the shape 3. The shape shouldn't change opacity ### Release Notes - locked shape of opacity problem with eraser.pointing Before/after: ![A](https://github.com/tldraw/tldraw/assets/59823089/7483506c-72ac-45cc-93aa-f2a794ea8ff0) ![B](https://github.com/tldraw/tldraw/assets/59823089/ef0f988c-83f5-46a2-b891-0a391bca2f87) --- .../tldraw/src/lib/tools/EraserTool/children/Pointing.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/tldraw/src/lib/tools/EraserTool/children/Pointing.ts b/packages/tldraw/src/lib/tools/EraserTool/children/Pointing.ts index 4e3a98e77..9cf6a10d4 100644 --- a/packages/tldraw/src/lib/tools/EraserTool/children/Pointing.ts +++ b/packages/tldraw/src/lib/tools/EraserTool/children/Pointing.ts @@ -23,7 +23,10 @@ export class Pointing extends StateNode { for (let n = sortedShapesOnCurrentPage.length, i = n - 1; i >= 0; i--) { const shape = sortedShapesOnCurrentPage[i] - if (this.editor.isShapeOfType(shape, 'group')) { + if ( + this.editor.isShapeOrAncestorLocked(shape) || + this.editor.isShapeOfType(shape, 'group') + ) { continue }