Ver código fonte

fixes dot on drawing

main
Steve Ruiz 4 anos atrás
pai
commit
ba9c5f6d97

+ 1
- 1
components/tools-panel/tools-panel.tsx Ver arquivo

@@ -177,7 +177,7 @@ export default function ToolsPanel() {
177 177
 
178 178
 const OuterContainer = styled('div', {
179 179
   position: 'fixed',
180
-  bottom: 32,
180
+  bottom: 44,
181 181
   left: 0,
182 182
   right: 0,
183 183
   padding: '0 8px 12px 8px',

+ 1
- 1
lib/shape-utils/draw.tsx Ver arquivo

@@ -54,7 +54,7 @@ const draw = registerShapeUtils<DrawShape>({
54 54
       renderPath(shape, style)
55 55
     }
56 56
 
57
-    if (points.length < 2) {
57
+    if (points.length > 0 && points.length < 3) {
58 58
       return (
59 59
         <circle id={id} r={+styles.strokeWidth * 0.618} fill={styles.stroke} />
60 60
       )

+ 10
- 3
state/sessions/draw-session.ts Ver arquivo

@@ -22,12 +22,14 @@ export default class BrushSession extends BaseSession {
22 22
     this.origin = point
23 23
     this.previous = point
24 24
     this.last = point
25
-    this.points = []
25
+    this.points = [[0, 0]]
26 26
     this.snapshot = getDrawSnapshot(data, id)
27 27
 
28 28
     const page = getPage(data)
29
-    const shape = page.shapes[id]
29
+    const shape = page.shapes[id] as DrawShape
30 30
     getShapeUtils(shape).translateTo(shape, point)
31
+
32
+    updateParents(data, [shape.id])
31 33
   }
32 34
 
33 35
   update = (
@@ -99,7 +101,12 @@ export default class BrushSession extends BaseSession {
99 101
     const page = getPage(data)
100 102
     const shape = page.shapes[snapshot.id] as DrawShape
101 103
 
102
-    getShapeUtils(shape).onSessionComplete(shape)
104
+    getShapeUtils(shape)
105
+      .setProperty(shape, 'points', [...this.points])
106
+      .onSessionComplete(shape)
107
+
108
+    updateParents(data, [shape.id])
109
+
103 110
     commands.draw(data, this.snapshot.id)
104 111
   }
105 112
 }

+ 0
- 4
state/storage.ts Ver arquivo

@@ -23,8 +23,6 @@ class Storage {
23 23
   }
24 24
 
25 25
   load(data: Data, restoredData: any) {
26
-    console.log('loading restored data', restoredData)
27
-
28 26
     // Before loading the state, save the pages / page states
29 27
     for (let key in restoredData.document.pages) {
30 28
       this.savePage(restoredData, restoredData.document.id, key)
@@ -246,8 +244,6 @@ class Storage {
246 244
         getTextFromBlob(blob).then((text) => {
247 245
           const restoredData = JSON.parse(text)
248 246
 
249
-          console.log('restoring data', restoredData)
250
-
251 247
           if (restoredData === null) {
252 248
             console.warn('Could not load that data.')
253 249
             return

Carregando…
Cancelar
Salvar