Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions apps/docs/content/releases/next.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ New helpers `getOwnerDocument()` and `getOwnerWindow()` are exported from `@tldr
- Optimize geometry hot paths for hit testing: reduce allocations and function call overhead in `Vec`, `Edge2d`, `Circle2d`, `Arc2d`, `Polyline2d`, and intersection routines. Circle hit testing is up to 19x faster, polyline nearest-point is 6.8x faster. ([#8210](https://github.com/tldraw/tldraw/pull/8210))
- Exports now automatically trim to visual content bounds, capturing overflow like thick strokes and arrowheads without extra whitespace. ([#8202](https://github.com/tldraw/tldraw/pull/8202))
- Improve resize performance for multiple geo shapes with text labels by batching DOM measurements into a single pass per frame. ([#7949](https://github.com/tldraw/tldraw/pull/7949))
- Allow Cmd+click / Ctrl+click on style panel items to apply style changes only to selected shapes without updating defaults for future shapes. ([#8452](https://github.com/tldraw/tldraw/pull/8452))
- Hide selection overlay when nudging shapes with arrow keys. ([#8447](https://github.com/tldraw/tldraw/pull/8447))
- Replace `@use-gesture/react` dependency with custom gesture handling, reducing bundle size and eliminating a stale dependency. ([#8392](https://github.com/tldraw/tldraw/pull/8392))
- Tighten iframe referrer policy for embeds to send only the origin instead of the full URL to third-party embed providers. ([#8412](https://github.com/tldraw/tldraw/pull/8412))
- Move the debug mode toggle into the preferences submenu. ([#8259](https://github.com/tldraw/tldraw/pull/8259))
Expand All @@ -294,3 +296,9 @@ New helpers `getOwnerDocument()` and `getOwnerWindow()` are exported from `@tldr
- Fix right-clicking inside a multi-selection over a filled background shape changing the selection. ([#8434](https://github.com/tldraw/tldraw/pull/8434))
- Fix memory leak where the Editor was retained after unmount via a shared throttled `updateHoveredShapeId` closure. ([#8439](https://github.com/tldraw/tldraw/pull/8439))
- Fix pattern fill not scaling correctly with dynamic size mode. ([#8441](https://github.com/tldraw/tldraw/pull/8441))
- Fix arrow labels rendered at incorrect size when editing at high zoom in dynamic size mode. ([#8451](https://github.com/tldraw/tldraw/pull/8451))
- Fix shadow artifact and oversized caret on notes and geo shapes at high zoom in dynamic size mode. ([#8378](https://github.com/tldraw/tldraw/pull/8378))
- Fix crash from duplicate fractional index keys in `kickoutOccludedShapes` during multiplayer sync. ([#8448](https://github.com/tldraw/tldraw/pull/8448))
- Fix NaN propagation from zero-length labeled arrows causing all shapes to disappear. ([#8329](https://github.com/tldraw/tldraw/pull/8329))
- Fix crash when isolating curved arrows with degenerate geometry. ([#8176](https://github.com/tldraw/tldraw/pull/8176))
- Fix camera state stuck at 'moving' on dispose, blocking shape interactions on the next editor instance. ([#8396](https://github.com/tldraw/tldraw/pull/8396))
2 changes: 1 addition & 1 deletion apps/docs/content/sdk-features/locked-shapes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,4 @@ When this returns `true`, double-clicking the locked shape enters edit mode, let

## Locking in the UI

In the default tldraw UI, users can lock shapes through the context menu or the keyboard shortcut (`Shift+L`). Locked shapes display a lock indicator when hovered, and the context menu shows an unlock option.
In the default tldraw UI, users can lock shapes through the context menu or the keyboard shortcut (`Shift+L`). Users can right-click on a locked shape to access the context menu, which shows an unlock option.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 10 additions & 10 deletions packages/tldraw/src/lib/shapes/shared/PathBuilder.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ describe('PathBuilder', () => {
.toSvg({ strokeWidth: 10, style: 'draw', randomSeed: '123' })

expect(path).toMatchInlineSnapshot(`
<path
d="M 1.6479 1.9547 L 93.8229 93.8006 Q 100.8939 100.8717 100.8939 90.8717 L 100.9 0.5128 C 70.2895 -25.705 25.518 -25.705 -2.0962 1.9093 C -26.8794 24.5012 -26.8794 69.2727 0.7349 96.8869 M 2.9315 3.0157 L 94.1973 93.0354 Q 101.2684 100.1065 101.2684 90.1065 L 99.3236 -0.0235 C 75.199 -28.4858 30.4275 -28.4858 2.8132 -0.8716 C -27.3141 28.8687 -27.3141 73.6402 0.3001 101.2544"
strokeWidth={10}
/>
`)
<path
d="M 1.1127 1.3198 L 93.8385 93.868 Q 100.9096 100.9391 100.9096 90.9391 L 98.8429 1.0539 C 70.8916 -27.0473 26.1201 -27.0473 -1.4942 0.567 C -25.8613 28.4081 -25.8613 73.1797 1.7529 100.7939 M 1.4332 1.4744 L 92.9725 92.6522 Q 100.0436 99.7233 100.0436 89.7233 L 100.9554 -0.296 C 72.6836 -26.9909 27.9121 -26.9909 0.2978 0.6234 C -29.073 25.7004 -29.073 70.4719 -1.4587 98.0862"
strokeWidth={10}
/>
`)
const closed = new PathBuilder()
.moveTo(0, 0)
.lineTo(100, 100)
Expand All @@ -119,11 +119,11 @@ describe('PathBuilder', () => {
.toSvg({ strokeWidth: 10, style: 'draw', randomSeed: '123' })

expect(closed).toMatchInlineSnapshot(`
<path
d="M 8.719 9.0257 L 93.8229 93.8006 Q 100.8939 100.8717 100.8939 90.8717 L 100.9 0.5128 C 70.2895 -25.705 25.518 -25.705 -2.0962 1.9093 C -26.8794 24.5012 -26.8794 69.2727 0.7349 96.8869 L 1.6479 11.9547 Q 1.6479 1.9547 8.719 9.0257 M 10.0026 10.0867 L 94.1973 93.0354 Q 101.2684 100.1065 101.2684 90.1065 L 99.3236 -0.0235 C 75.199 -28.4858 30.4275 -28.4858 2.8132 -0.8716 C -27.3141 28.8687 -27.3141 73.6402 0.3001 101.2544 L 2.9315 13.0157 Q 2.9315 3.0157 10.0026 10.0867"
strokeWidth={10}
/>
`)
<path
d="M 8.1837 8.3908 L 93.8385 93.868 Q 100.9096 100.9391 100.9096 90.9391 L 98.8429 1.0539 C 70.8916 -27.0473 26.1201 -27.0473 -1.4942 0.567 C -25.8613 28.4081 -25.8613 73.1797 1.7529 100.7939 L 1.1127 11.3198 Q 1.1127 1.3198 8.1837 8.3908 M 8.5043 8.5454 L 92.9725 92.6522 Q 100.0436 99.7233 100.0436 89.7233 L 100.9554 -0.296 C 72.6836 -26.9909 27.9121 -26.9909 0.2978 0.6234 C -29.073 25.7004 -29.073 70.4719 -1.4587 98.0862 L 1.4332 11.4744 Q 1.4332 1.4744 8.5043 8.5454"
strokeWidth={10}
/>
`)
})
})

Expand Down
11 changes: 8 additions & 3 deletions packages/tldraw/src/lib/shapes/shared/PathBuilder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -811,9 +811,14 @@ export class PathBuilder {
tangentToNext,
tangentToPrev,
} of drawCommands) {
const offset = command.isClose
? lastMoveToOffset
: { x: random() * offsetAmount, y: random() * offsetAmount }
let offset: VecLike
if (command.isClose) {
offset = lastMoveToOffset
} else {
const direction = new Vec(random(), random()).uni()
const magnitude = Math.sqrt(Math.abs(random())) * offsetAmount
offset = Vec.Mul(direction, magnitude)
}

if (command.type === 'move') {
lastMoveToOffset = offset
Expand Down
Loading