fix: escape eraser tool on escape (#1732)

Escape the eraser tool on pressing the escape key.

(note that the same bug exists for the laser tool, i'm not sure if the
escape key behaviour should be the same for it too)


![licecap-output](https://github.com/tldraw/tldraw/assets/5616556/14bcb1f3-325c-4d28-ad39-a6a7205bd011)

Fixes #1731 

### 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. Select eraser tool
2. Press [escape], you should be back in the select tool
3. Select eraser tool, and start dragging around and press [escape], the
behaviour should be same as before

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

### Release Notes

- escape eraser tool on escape

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
This commit is contained in:
Gabriel Lee 2023-07-17 22:59:27 +01:00 committed by GitHub
parent f63ddc7ecc
commit e276937df8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,4 +6,8 @@ export class Idle extends StateNode {
override onPointerDown: TLEventHandlers['onPointerDown'] = (info) => {
this.parent.transition('pointing', info)
}
override onCancel = () => {
this.editor.setCurrentTool('select')
}
}