[pull] main from tldraw:main#550
Merged
Merged
Conversation
Adds a new `selectLockedShapes` option to `TldrawOptions` that, when enabled, lets users select locked shapes with a left click (and via brush or scribble selection). The editor's existing lock guards still prevent moving, resizing, editing, or deleting locked shapes, so the option enables inspection without unlocking. When `selectLockedShapes: true`: - `getHitShapeOnCanvasPointerDown` passes `hitLocked: true` - `Idle.onPointerDown` no longer routes left clicks on locked shapes to `pointing_canvas` - `Brushing` and `ScribbleBrushing` include locked shapes - Hover detection (`updateHoveredShapeId`) treats locked shapes as hoverable - `selectOnCanvasPointerUp` allows locked shapes through When `selectLockedShapes` is `false` (default), behavior is unchanged. Closes #8548 ### Change type - [ ] `bugfix` - [ ] `improvement` - [x] `feature` - [ ] `api` - [ ] `other` ### Test plan 1. Set `<Tldraw options={{ selectLockedShapes: true }} />` in an example app. 2. Create a shape, lock it, and click it — it should become selected and show selection bounds. 3. Try to drag or resize it — nothing should move (lock still applies). 4. Brush over the locked shape with the select tool — it should be included in the brush selection. 5. Alt-drag (scribble select) over the locked shape — it should also be included. 6. With the option set to `false` (default), confirm left-clicking a locked shape still falls through to the canvas, matching the previous behavior. - [x] Unit tests - [ ] End to end tests ### API changes - Add a new `selectLockedShapes` option to `TldrawOptions` (and to `defaultTldrawOptions`). When `false` (default), left-clicking a locked shape is treated as a click on the canvas; only right-click selects it. When `true`, locked shapes can be selected via left-click and included in brush and scribble selections, but the editor's lock guards still prevent moving, resizing, editing, or deleting them. ### Release notes - Added a `selectLockedShapes` option to `TldrawOptions`. When enabled, locked shapes can be selected with left click and brush/scribble selection while remaining protected from edits, moves, and deletes. --------- Co-authored-by: angrycaptain19 <53473467+angrycaptain19@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )