Fix scale issue with new draw lines (#3971)

This PR fixes a bug where new draw shapes (created after 500 points)
would have scale 1.

### Change Type

- [x] `sdk` — Changes the tldraw SDK
- [x] `bugfix` — Bug fix

### Test Plan

1. Zoom in a lot
2. Draw for a long time
3. When the new draw shape happens, the new draw shape should have the
correct scale
This commit is contained in:
Steve Ruiz 2024-06-18 13:59:54 +01:00 committed by GitHub
parent e48f4bb798
commit b3e378a9c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -642,6 +642,8 @@ export class Drawing extends StateNode {
const newShapeId = createShapeId() const newShapeId = createShapeId()
const props = this.editor.getShape<DrawableShape>(id)!.props
this.editor.createShapes<DrawableShape>([ this.editor.createShapes<DrawableShape>([
{ {
id: newShapeId, id: newShapeId,
@ -650,6 +652,7 @@ export class Drawing extends StateNode {
y: toFixed(inputs.currentPagePoint.y), y: toFixed(inputs.currentPagePoint.y),
props: { props: {
isPen: this.isPenOrStylus, isPen: this.isPenOrStylus,
scale: props.scale,
segments: [ segments: [
{ {
type: 'free', type: 'free',