Selaa lähdekoodia

Remove fancy draw prediction.

Until we have a better solution.
main
Steve Ruiz 4 vuotta sitten
vanhempi
commit
c8070857b1
1 muutettua tiedostoa jossa 1 lisäystä ja 26 poistoa
  1. 1
    26
      state/sessions/draw-session.ts

+ 1
- 26
state/sessions/draw-session.ts Näytä tiedosto

80
     // Low pass the current input point against the previous one
80
     // Low pass the current input point against the previous one
81
     const nextPrev = vec.med(this.previous, point)
81
     const nextPrev = vec.med(this.previous, point)
82
 
82
 
83
-    // A delta to project the projected point
84
-    const offset = vec.sub(nextPrev, this.previous)
85
-
86
     this.previous = nextPrev
83
     this.previous = nextPrev
87
 
84
 
88
-    // Generate some temporary points towards a projected point
89
-    const temporaryPoints = [0.7, 0.9, 0.95, 1].map((v) =>
90
-      vec.round([
91
-        ...vec.sub(
92
-          vec.lrp(this.previous, vec.add(point, offset), v),
93
-          this.origin
94
-        ),
95
-        pressure,
96
-      ])
97
-    )
98
-
99
     // Don't add duplicate points. It's important to test against the
85
     // Don't add duplicate points. It's important to test against the
100
     // adjusted (low-passed) point rather than the input point.
86
     // adjusted (low-passed) point rather than the input point.
101
 
87
 
114
     // prevents a "flash" of a dot when a user begins drawing a line.
100
     // prevents a "flash" of a dot when a user begins drawing a line.
115
     if (this.points.length <= 2) return
101
     if (this.points.length <= 2) return
116
 
102
 
117
-    // If the delta between the averaged point and the real point is
118
-    // too great, skip the temporary points. This avoids "sawblading".
119
-    const tooFarForTemporaryPoints =
120
-      isMobile() || vec.dist(newPoint, temporaryPoints[3]) > 32
121
-
122
     // Update the points and update the shape's parents.
103
     // Update the points and update the shape's parents.
123
     const shape = getShape(data, snapshot.id) as DrawShape
104
     const shape = getShape(data, snapshot.id) as DrawShape
124
 
105
 
125
-    getShapeUtils(shape).setProperty(
126
-      shape,
127
-      'points',
128
-      tooFarForTemporaryPoints
129
-        ? [...this.points]
130
-        : [...this.points, ...temporaryPoints]
131
-    )
106
+    getShapeUtils(shape).setProperty(shape, 'points', [...this.points])
132
 
107
 
133
     updateParents(data, [shape.id])
108
     updateParents(data, [shape.id])
134
   }
109
   }

Loading…
Peruuta
Tallenna