fix(tldraw): apply dynamic sizing when dragging shapes from toolbar#8042
fix(tldraw): apply dynamic sizing when dragging shapes from toolbar#8042
Conversation
When dynamic size mode is enabled, shapes created by clicking with a tool respect the zoom level, but shapes dragged from the toolbar did not. Apply the same scale calculation in each toolbar onDragStart callback, matching the pattern used in each tool's Pointing state. Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
mimecuvalo
left a comment
There was a problem hiding this comment.
this is starting to get repetitive across the codebase. let's create a function called editor.getResizeScaleFactor() please! and if you don't mind, let's change the other places you see this in the codebase 🙏
|
API Changes Check Passed Great! The PR description now includes the required "### API changes" section. This helps reviewers and SDK users understand the impact of your changes. |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| 🔵 In progress View logs |
branching-chat-template | a08646b | Mar 10 2026, 05:20 PM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| 🔵 In progress View logs |
multiplayer-template | a08646b | Mar 10 2026, 05:20 PM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| 🔵 In progress View logs |
tldraw-mcp-app | a08646b | Mar 10 2026, 05:20 PM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| 🔵 In progress View logs |
image-pipeline-template | a08646b | Mar 10 2026, 05:20 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
image-pipeline-template | a08646b | Commit Preview URL Branch Preview URL |
Mar 10 2026, 05:24 PM |
In order to publish the v4.5.0 release notes and record the v4.4.1 patch, this PR archives release notes and resets `next.mdx` for the next cycle. **v4.5.0.mdx** (new file): - Archived from `next.mdx` with full frontmatter, keywords, and GitHub release link - Featured sections: click-through on transparent image pixels (#7942), breaking `EmbedShapeUtil.configure()` change (#8034) - API changes: `Editor.getResizeScaleFactor()` (#8042), `TLImageAsset.pixelRatio` (#8163), `sanitizeSvg` (#7896), `experimental__onDropOnCanvas` (#7911), enum-to-const refactoring (#8084) - 6 improvements and 20 bug fixes from production **v4.4.0.mdx:** - Add v4.4.1 patch release section with tooltip positioning fix (#8171) - Add v4.4.1 to keywords **next.mdx:** - Reset with `last_version: v4.5.0` and empty content ### Change type - [x] `other` ### Code changes | Section | LOC change | | ------------- | ------------- | | Documentation | +128 / -107 |
In order to publish the v4.5.0 release notes and record the v4.4.1 patch, this PR archives release notes and resets `next.mdx` for the next cycle. **v4.5.0.mdx** (new file): - Archived from `next.mdx` with full frontmatter, keywords, and GitHub release link - Featured sections: click-through on transparent image pixels (#7942), breaking `EmbedShapeUtil.configure()` change (#8034) - API changes: `Editor.getResizeScaleFactor()` (#8042), `TLImageAsset.pixelRatio` (#8163), `sanitizeSvg` (#7896), `experimental__onDropOnCanvas` (#7911), enum-to-const refactoring (#8084) - 6 improvements and 20 bug fixes from production **v4.4.0.mdx:** - Add v4.4.1 patch release section with tooltip positioning fix (#8171) - Add v4.4.1 to keywords **next.mdx:** - Reset with `last_version: v4.5.0` and empty content ### Change type - [x] `other` ### Code changes | Section | LOC change | | ------------- | ------------- | | Documentation | +128 / -107 |
In order to make shapes dragged from the toolbar respect dynamic sizing (matching the behavior of click-to-create), this PR applies the same
scalecalculation to each toolbaronDragStartcallback and centralizes the scale factor logic into a neweditor.getResizeScaleFactor()method.When dynamic size mode is enabled, shapes created by clicking with a tool respect the zoom level via the
scaleprop, but shapes dragged out of the toolbar did not. This adds the same scaling to toolbar drag-create for geo, arrow, line, frame, text, and note tools, and refactors all Pointing states to use the shared helper.Closes #7998
Change type
bugfixTest plan
API changes
Editor.getResizeScaleFactor()— returns1 / zoomLevelwhen dynamic sizing is enabled,1otherwiseRelease notes