fix android long press changing cursor to non-coarse (#3656)

### Change Type

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

- [ ] `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. Open a multip;ayer room on android chrome
2. Long press
3. Make sure coarse pointer isnt there

- [ ] 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-30 11:44:45 +01:00 committed by GitHub
parent d3fe2d06e0
commit 46a97dfe3d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -20,8 +20,12 @@ export function useCoarsePointer() {
}
// When the user moves the mouse, we assume they have a fine pointer
const handleMouseMove = () => {
const handleMouseMove = (
e: MouseEvent & { sourceCapabilities?: { firesTouchEvents: boolean } }
) => {
if (!isCoarse) return
// Fix Android Chrome bug where mousemove is fired even if the user long presses
if (e.sourceCapabilities?.firesTouchEvents) return
isCoarse = false
editor.updateInstanceState({ isCoarsePointer: false })
}