Wykres commitów

2881 Commity (lu/frame-kickout-rotation)

Autor SHA1 Wiadomość Data
Lu[ke] Wilson bcd412bedb Merge remote-tracking branch 'origin/stickies-rc' into lu/frame-kickout-rotation 2024-04-09 09:37:14 +01:00
Lu[ke] Wilson c59249fb43 Affected 2024-04-09 09:35:45 +01:00
Mime Čuvalo 994b0f8baa
textfields: only do pointer capture when not editing (#3407)
Fixes https://linear.app/tldraw/issue/TLD-2374/can-lose-focus-and-caret

#focus-issues #blood-moat

### Change Type

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

- [x] `sdk` — Changes the tldraw SDK
- [ ] `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
2024-04-09 08:49:24 +01:00
Mime Čuvalo 4a5068f681
move editing shape indicator to the original spot - fix TLD-2377 2024-04-09 09:33:22 +02:00
Mime Čuvalo 346cabdd6f
lint 2024-04-08 17:22:15 +02:00
Mime Čuvalo a250e92830
merge 2024-04-08 16:52:11 +02:00
Mime Čuvalo 16bcad49d6
Merge branch 'main' into stickies-rc 2024-04-08 16:49:45 +02:00
Mime Čuvalo a709032c93
textfields: also let draw shapes not be in the way of text editing (#3404)
Draw shapes shouldn't get in the way when going from
EditingShape→EditingShape. They don't feel like they have the same
occlusion rules. Hard to see in the gifs below but the geometry is
occluding the sticky underneath like so:

<img width="588" alt="Screenshot 2024-04-08 at 16 39 51"
src="https://github.com/tldraw/tldraw/assets/469604/2559725c-4706-43ae-9f7f-4961bd99471f">


before


https://github.com/tldraw/tldraw/assets/469604/04e760a6-70e7-48d8-89b0-b481193be7be




after


https://github.com/tldraw/tldraw/assets/469604/f9b2ecdd-d844-4d11-9bf2-c28d97751fbb



### Change Type

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

- [x] `sdk` — Changes the tldraw SDK
- [ ] `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
2024-04-08 15:40:25 +01:00
Lu[ke] Wilson 37bf718323 improve accuracy of kickout 2024-04-08 15:25:08 +01:00
Lu Wilson 7a1111bd1e
Remove more note parenting code (#3402)
This PR removes some extras that were used for note parenting.
 
### Change Type

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

- [ ] `sdk` — Changes the tldraw SDK
- [ ] `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 ️ -->

- [ ] `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.
2024-04-08 15:21:14 +01:00
Mitja Bezenšek 5347c5f30e
Add two simple perf helpers. (#3399)
Can be useful for ad-hoc measure of performance. One is a method
decorator, which can be use on methods like so:

```typescript
  @measureDuration
  someLongRunningProccess() {
  // ....
  }
```

And the other offer more granular control. It also returns what the
callback returns, so it can be use in assignments / return statements.

```typescript
return measureCbDuration('sorting took', () =>  renderingShapes.sort(sortById))
```


### Change Type

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

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

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

- [ ] `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
- [x] `tools` — Changes to infrastructure, CI, internal scripts,
debugging tools, etc.
- [ ] `dunno` — I don't know
2024-04-08 13:41:09 +00:00
Steve Ruiz fb2d3b4372
Perf: (slightly) faster min dist checks (#3401)
This PR improves a bunch of places where we do "minimum distance
checks". Previously, we were using `Vec.Dist`, which uses `Math.hypot`
to find the actual distance, but we can just as well use the squared
distance. So this PR makes a small improvement to `Vec.Dist2` and then
switches to that method when checking minimum distances.

### Change Type

- [x] `sdk` — Changes the tldraw SDK
- [x] `improvement` — Improving existing features


### Test Plan

- [x] Unit Tests

### Release Notes

- Performance: small improvements to hit testing.
2024-04-08 13:31:05 +00:00
Mime Čuvalo 2d2e4ea685
need a min-width/min-height when blank note to make editing easier 2024-04-08 15:12:35 +02:00
Steve Ruiz 2929816e32
Stickies: fast adjacent note positions check (#3400)
This PR improves the speed of pit checking at the start of a
translation.

Before (1000 shapes):
<img width="385" alt="image"
src="https://github.com/tldraw/tldraw/assets/23072548/ede999f2-a82f-4278-bec8-edf8b59a524e">

After (1000 shapes):
<img width="360" alt="image"
src="https://github.com/tldraw/tldraw/assets/23072548/bd91c38b-1507-4475-92ff-fc75bffbf484">


### Change Type

- [x] `sdk` — Changes the tldraw SDK
- [x] `improvement` — Improving existing features
2024-04-08 13:22:45 +01:00
Mime Čuvalo cddbae5e39
Revert "stickies: translucency, sometimes"
This reverts commit 2a263fba4c.
2024-04-08 14:05:18 +02:00
Mitja Bezenšek 947f7b1d76
[culling] Improve setting of display none. (#3376)
Small improvement for culling shapes. We now use reactor to do it. .

Before:

![image](https://github.com/tldraw/tldraw/assets/2523721/7f791cdd-c0e2-4b92-84d1-8b071540de10)

After:

![image](https://github.com/tldraw/tldraw/assets/2523721/ca2e2a9e-f9f6-48a8-936f-05a402c1e7a2)


### Change Type

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

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

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

- [ ] `bugfix` — Bug fix
- [ ] `feature` — New feature
- [x] `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
2024-04-08 11:36:12 +00:00
Mime Čuvalo 63f4059938
Revert "textfields: fix Safari cursor rendering bug (#3373)"
This reverts commit bd433483b0.
2024-04-08 12:25:35 +02:00
Orion Reed 86403c1b0d
Fix typo in Store.ts (#3385)
An immense contribution, I know.

### Change Type

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

- [ x ] `docs` — Changes to the documentation, examples, or templates.

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

- [ x ] `chore` — Updating dependencies, other boring stuff
2024-04-08 08:06:24 +00:00
Mime Čuvalo 09bf33f9fa
textfields: fix cursor position on mobile in EditingShape (#3374)
On mobile, cursor position wasn't going to the right place when using
the EditingShape→EditingShape transition.

Before


https://github.com/tldraw/tldraw/assets/469604/9487d741-684b-4562-b1c2-7ea8f89a3a56

After


https://github.com/tldraw/tldraw/assets/469604/f828e1ce-0315-4393-be50-c31888e25f3a



### Change Type

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

- [x] `sdk` — Changes the tldraw SDK
- [ ] `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
2024-04-06 23:05:02 +01:00
Mime Čuvalo bd433483b0
textfields: fix Safari cursor rendering bug (#3373)
There seems to be a Webkit bug with the cursor not initially being
visible sometimes, especially when the page first loads.
This ain't pretty but it's a not-too-hacky way of "shaking" the cursor
awake.

Before:


https://github.com/tldraw/tldraw/assets/469604/ca66c7d1-8b34-498a-a827-4f7725ab85dd


After:


https://github.com/tldraw/tldraw/assets/469604/93d0f190-b586-496c-a416-0c726ac51858




### Change Type

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

- [x] `sdk` — Changes the tldraw SDK
- [ ] `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
2024-04-06 23:04:09 +01:00
Steve Ruiz 001cfa33c9 remove parenting tests, skip auto edit tests 2024-04-06 22:57:32 +01:00
Steve Ruiz c840acdca5 fix long press bug 2024-04-06 22:52:17 +01:00
Steve Ruiz a16ac3e9db Update DefaultHandle.tsx 2024-04-06 22:50:10 +01:00
Steve Ruiz 5f0e2197bf show selection box while editing 2024-04-06 22:44:02 +01:00
Steve Ruiz d45cfe0b0b remove bring to front 2024-04-06 22:41:28 +01:00
Steve Ruiz f1da5ab361 Merge branch 'main' into stickies-rc 2024-04-06 22:40:03 +01:00
Steve Ruiz 4b04a51a12 Update DefaultCanvas.tsx 2024-04-06 22:38:46 +01:00
Steve Ruiz 5aa64a1460
Remove note parenting (#3384)
This PR removes the ability for notes to accept children. It keeps all
of the other improvements to dragging / dropping / etc.

### Change Type

- [x] `sdk` — Changes the tldraw SDK
- [x] `feature` — New feature
2024-04-06 22:34:30 +01:00
Steve Ruiz 62d90a797e
[stickies] feature flag edit on type (#3383)
This PR removes edit on type. A noble ambition, perhaps feature flag?

### Change Type
- [x] `sdk` — Changes the tldraw SDK
- [x] `improvement` — Improving existing features
2024-04-06 22:31:21 +01:00
Mime Čuvalo b14b61e7fb
textfields: need to select on pointer down when in EditingShape, not later (#3372)
A long press was causing the wrong shape to be selected on mobile. We
need to set the right selection on pointer down not on up.

before


https://github.com/tldraw/tldraw/assets/469604/610f5dc8-a619-419a-9e4d-db1c3af767da

after


https://github.com/tldraw/tldraw/assets/469604/8ff16119-5850-403a-89f3-a113408d3816



### Change Type

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

- [x] `sdk` — Changes the tldraw SDK
- [ ] `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
2024-04-06 22:18:42 +01:00
Mitja Bezenšek d01a2223be
Fix an issue with layers when moving shapes. (#3380)
https://github.com/tldraw/tldraw/assets/2523721/d35b5e41-5270-4fad-8f9e-f8d7ac46558c



https://github.com/tldraw/tldraw/assets/2523721/2e1d1f54-f980-437d-aa51-f598b59d56b9



### Change Type

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

- [x] `sdk` — Changes the tldraw SDK
- [ ] `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
2024-04-05 19:09:07 +00:00
Steve Ruiz 97b5e4093a
[culling] minimal culled diff with webgl (#3377)
This PR extracts the #3344 changes to a smaller diff against main. It
does not include the changes to how / where culled shapes are
calculated, though I understand this could be much more efficiently
done!

### Change Type

- [x] `sdk` — Changes the tldraw SDK
- [x] `improvement` — Improving existing features

---------

Co-authored-by: Mitja Bezenšek <mitja.bezensek@gmail.com>
2024-04-05 18:03:22 +00:00
Steve Ruiz 4d32a38cf8
put `getCurrentPageId` into a computed (#3378)
This PR makes the `getCurrentPageId` method use a computed. Previously,
anything that referenced the current page id would pick up any change to
instance state. This will help a bunch of interactions like brushing
that would update the instance state on every frame.

### Change Type

- [x] `sdk` — Changes the tldraw SDK
- [x] `improvement` — Improving existing features
2024-04-05 16:02:11 +00:00
Mitja Bezenšek f1e0af7631
Display none for culled shapes (#3291)
Comparing different culling optimizations:


https://github.com/tldraw/tldraw/assets/2523721/0b3b8b42-ed70-45b7-bf83-41023c36a563

I think we should go with the `display: none` + showing the skeleteon.
The way it works is:
- We now add a sibling to the shape wrapper div which serves as the
skeleton for the culled shapes.
- Only one of the two divs (shape wrapper and skeleton div) is
displayed. The other one is using `display: none` to improve
performance.

### Change Type

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

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

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

- [ ] `bugfix` — Bug fix
- [ ] `feature` — New feature
- [x] `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


- Improve performance of culled shapes by using `display: none`.

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2024-04-05 13:23:02 +00:00
Mime Čuvalo 67e83b76ef
editingshape state: make sure we reset this.hitShapeForPointerUp when done with it 2024-04-05 14:03:16 +01:00
Mime Čuvalo 0505c1eb1c
textfields: prevent selection drag on Firefox (#3370)
This is a minor edge case but worth accounting for: in Firefox, there's
a behavior where dragging a selection will grab that selection into the
drag event. However, once the drag is over, and you select away from the
textarea, starting a drag over the textarea will restart a selection
drag, instead of a shape drag. And also then your cursor will get
'stuck' because it missed some pointer event somewhere. This prevents
that default behavior in FF.

Before:


https://github.com/tldraw/tldraw/assets/469604/21416a61-e439-4245-bf4b-c41b170bfb05


After:


https://github.com/tldraw/tldraw/assets/469604/6b372fd6-c1dd-4d5f-b959-ce961b188d1f



### Change Type

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

- [x] `sdk` — Changes the tldraw SDK
- [ ] `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
2024-04-05 13:53:50 +01:00
Steve Ruiz b69b6366b8 Merge branch 'main' into stickies-rc 2024-04-05 13:52:24 +01:00
Steve Ruiz 4a494a2eaf
Update useFileSystem.tsx (#3371)
This PR makes a small change to how useFileSystem reports errors, so
that legitimate errors may be caught.

### Change Type

- [x] `sdk` — Changes the tldraw SDK
- [x] `feature` — New feature
2024-04-05 11:40:28 +00:00
Steve Ruiz f9a4fc3e34 Update Translating.ts 2024-04-05 12:08:41 +01:00
Steve Ruiz 21141d6c1e fix test 2024-04-05 12:08:25 +01:00
Steve Ruiz 2a263fba4c stickies: translucency, sometimes
stickies: translucency, sometimes
2024-04-05 11:39:29 +01:00
Taha e8de70ec85
Examples: update kbd shortcuts, add actions overrides example (#3330)
I think the keyboard shortcuts example already teaches the concept that
the actions overrides example does. I've updated the keyboard shortcuts
example and included an action override example in case we want that
too.

### Change Type

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

- [ ] `sdk` — Changes the tldraw SDK
- [ ] `dotcom` — Changes the tldraw.com web app
- [x] `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 ️ -->

- [ ] `bugfix` — Bug fix
- [ ] `feature` — New feature
- [x] `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 action overrides example, update keyboard shortcuts example

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2024-04-05 10:04:38 +00:00
Mime Čuvalo 1a642387de
lint 2024-04-05 10:56:59 +01:00
Mime Čuvalo c5059f15bb
textfields: bring shape into view when editing (#3362)
This actually is a problem in production anyway, for any shape, not
particular to new auto-editing or stickies.
Case in point:
- shape is selected
- move the shape offscreen
- hit Enter
- you'll be editing the shape but it won't be visible to you.

This change consolidates some of the duplicate logic in `Idle.ts` and in
`noteHelpers.ts`.

Two questions
- `Idle.ts` didn't have the `select()` call but `noteHelpers.ts` did -
is this really important?
- `noteHelpers` didn't have the `mark()` call but `Idle.ts` did - seems
like it was missing in noteHelpers, but lemme know if that was intended
to be left out.

### Change Type

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

- [x] `sdk` — Changes the tldraw SDK
- [ ] `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


### Release Notes

- Textfields: bring shape to view that's being edited.

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2024-04-05 10:49:54 +01:00
Mime Čuvalo 7671e6291e
merge 2024-04-05 10:29:41 +01:00
Mime Čuvalo 1df05133af
stickies: update geometry to differentiate between shape and text label (#3361)
Separates out the geometry - we want clicking in the negative space to
not have the text editing mechanics. This definitely feels better
without the sticky note textfield assuming it takes up the whole note.

Before:
<img width="614" alt="Screenshot 2024-04-04 at 15 35 58"
src="https://github.com/tldraw/tldraw/assets/469604/f4673fc5-5b9a-4ab9-a169-a91ba7f49d17">
After:
<img width="636" alt="Screenshot 2024-04-04 at 15 35 42"
src="https://github.com/tldraw/tldraw/assets/469604/645c439a-662b-4244-af7f-6c718e5c5fc2">


### Change Type

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

- [x] `sdk` — Changes the tldraw SDK
- [ ] `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 ️ -->

- [ ] `bugfix` — Bug fix
- [ ] `feature` — New feature
- [x] `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

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2024-04-05 09:15:07 +01:00
Steve Ruiz 58286db90c
Add long press event (#3275)
This PR adds a "long press" event that fires when pointing for more than
500ms. This event is used in the same way that dragging is used (e.g. to
transition to from pointing_selection to translating) but only on
desktop. On mobile, long presses are used to open the context menu.

![Kapture 2024-03-26 at 18 57
15](https://github.com/tldraw/tldraw/assets/23072548/34a7ee2b-bde6-443b-93e0-082453a1cb61)

## Background

This idea came out of @TodePond's #3208 PR. We use a "dead zone" to
avoid accidentally moving / rotating things when clicking on them, which
is especially common on mobile if a dead zone feature isn't implemented.
However, this makes it difficult to make "fine adjustments" because you
need to drag out of the dead zone (to start translating) and then drag
back to where you want to go.

![Kapture 2024-03-26 at 19 00
38](https://github.com/tldraw/tldraw/assets/23072548/9a15852d-03d0-4b88-b594-27dbd3b68780)

With this change, you can long press on desktop to get to that
translating state. It's a micro UX optimization but especially nice if
apps want to display different UI for "dragging" shapes before the user
leaves the dead zone.

![Kapture 2024-03-26 at 19 02
59](https://github.com/tldraw/tldraw/assets/23072548/f0ff337e-2cbd-4b73-9ef5-9b7deaf0ae91)

### Change Type

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

- [x] `sdk` — Changes the tldraw SDK
- [ ] `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 ️ -->

- [ ] `bugfix` — Bug fix
- [x] `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. Long press shapes, selections, resize handles, rotate handles, crop
handles.
2. You should enter the corresponding states, just as you would have
with a drag.

- [ ] Unit Tests TODO

### Release Notes

- Add support for long pressing on desktop.
2024-04-04 21:50:01 +00:00
Steve Ruiz 4a84b3482c Simplify RTL 2024-04-04 22:49:28 +01:00
Steve Ruiz e3ceb270e7
Merge branch 'main' into stickies-rc 2024-04-04 22:17:27 +01:00
Steve Ruiz 43edeb09b5
Add white migration (#3334)
This PR adds a down migration for #3321.

### Change Type

- [x] `sdk` — Changes the tldraw SDK
- [x] `dunno` — I don't know
2024-04-04 18:16:17 +00:00