Pārlūkot izejas kodu

Adds pressure to pointer data

main
Steve Ruiz 3 gadus atpakaļ
vecāks
revīzija
72accc5f44
2 mainītis faili ar 8 papildinājumiem un 8 dzēšanām
  1. 3
    3
      lib/shape-utils/draw.tsx
  2. 5
    5
      state/inputs.tsx

+ 3
- 3
lib/shape-utils/draw.tsx Parādīt failu

@@ -165,9 +165,9 @@ function renderPath(shape: DrawShape, style: ShapeStyles) {
165 165
     getSvgPathFromStroke(
166 166
       getStroke(shape.points, {
167 167
         size: 1 + +styles.strokeWidth * 2,
168
-        thinning: 0.83,
169
-        end: { taper: +styles.strokeWidth * 16 },
170
-        start: { taper: +styles.strokeWidth * 16 },
168
+        thinning: 0.85,
169
+        end: { taper: +styles.strokeWidth * 20 },
170
+        start: { taper: +styles.strokeWidth * 20 },
171 171
       })
172 172
     )
173 173
   )

+ 5
- 5
state/inputs.tsx Parādīt failu

@@ -61,8 +61,8 @@ class Inputs {
61 61
     const info = {
62 62
       target,
63 63
       pointerId: e.pointerId,
64
-      origin: [e.clientX, e.clientY],
65
-      point: [e.clientX, e.clientY],
64
+      origin: [e.clientX, e.clientY, e.pressure],
65
+      point: [e.clientX, e.clientY, e.pressure],
66 66
       shiftKey,
67 67
       ctrlKey,
68 68
       metaKey: isDarwin() ? metaKey : ctrlKey,
@@ -81,8 +81,8 @@ class Inputs {
81 81
     const info = {
82 82
       target,
83 83
       pointerId: e.pointerId,
84
-      origin: [e.clientX, e.clientY],
85
-      point: [e.clientX, e.clientY],
84
+      origin: [e.clientX, e.clientY, e.pressure],
85
+      point: [e.clientX, e.clientY, e.pressure],
86 86
       shiftKey,
87 87
       ctrlKey,
88 88
       metaKey: isDarwin() ? metaKey : ctrlKey,
@@ -100,7 +100,7 @@ class Inputs {
100 100
     const info = {
101 101
       ...prev,
102 102
       pointerId: e.pointerId,
103
-      point: [e.clientX, e.clientY],
103
+      point: [e.clientX, e.clientY, e.pressure],
104 104
       shiftKey,
105 105
       ctrlKey,
106 106
       metaKey: isDarwin() ? metaKey : ctrlKey,

Notiek ielāde…
Atcelt
Saglabāt