Steve Ruiz преди 3 години
родител
ревизия
101a0cd7a8
No account linked to committer's email address

+ 2
- 0
packages/tldraw/src/state/TldrawApp.ts Целия файл

@@ -1437,6 +1437,8 @@ export class TldrawApp extends StateManager<TDSnapshot> {
1437 1437
         .map((shape) => {
1438 1438
           const parentShapeId = idsMap[shape.parentId]
1439 1439
 
1440
+          console.log(shape)
1441
+
1440 1442
           const copy = {
1441 1443
             ...shape,
1442 1444
             id: idsMap[shape.id],

+ 38
- 36
packages/tldraw/src/state/shapes/ArrowUtil/ArrowUtil.tsx Целия файл

@@ -1,5 +1,5 @@
1 1
 import * as React from 'react'
2
-import { Utils, TLBounds, TLPointerInfo, SVGContainer } from '@tldraw/core'
2
+import { Utils, TLBounds, SVGContainer } from '@tldraw/core'
3 3
 import { Vec } from '@tldraw/vec'
4 4
 import { defaultStyle, getShapeStyle } from '../shared/shape-styles'
5 5
 import {
@@ -47,45 +47,47 @@ export class ArrowUtil extends TDShapeUtil<T, E> {
47 47
   pathCache = new WeakMap<T, string>()
48 48
 
49 49
   getShape = (props: Partial<T>): T => {
50
-    return Utils.deepMerge<T>(
51
-      {
52
-        id: 'id',
53
-        type: TDShapeType.Arrow,
54
-        name: 'Arrow',
55
-        parentId: 'page',
56
-        childIndex: 1,
57
-        point: [0, 0],
58
-        rotation: 0,
59
-        bend: 0,
60
-        handles: {
61
-          start: {
62
-            id: 'start',
63
-            index: 0,
64
-            point: [0, 0],
65
-            canBind: true,
66
-          },
67
-          end: {
68
-            id: 'end',
69
-            index: 1,
70
-            point: [1, 1],
71
-            canBind: true,
72
-          },
73
-          bend: {
74
-            id: 'bend',
75
-            index: 2,
76
-            point: [0.5, 0.5],
77
-          },
50
+    return {
51
+      id: 'id',
52
+      type: TDShapeType.Arrow,
53
+      name: 'Arrow',
54
+      parentId: 'page',
55
+      childIndex: 1,
56
+      point: [0, 0],
57
+      rotation: 0,
58
+      bend: 0,
59
+      handles: {
60
+        start: {
61
+          id: 'start',
62
+          index: 0,
63
+          point: [0, 0],
64
+          canBind: true,
65
+          ...props.handles?.start,
78 66
         },
79
-        decorations: {
80
-          end: Decoration.Arrow,
67
+        end: {
68
+          id: 'end',
69
+          index: 1,
70
+          point: [1, 1],
71
+          canBind: true,
72
+          ...props.handles?.end,
81 73
         },
82
-        style: {
83
-          ...defaultStyle,
84
-          isFilled: false,
74
+        bend: {
75
+          id: 'bend',
76
+          index: 2,
77
+          point: [0.5, 0.5],
78
+          ...props.handles?.bend,
85 79
         },
86 80
       },
87
-      props
88
-    )
81
+      decorations: props.decorations ?? {
82
+        end: Decoration.Arrow,
83
+      },
84
+      style: {
85
+        ...defaultStyle,
86
+        isFilled: false,
87
+        ...props.style,
88
+      },
89
+      ...props,
90
+    }
89 91
   }
90 92
 
91 93
   Component = TDShapeUtil.Component<T, E, TDMeta>(({ shape, isGhost, meta, events }, ref) => {

+ 4
- 1
packages/tldraw/src/state/tools/LineTool/LineTool.ts Целия файл

@@ -23,7 +23,10 @@ export class LineTool extends BaseTool {
23 23
       parentId: currentPageId,
24 24
       childIndex,
25 25
       point: currentPoint,
26
-      decorations: undefined,
26
+      decorations: {
27
+        start: undefined,
28
+        end: undefined,
29
+      },
27 30
       style: { ...currentStyle },
28 31
     })
29 32
 

Loading…
Отказ
Запис