Просмотр исходного кода

Remove fancy draw prediction.

Until we have a better solution.
main
Steve Ruiz 4 лет назад
Родитель
Сommit
c8070857b1
1 измененных файлов: 1 добавлений и 26 удалений
  1. 1
    26
      state/sessions/draw-session.ts

+ 1
- 26
state/sessions/draw-session.ts Просмотреть файл

@@ -80,22 +80,8 @@ export default class BrushSession extends BaseSession {
80 80
     // Low pass the current input point against the previous one
81 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 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 85
     // Don't add duplicate points. It's important to test against the
100 86
     // adjusted (low-passed) point rather than the input point.
101 87
 
@@ -114,21 +100,10 @@ export default class BrushSession extends BaseSession {
114 100
     // prevents a "flash" of a dot when a user begins drawing a line.
115 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 103
     // Update the points and update the shape's parents.
123 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 108
     updateParents(data, [shape.id])
134 109
   }

Загрузка…
Отмена
Сохранить