@stroke-stabilizer/react 0.2.12 → 0.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +11 -6
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -33,12 +33,17 @@ function DrawingCanvas() {
33
33
  })
34
34
 
35
35
  const handlePointerMove = (e: React.PointerEvent) => {
36
- process({
37
- x: e.clientX,
38
- y: e.clientY,
39
- pressure: e.pressure,
40
- timestamp: e.timeStamp,
41
- })
36
+ // IMPORTANT: Use getCoalescedEvents() for smoother input
37
+ const events = e.nativeEvent.getCoalescedEvents?.() ?? [e.nativeEvent]
38
+
39
+ for (const ce of events) {
40
+ process({
41
+ x: ce.offsetX,
42
+ y: ce.offsetY,
43
+ pressure: ce.pressure,
44
+ timestamp: ce.timeStamp,
45
+ })
46
+ }
42
47
  }
43
48
 
44
49
  const handlePointerUp = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stroke-stabilizer/react",
3
- "version": "0.2.12",
3
+ "version": "0.2.14",
4
4
  "description": "React hooks for stroke stabilization",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -22,7 +22,7 @@
22
22
  "typecheck": "tsc --noEmit"
23
23
  },
24
24
  "dependencies": {
25
- "@stroke-stabilizer/core": "^0.2.12"
25
+ "@stroke-stabilizer/core": "^0.2.14"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "react": ">=17.0.0"