浏览代码

Adds pressure to pointer data

main
Steve Ruiz 4 年前
父节点
当前提交
72accc5f44
共有 2 个文件被更改,包括 8 次插入8 次删除
  1. 3
    3
      lib/shape-utils/draw.tsx
  2. 5
    5
      state/inputs.tsx

+ 3
- 3
lib/shape-utils/draw.tsx 查看文件

165
     getSvgPathFromStroke(
165
     getSvgPathFromStroke(
166
       getStroke(shape.points, {
166
       getStroke(shape.points, {
167
         size: 1 + +styles.strokeWidth * 2,
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 查看文件

61
     const info = {
61
     const info = {
62
       target,
62
       target,
63
       pointerId: e.pointerId,
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
       shiftKey,
66
       shiftKey,
67
       ctrlKey,
67
       ctrlKey,
68
       metaKey: isDarwin() ? metaKey : ctrlKey,
68
       metaKey: isDarwin() ? metaKey : ctrlKey,
81
     const info = {
81
     const info = {
82
       target,
82
       target,
83
       pointerId: e.pointerId,
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
       shiftKey,
86
       shiftKey,
87
       ctrlKey,
87
       ctrlKey,
88
       metaKey: isDarwin() ? metaKey : ctrlKey,
88
       metaKey: isDarwin() ? metaKey : ctrlKey,
100
     const info = {
100
     const info = {
101
       ...prev,
101
       ...prev,
102
       pointerId: e.pointerId,
102
       pointerId: e.pointerId,
103
-      point: [e.clientX, e.clientY],
103
+      point: [e.clientX, e.clientY, e.pressure],
104
       shiftKey,
104
       shiftKey,
105
       ctrlKey,
105
       ctrlKey,
106
       metaKey: isDarwin() ? metaKey : ctrlKey,
106
       metaKey: isDarwin() ? metaKey : ctrlKey,

正在加载...
取消
保存