Przeglądaj źródła

fixes dot on drawing

main
Steve Ruiz 4 lat temu
rodzic
commit
ba9c5f6d97

+ 1
- 1
components/tools-panel/tools-panel.tsx Wyświetl plik

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

+ 1
- 1
lib/shape-utils/draw.tsx Wyświetl plik

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

+ 10
- 3
state/sessions/draw-session.ts Wyświetl plik

22
     this.origin = point
22
     this.origin = point
23
     this.previous = point
23
     this.previous = point
24
     this.last = point
24
     this.last = point
25
-    this.points = []
25
+    this.points = [[0, 0]]
26
     this.snapshot = getDrawSnapshot(data, id)
26
     this.snapshot = getDrawSnapshot(data, id)
27
 
27
 
28
     const page = getPage(data)
28
     const page = getPage(data)
29
-    const shape = page.shapes[id]
29
+    const shape = page.shapes[id] as DrawShape
30
     getShapeUtils(shape).translateTo(shape, point)
30
     getShapeUtils(shape).translateTo(shape, point)
31
+
32
+    updateParents(data, [shape.id])
31
   }
33
   }
32
 
34
 
33
   update = (
35
   update = (
99
     const page = getPage(data)
101
     const page = getPage(data)
100
     const shape = page.shapes[snapshot.id] as DrawShape
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
     commands.draw(data, this.snapshot.id)
110
     commands.draw(data, this.snapshot.id)
104
   }
111
   }
105
 }
112
 }

+ 0
- 4
state/storage.ts Wyświetl plik

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

Ładowanie…
Anuluj
Zapisz