Skip to content

[pull] main from tldraw:main#121

Merged
pull[bot] merged 1 commit intocode:mainfrom
tldraw:main
Jul 31, 2025
Merged

[pull] main from tldraw:main#121
pull[bot] merged 1 commit intocode:mainfrom
tldraw:main

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented Jul 31, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.3)

Can you help keep this open source service alive? 💖 Please sponsor : )

This PR adds the ability to drag tools out of the toolbar and onto the
canvas.

![Kapture 2024-10-26 at 11 11
44](https://github.com/user-attachments/assets/fc1bd904-4174-4a65-87d4-43eddf510ed4)

## Interaction notes

A user should be able to interact with the toolbar items in a few ways:
1. Click on the item to select the tool / activate its `onSelect` (on
touch start or pointer up).
2. Click and drag to create the shape, begin translating, and display
the tool as active; then drop to create the shape and in the case of
text and notes begin editing it
3. Click and drag and press Escape to cancel

## Implementation

This is very rough and involves a lot of duplication. It's not entirely
clear to me what the right API here is, so **I'd love to get some
input** on what we could do to make things easier.

Some open questions:

1. Should we abstract the "create on drag start" behavior, or provide
better information (ie the current page position) as the parameters to
that callback? What about behaviors like "select and start editing after
drag end"?
2. Is it the right idea to move the pointer move event to the container,
so that it occurs in front of the UI?

## Testing

Since this technically occurs at the UI layer, we'd have to write e2e
tests to verify that things are working the way we expect them to.

### Change type

- [x] `improvement`

### Test plan

1. Drag tools from the toolbar onto the canvas.
1. Drag tools from the toolbar overflow menu onto the canvas.

### Release notes

- Adds the ability to drag shapes from the toolbar onto the canvas.

### API changes

- Adds `onDragFromToolbarToCreateShape`,
`OnDragFromToolbarToCreateShapesOpts`, and `onDragStart` on
`TldrawUiMenuItem` to facilitate dragging shapes out of a toolbar

---------

Co-authored-by: Mitja Bezenšek <mitja.bezensek@gmail.com>
Co-authored-by: alex <alex@dytry.ch>
Co-authored-by: Mime Čuvalo <mimecuvalo@gmail.com>
@pull pull Bot locked and limited conversation to collaborators Jul 31, 2025
@pull pull Bot added the ⤵️ pull label Jul 31, 2025
@pull pull Bot merged commit 0e0fb8b into code:main Jul 31, 2025
@pull pull Bot requested a deployment to deploy-staging July 31, 2025 15:13 In progress
@pull pull Bot had a problem deploying to bemo-canary July 31, 2025 15:13 Failure
@pull pull Bot had a problem deploying to vsce publish July 31, 2025 15:13 Failure
@pull pull Bot had a problem deploying to deploy-production July 31, 2025 15:13 Failure
@pull pull Bot had a problem deploying to deploy-staging July 31, 2025 15:13 Error
@pull pull Bot had a problem deploying to bemo-canary July 31, 2025 15:13 Failure
@pull pull Bot had a problem deploying to deploy-staging August 1, 2025 00:28 Failure
@pull pull Bot temporarily deployed to e2e-dotcom August 1, 2025 02:35 Inactive
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant