Fix alt-duplicating shapes sometimes not working (#3488)

This PR fixes alt-duplicating shapes not working if you pointer-down'd
on their text label.

fixes
https://github.com/orgs/tldraw/projects/41/views/1?pane=issue&itemId=59901721

### Change Type

<!--  Please select a 'Scope' label ️ -->

- [x] `sdk` — Changes the tldraw SDK
- [x] `dotcom` — Changes the tldraw.com web app
- [ ] `docs` — Changes to the documentation, examples, or templates.
- [ ] `vs code` — Changes to the vscode plugin
- [ ] `internal` — Does not affect user-facing stuff

<!--  Please select a 'Type' label ️ -->

- [x] `bugfix` — Bug fix
- [ ] `feature` — New feature
- [ ] `improvement` — Improving existing features
- [ ] `chore` — Updating dependencies, other boring stuff
- [ ] `galaxy brain` — Architectural changes
- [ ] `tests` — Changes to any test code
- [ ] `tools` — Changes to infrastructure, CI, internal scripts,
debugging tools, etc.
- [ ] `dunno` — I don't know


### Test Plan

1. Add a step-by-step description of how to test your PR here.
2.

- [ ] Unit Tests
- [ ] End to end tests

### Release Notes

- Add a brief release note for your PR here.
This commit is contained in:
Lu Wilson 2024-04-16 13:40:01 +01:00 committed by GitHub
parent 9a4087efe1
commit c7cb91d7d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -215,6 +215,9 @@ export class PointingShape extends StateNode {
private startTranslating(info: TLPointerEventInfo) { private startTranslating(info: TLPointerEventInfo) {
if (this.editor.getInstanceState().isReadonly) return if (this.editor.getInstanceState().isReadonly) return
// Re-focus the editor, just in case the text label of the shape has stolen focus
this.editor.getContainer().focus()
this.parent.transition('translating', info) this.parent.transition('translating', info)
} }