tldraw/packages
Steve Ruiz 219e2f63dd
[improvement] account for coarse pointers / insets in edge scrolling (#2401)
This PR:
- shrinks the distance for edge scrolling and insets the distance for
coarse pointers
- adds edge inset tracking

## Scroll distances

Rather than increasing the distance, we move the "zero" in from the
edges, so that the middle of a honkin' fat finger would be at "zero"
when the edge of the finger is touching the edge of the screen. This is
a bit more reliable than looking at just the component size.

## Inset tracking

We now track whether a shape's edges are identical to the edges of the
document body. When an edge is inset, we extend the edge scrolling
distance outside of the component, so that dragging PAST the edge of the
component will scroll. When an edge is NOT inset, we bring that distance
into the component's bounds, so that dragging NEAR TO the edge will
begin to scroll.


![image](https://github.com/tldraw/tldraw/assets/23072548/bb216c98-3dd0-4e2e-a635-4c4f339d5117)


![image](https://github.com/tldraw/tldraw/assets/23072548/75e83c81-1ca9-40a9-8edc-72851d3b1411)


![image](https://github.com/tldraw/tldraw/assets/23072548/6cda7bda-2935-4ded-821c-e7bf78833a1c)

### Change Type

- [x] `minor` — New feature

### Test Plan

1. Use edge scrolling on mobile
2. Use edge scrolling on desktop
3. Use edge scrolling in the "scrolling example"

- [x] Unit Tests

### Release Notes

- Add `instanceState.insets` to track which edges of the component are
inset from the edges of the document body.
- Improve behavior around edge scrolling
2024-01-10 14:29:32 +00:00
..
assets Update CHANGELOG.md [skip ci] 2024-01-10 12:03:59 +00:00
editor [improvement] account for coarse pointers / insets in edge scrolling (#2401) 2024-01-10 14:29:32 +00:00
state Update CHANGELOG.md [skip ci] 2024-01-10 12:03:59 +00:00
store Update CHANGELOG.md [skip ci] 2024-01-10 12:03:59 +00:00
tldraw [improvement] account for coarse pointers / insets in edge scrolling (#2401) 2024-01-10 14:29:32 +00:00
tlschema [improvement] account for coarse pointers / insets in edge scrolling (#2401) 2024-01-10 14:29:32 +00:00
utils Update CHANGELOG.md [skip ci] 2024-01-10 12:03:59 +00:00
validate Update CHANGELOG.md [skip ci] 2024-01-10 12:03:59 +00:00