@shopify/react-native-skia 1.4.2 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. package/android/CMakeLists.txt +38 -6
  2. package/android/build.gradle +1 -0
  3. package/android/cpp/jni/include/JniSkiaBaseView.h +0 -3
  4. package/android/cpp/jni/include/JniSkiaDomView.h +0 -6
  5. package/android/cpp/jni/include/JniSkiaPictureView.h +0 -5
  6. package/android/cpp/rnskia-android/RNSkAndroidView.h +0 -20
  7. package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +0 -72
  8. package/cpp/rnskia/RNSkDomView.cpp +0 -79
  9. package/cpp/rnskia/RNSkDomView.h +1 -39
  10. package/cpp/rnskia/RNSkPictureView.h +0 -1
  11. package/cpp/rnskia/RNSkView.h +0 -17
  12. package/ios/RNSkia-iOS/SkiaUIView.mm +0 -51
  13. package/lib/commonjs/mock/index.js +0 -1
  14. package/lib/commonjs/mock/index.js.map +1 -1
  15. package/lib/commonjs/renderer/Canvas.d.ts +1 -2
  16. package/lib/commonjs/renderer/Canvas.js +0 -3
  17. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  18. package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
  19. package/lib/commonjs/views/SkiaBaseWebView.d.ts +2 -11
  20. package/lib/commonjs/views/SkiaBaseWebView.js +3 -31
  21. package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
  22. package/lib/commonjs/views/SkiaDomView.js +0 -12
  23. package/lib/commonjs/views/SkiaDomView.js.map +1 -1
  24. package/lib/commonjs/views/SkiaDomView.web.d.ts +2 -2
  25. package/lib/commonjs/views/SkiaDomView.web.js +1 -6
  26. package/lib/commonjs/views/SkiaDomView.web.js.map +1 -1
  27. package/lib/commonjs/views/SkiaJSDomView.js +0 -12
  28. package/lib/commonjs/views/SkiaJSDomView.js.map +1 -1
  29. package/lib/commonjs/views/index.d.ts +0 -1
  30. package/lib/commonjs/views/index.js +0 -11
  31. package/lib/commonjs/views/index.js.map +1 -1
  32. package/lib/commonjs/views/types.d.ts +0 -26
  33. package/lib/commonjs/views/types.js +0 -8
  34. package/lib/commonjs/views/types.js.map +1 -1
  35. package/lib/module/mock/index.js +0 -1
  36. package/lib/module/mock/index.js.map +1 -1
  37. package/lib/module/renderer/Canvas.d.ts +1 -2
  38. package/lib/module/renderer/Canvas.js +0 -3
  39. package/lib/module/renderer/Canvas.js.map +1 -1
  40. package/lib/module/skia/web/JsiSkia.js.map +1 -1
  41. package/lib/module/views/SkiaBaseWebView.d.ts +2 -11
  42. package/lib/module/views/SkiaBaseWebView.js +3 -31
  43. package/lib/module/views/SkiaBaseWebView.js.map +1 -1
  44. package/lib/module/views/SkiaDomView.js +0 -12
  45. package/lib/module/views/SkiaDomView.js.map +1 -1
  46. package/lib/module/views/SkiaDomView.web.d.ts +2 -2
  47. package/lib/module/views/SkiaDomView.web.js +1 -6
  48. package/lib/module/views/SkiaDomView.web.js.map +1 -1
  49. package/lib/module/views/SkiaJSDomView.js +0 -12
  50. package/lib/module/views/SkiaJSDomView.js.map +1 -1
  51. package/lib/module/views/index.d.ts +0 -1
  52. package/lib/module/views/index.js +0 -1
  53. package/lib/module/views/index.js.map +1 -1
  54. package/lib/module/views/types.d.ts +0 -26
  55. package/lib/module/views/types.js +1 -7
  56. package/lib/module/views/types.js.map +1 -1
  57. package/lib/typescript/lib/commonjs/mock/index.d.ts +0 -1
  58. package/lib/typescript/lib/commonjs/views/SkiaBaseWebView.d.ts +0 -3
  59. package/lib/typescript/lib/commonjs/views/SkiaDomView.web.d.ts +1 -1
  60. package/lib/typescript/lib/commonjs/views/types.d.ts +0 -1
  61. package/lib/typescript/lib/module/mock/index.d.ts +0 -1
  62. package/lib/typescript/lib/module/views/SkiaBaseWebView.d.ts +0 -3
  63. package/lib/typescript/lib/module/views/SkiaDomView.web.d.ts +1 -1
  64. package/lib/typescript/lib/module/views/index.d.ts +0 -1
  65. package/lib/typescript/lib/module/views/types.d.ts +1 -1
  66. package/lib/typescript/src/renderer/Canvas.d.ts +1 -2
  67. package/lib/typescript/src/views/SkiaBaseWebView.d.ts +2 -11
  68. package/lib/typescript/src/views/SkiaDomView.web.d.ts +2 -2
  69. package/lib/typescript/src/views/index.d.ts +0 -1
  70. package/lib/typescript/src/views/types.d.ts +0 -26
  71. package/package.json +1 -1
  72. package/src/mock/index.ts +0 -1
  73. package/src/renderer/Canvas.tsx +1 -5
  74. package/src/renderer/__tests__/setup.tsx +0 -2
  75. package/src/skia/web/JsiSkia.ts +1 -1
  76. package/src/views/SkiaBaseWebView.tsx +5 -42
  77. package/src/views/SkiaDomView.tsx +2 -14
  78. package/src/views/SkiaDomView.web.tsx +2 -9
  79. package/src/views/SkiaJSDomView.tsx +2 -14
  80. package/src/views/index.ts +0 -1
  81. package/src/views/types.ts +0 -32
  82. package/cpp/rnskia/RNSkInfoParameter.h +0 -92
  83. package/lib/commonjs/renderer/__tests__/TouchHandler.spec.d.ts +0 -1
  84. package/lib/commonjs/views/useTouchHandler.d.ts +0 -22
  85. package/lib/commonjs/views/useTouchHandler.js +0 -83
  86. package/lib/commonjs/views/useTouchHandler.js.map +0 -1
  87. package/lib/module/renderer/__tests__/TouchHandler.spec.d.ts +0 -1
  88. package/lib/module/views/useTouchHandler.d.ts +0 -22
  89. package/lib/module/views/useTouchHandler.js +0 -75
  90. package/lib/module/views/useTouchHandler.js.map +0 -1
  91. package/lib/typescript/lib/commonjs/views/useTouchHandler.d.ts +0 -12
  92. package/lib/typescript/lib/module/views/useTouchHandler.d.ts +0 -2
  93. package/lib/typescript/src/renderer/__tests__/TouchHandler.spec.d.ts +0 -1
  94. package/lib/typescript/src/views/useTouchHandler.d.ts +0 -22
  95. package/src/renderer/__tests__/TouchHandler.spec.tsx +0 -113
  96. package/src/views/useTouchHandler.ts +0 -107
@@ -1,83 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useTouchHandler = exports.useMultiTouchHandler = void 0;
7
- var _react = require("react");
8
- var _Platform = require("../Platform");
9
- var _types = require("./types");
10
- const useInternalTouchHandler = (handlers, deps = [], multiTouch = false) => {
11
- const prevTouchInfoRef = (0, _react.useRef)({});
12
- const prevVelocityRef = (0, _react.useRef)({});
13
- return (0, _react.useCallback)(history => {
14
- // Process all items in the current touch history
15
- history.forEach(touches => {
16
- // Enumerate touches
17
- for (let i = 0; i < touches.length; i++) {
18
- var _prevTouchInfoRef$cur, _prevTouchInfoRef$cur2, _prevTouch$x, _prevTouch$y, _prevVelocityRef$curr, _prevVelocityRef$curr2, _prevVelocityRef$curr3, _prevVelocityRef$curr4;
19
- if (!multiTouch && i > 0) {
20
- break;
21
- }
22
- const touch = touches[i];
23
- const prevTouch = prevTouchInfoRef.current[touch.id];
24
- // Calculate the velocity from the previous touch.
25
- const timeDiffseconds = touch.timestamp - ((_prevTouchInfoRef$cur = (_prevTouchInfoRef$cur2 = prevTouchInfoRef.current[touch.id]) === null || _prevTouchInfoRef$cur2 === void 0 ? void 0 : _prevTouchInfoRef$cur2.timestamp) !== null && _prevTouchInfoRef$cur !== void 0 ? _prevTouchInfoRef$cur : touch.timestamp);
26
- const distX = touch.x - ((_prevTouch$x = prevTouch === null || prevTouch === void 0 ? void 0 : prevTouch.x) !== null && _prevTouch$x !== void 0 ? _prevTouch$x : touch.x);
27
- const distY = touch.y - ((_prevTouch$y = prevTouch === null || prevTouch === void 0 ? void 0 : prevTouch.y) !== null && _prevTouch$y !== void 0 ? _prevTouch$y : touch.y);
28
- if (touch.type !== _types.TouchType.Start && touch.type !== _types.TouchType.End && touch.type !== _types.TouchType.Cancelled && timeDiffseconds > 0) {
29
- prevVelocityRef.current[touch.id] = {
30
- x: distX / timeDiffseconds / _Platform.Platform.PixelRatio,
31
- y: distY / timeDiffseconds / _Platform.Platform.PixelRatio
32
- };
33
- }
34
- const extendedTouchInfo = {
35
- ...touch,
36
- velocityX: (_prevVelocityRef$curr = (_prevVelocityRef$curr2 = prevVelocityRef.current[touch.id]) === null || _prevVelocityRef$curr2 === void 0 ? void 0 : _prevVelocityRef$curr2.x) !== null && _prevVelocityRef$curr !== void 0 ? _prevVelocityRef$curr : 0,
37
- velocityY: (_prevVelocityRef$curr3 = (_prevVelocityRef$curr4 = prevVelocityRef.current[touch.id]) === null || _prevVelocityRef$curr4 === void 0 ? void 0 : _prevVelocityRef$curr4.y) !== null && _prevVelocityRef$curr3 !== void 0 ? _prevVelocityRef$curr3 : 0
38
- };
39
-
40
- // Save previous touch
41
- prevTouchInfoRef.current[touch.id] = touch;
42
- if (touch.type === _types.TouchType.Start) {
43
- delete prevVelocityRef.current[touch.id];
44
- handlers.onStart && handlers.onStart(touch);
45
- } else if (touch.type === _types.TouchType.Active) {
46
- handlers.onActive && handlers.onActive(extendedTouchInfo);
47
- } else {
48
- handlers.onEnd && handlers.onEnd(extendedTouchInfo);
49
- }
50
- }
51
- });
52
- // eslint-disable-next-line react-hooks/exhaustive-deps
53
- }, deps);
54
- };
55
-
56
- /**
57
- * Provides a callback for handling touch events in the Skia View.
58
- * This touch handler only handles single touches.
59
- * @param handlers Callbacks for the different touch states
60
- * @param deps optional Dependency array to update the handlers
61
- * @returns A function that can be used from within the onDraw callback to
62
- * update and handle touch events. Call it with the touches property from
63
- * the info object.
64
- */
65
- const useTouchHandler = (handlers, deps = []) => {
66
- return useInternalTouchHandler(handlers, deps, false);
67
- };
68
-
69
- /**
70
- * Provides a callback for handling touch events in the Skia View.
71
- * This touch handler handles multiple touches.
72
- * @param handlers Callbacks for the different touch states
73
- * @param deps optional Dependency array to update the handlers
74
- * @returns A function that can be used from within the onDraw callback to
75
- * update and handle touch events. Call it with the touches property from
76
- * the info object.
77
- */
78
- exports.useTouchHandler = useTouchHandler;
79
- const useMultiTouchHandler = (handlers, deps = []) => {
80
- return useInternalTouchHandler(handlers, deps, true);
81
- };
82
- exports.useMultiTouchHandler = useMultiTouchHandler;
83
- //# sourceMappingURL=useTouchHandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","require","_Platform","_types","useInternalTouchHandler","handlers","deps","multiTouch","prevTouchInfoRef","useRef","prevVelocityRef","useCallback","history","forEach","touches","i","length","_prevTouchInfoRef$cur","_prevTouchInfoRef$cur2","_prevTouch$x","_prevTouch$y","_prevVelocityRef$curr","_prevVelocityRef$curr2","_prevVelocityRef$curr3","_prevVelocityRef$curr4","touch","prevTouch","current","id","timeDiffseconds","timestamp","distX","x","distY","y","type","TouchType","Start","End","Cancelled","Platform","PixelRatio","extendedTouchInfo","velocityX","velocityY","onStart","Active","onActive","onEnd","useTouchHandler","exports","useMultiTouchHandler"],"sources":["useTouchHandler.ts"],"sourcesContent":["import type { DependencyList } from \"react\";\nimport { useCallback, useRef } from \"react\";\n\nimport type { Vector } from \"../skia/types\";\nimport { Platform } from \"../Platform\";\n\nimport type {\n ExtendedTouchInfo,\n TouchHandlers,\n TouchHandler,\n TouchInfo,\n} from \"./types\";\nimport { TouchType } from \"./types\";\n\nconst useInternalTouchHandler = (\n handlers: TouchHandlers,\n deps: DependencyList = [],\n multiTouch = false\n): TouchHandler => {\n const prevTouchInfoRef = useRef<{ [key: number]: TouchInfo | undefined }>({});\n const prevVelocityRef = useRef<{ [key: number]: Vector | undefined }>({});\n\n return useCallback((history: Array<Array<TouchInfo>>) => {\n // Process all items in the current touch history\n history.forEach((touches) => {\n // Enumerate touches\n for (let i = 0; i < touches.length; i++) {\n if (!multiTouch && i > 0) {\n break;\n }\n\n const touch = touches[i];\n const prevTouch = prevTouchInfoRef.current[touch.id];\n // Calculate the velocity from the previous touch.\n const timeDiffseconds =\n touch.timestamp -\n (prevTouchInfoRef.current[touch.id]?.timestamp ?? touch.timestamp);\n\n const distX = touch.x - (prevTouch?.x ?? touch.x);\n const distY = touch.y - (prevTouch?.y ?? touch.y);\n\n if (\n touch.type !== TouchType.Start &&\n touch.type !== TouchType.End &&\n touch.type !== TouchType.Cancelled &&\n timeDiffseconds > 0\n ) {\n prevVelocityRef.current[touch.id] = {\n x: distX / timeDiffseconds / Platform.PixelRatio,\n y: distY / timeDiffseconds / Platform.PixelRatio,\n };\n }\n\n const extendedTouchInfo: ExtendedTouchInfo = {\n ...touch,\n velocityX: prevVelocityRef.current[touch.id]?.x ?? 0,\n velocityY: prevVelocityRef.current[touch.id]?.y ?? 0,\n };\n\n // Save previous touch\n prevTouchInfoRef.current[touch.id] = touch;\n\n if (touch.type === TouchType.Start) {\n delete prevVelocityRef.current[touch.id];\n handlers.onStart && handlers.onStart(touch);\n } else if (touch.type === TouchType.Active) {\n handlers.onActive && handlers.onActive(extendedTouchInfo);\n } else {\n handlers.onEnd && handlers.onEnd(extendedTouchInfo);\n }\n }\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n};\n\n/**\n * Provides a callback for handling touch events in the Skia View.\n * This touch handler only handles single touches.\n * @param handlers Callbacks for the different touch states\n * @param deps optional Dependency array to update the handlers\n * @returns A function that can be used from within the onDraw callback to\n * update and handle touch events. Call it with the touches property from\n * the info object.\n */\nexport const useTouchHandler = (\n handlers: TouchHandlers,\n deps: DependencyList = []\n): TouchHandler => {\n return useInternalTouchHandler(handlers, deps, false);\n};\n\n/**\n * Provides a callback for handling touch events in the Skia View.\n * This touch handler handles multiple touches.\n * @param handlers Callbacks for the different touch states\n * @param deps optional Dependency array to update the handlers\n * @returns A function that can be used from within the onDraw callback to\n * update and handle touch events. Call it with the touches property from\n * the info object.\n */\nexport const useMultiTouchHandler = (\n handlers: TouchHandlers,\n deps: DependencyList = []\n): TouchHandler => {\n return useInternalTouchHandler(handlers, deps, true);\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,SAAA,GAAAD,OAAA;AAQA,IAAAE,MAAA,GAAAF,OAAA;AAEA,MAAMG,uBAAuB,GAAGA,CAC9BC,QAAuB,EACvBC,IAAoB,GAAG,EAAE,EACzBC,UAAU,GAAG,KAAK,KACD;EACjB,MAAMC,gBAAgB,GAAG,IAAAC,aAAM,EAA2C,CAAC,CAAC,CAAC;EAC7E,MAA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Q,CAAC2C,KAAK,IAAI3C,QAAQ,CAAC2C,KAAK,CAACN,iBAAiB,CAAC;QACrD;MACF;IACF,CAAC,CAAC;IACF;EACF,CAAC,EAAEpC,IAAI,CAAC;AACV,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM2C,eAAe,GAAGA,CAC7B5C,QAAuB,EACvBC,IAAoB,GAAG,EAAE,KACR;EACjB,OAAOF,uBAAuB,CAACC,QAAQ,EAAEC,IAAI,EAAE,KAAK,CAAC;AACvD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARA4C,OAAA,CAAAD,eAAA,GAAAA,eAAA;AASO,MAAME,oBAAoB,GAAGA,CAClC9C,QAAuB,EACvBC,IAAoB,GAAG,EAAE,KACR;EACjB,OAAOF,uBAAuB,CAACC,QAAQ,EAAEC,IAAI,EAAE,IAAI,CAAC;AACtD,CAAC;AAAC4C,OAAA,CAAAC,oBAAA,GAAAA,oBAAA","ignoreList":[]}
@@ -1 +0,0 @@
1
- export {};
@@ -1,22 +0,0 @@
1
- import type { DependencyList } from "react";
2
- import type { TouchHandlers, TouchHandler } from "./types";
3
- /**
4
- * Provides a callback for handling touch events in the Skia View.
5
- * This touch handler only handles single touches.
6
- * @param handlers Callbacks for the different touch states
7
- * @param deps optional Dependency array to update the handlers
8
- * @returns A function that can be used from within the onDraw callback to
9
- * update and handle touch events. Call it with the touches property from
10
- * the info object.
11
- */
12
- export declare const useTouchHandler: (handlers: TouchHandlers, deps?: DependencyList) => TouchHandler;
13
- /**
14
- * Provides a callback for handling touch events in the Skia View.
15
- * This touch handler handles multiple touches.
16
- * @param handlers Callbacks for the different touch states
17
- * @param deps optional Dependency array to update the handlers
18
- * @returns A function that can be used from within the onDraw callback to
19
- * update and handle touch events. Call it with the touches property from
20
- * the info object.
21
- */
22
- export declare const useMultiTouchHandler: (handlers: TouchHandlers, deps?: DependencyList) => TouchHandler;
@@ -1,75 +0,0 @@
1
- import { useCallback, useRef } from "react";
2
- import { Platform } from "../Platform";
3
- import { TouchType } from "./types";
4
- const useInternalTouchHandler = (handlers, deps = [], multiTouch = false) => {
5
- const prevTouchInfoRef = useRef({});
6
- const prevVelocityRef = useRef({});
7
- return useCallback(history => {
8
- // Process all items in the current touch history
9
- history.forEach(touches => {
10
- // Enumerate touches
11
- for (let i = 0; i < touches.length; i++) {
12
- var _prevTouchInfoRef$cur, _prevTouchInfoRef$cur2, _prevTouch$x, _prevTouch$y, _prevVelocityRef$curr, _prevVelocityRef$curr2, _prevVelocityRef$curr3, _prevVelocityRef$curr4;
13
- if (!multiTouch && i > 0) {
14
- break;
15
- }
16
- const touch = touches[i];
17
- const prevTouch = prevTouchInfoRef.current[touch.id];
18
- // Calculate the velocity from the previous touch.
19
- const timeDiffseconds = touch.timestamp - ((_prevTouchInfoRef$cur = (_prevTouchInfoRef$cur2 = prevTouchInfoRef.current[touch.id]) === null || _prevTouchInfoRef$cur2 === void 0 ? void 0 : _prevTouchInfoRef$cur2.timestamp) !== null && _prevTouchInfoRef$cur !== void 0 ? _prevTouchInfoRef$cur : touch.timestamp);
20
- const distX = touch.x - ((_prevTouch$x = prevTouch === null || prevTouch === void 0 ? void 0 : prevTouch.x) !== null && _prevTouch$x !== void 0 ? _prevTouch$x : touch.x);
21
- const distY = touch.y - ((_prevTouch$y = prevTouch === null || prevTouch === void 0 ? void 0 : prevTouch.y) !== null && _prevTouch$y !== void 0 ? _prevTouch$y : touch.y);
22
- if (touch.type !== TouchType.Start && touch.type !== TouchType.End && touch.type !== TouchType.Cancelled && timeDiffseconds > 0) {
23
- prevVelocityRef.current[touch.id] = {
24
- x: distX / timeDiffseconds / Platform.PixelRatio,
25
- y: distY / timeDiffseconds / Platform.PixelRatio
26
- };
27
- }
28
- const extendedTouchInfo = {
29
- ...touch,
30
- velocityX: (_prevVelocityRef$curr = (_prevVelocityRef$curr2 = prevVelocityRef.current[touch.id]) === null || _prevVelocityRef$curr2 === void 0 ? void 0 : _prevVelocityRef$curr2.x) !== null && _prevVelocityRef$curr !== void 0 ? _prevVelocityRef$curr : 0,
31
- velocityY: (_prevVelocityRef$curr3 = (_prevVelocityRef$curr4 = prevVelocityRef.current[touch.id]) === null || _prevVelocityRef$curr4 === void 0 ? void 0 : _prevVelocityRef$curr4.y) !== null && _prevVelocityRef$curr3 !== void 0 ? _prevVelocityRef$curr3 : 0
32
- };
33
-
34
- // Save previous touch
35
- prevTouchInfoRef.current[touch.id] = touch;
36
- if (touch.type === TouchType.Start) {
37
- delete prevVelocityRef.current[touch.id];
38
- handlers.onStart && handlers.onStart(touch);
39
- } else if (touch.type === TouchType.Active) {
40
- handlers.onActive && handlers.onActive(extendedTouchInfo);
41
- } else {
42
- handlers.onEnd && handlers.onEnd(extendedTouchInfo);
43
- }
44
- }
45
- });
46
- // eslint-disable-next-line react-hooks/exhaustive-deps
47
- }, deps);
48
- };
49
-
50
- /**
51
- * Provides a callback for handling touch events in the Skia View.
52
- * This touch handler only handles single touches.
53
- * @param handlers Callbacks for the different touch states
54
- * @param deps optional Dependency array to update the handlers
55
- * @returns A function that can be used from within the onDraw callback to
56
- * update and handle touch events. Call it with the touches property from
57
- * the info object.
58
- */
59
- export const useTouchHandler = (handlers, deps = []) => {
60
- return useInternalTouchHandler(handlers, deps, false);
61
- };
62
-
63
- /**
64
- * Provides a callback for handling touch events in the Skia View.
65
- * This touch handler handles multiple touches.
66
- * @param handlers Callbacks for the different touch states
67
- * @param deps optional Dependency array to update the handlers
68
- * @returns A function that can be used from within the onDraw callback to
69
- * update and handle touch events. Call it with the touches property from
70
- * the info object.
71
- */
72
- export const useMultiTouchHandler = (handlers, deps = []) => {
73
- return useInternalTouchHandler(handlers, deps, true);
74
- };
75
- //# sourceMappingURL=useTouchHandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useCallback","useRef","Platform","TouchType","useInternalTouchHandler","handlers","deps","multiTouch","prevTouchInfoRef","prevVelocityRef","history","forEach","touches","i","length","_prevTouchInfoRef$cur","_prevTouchInfoRef$cur2","_prevTouch$x","_prevTouch$y","_prevVelocityRef$curr","_prevVelocityRef$curr2","_prevVelocityRef$curr3","_prevVelocityRef$curr4","touch","prevTouch","current","id","timeDiffseconds","timestamp","distX","x","distY","y","type","Start","End","Cancelled","PixelRatio","extendedTouchInfo","velocityX","velocityY","onStart","Active","onActive","onEnd","useTouchHandler","useMultiTouchHandler"],"sources":["useTouchHandler.ts"],"sourcesContent":["import type { DependencyList } from \"react\";\nimport { useCallback, useRef } from \"react\";\n\nimport type { Vector } from \"../skia/types\";\nimport { Platform } from \"../Platform\";\n\nimport type {\n ExtendedTouchInfo,\n TouchHandlers,\n TouchHandler,\n TouchInfo,\n} from \"./types\";\nimport { TouchType } from \"./types\";\n\nconst useInternalTouchHandler = (\n handlers: TouchHandlers,\n deps: DependencyList = [],\n multiTouch = false\n): TouchHandler => {\n const prevTouchInfoRef = useRef<{ [key: number]: TouchInfo | undefined }>({});\n const prevVelocityRef = useRef<{ [key: number]: Vector | undefined }>({});\n\n return useCallback((history: Array<Array<TouchInfo>>) => {\n // Process all items in the current touch history\n history.forEach((touches) => {\n // Enumerate touches\n for (let i = 0; i < touches.length; i++) {\n if (!multiTouch && i > 0) {\n break;\n }\n\n const touch = touches[i];\n const prevTouch = prevTouchInfoRef.current[touch.id];\n // Calculate the velocity from the previous touch.\n const timeDiffseconds =\n touch.timestamp -\n (prevTouchInfoRef.current[touch.id]?.timestamp ?? touch.timestamp);\n\n const distX = touch.x - (prevTouch?.x ?? touch.x);\n const distY = touch.y - (prevTouch?.y ?? touch.y);\n\n if (\n touch.type !== TouchType.Start &&\n touch.type !== TouchType.End &&\n touch.type !== TouchType.Cancelled &&\n timeDiffseconds > 0\n ) {\n prevVelocityRef.current[touch.id] = {\n x: distX / timeDiffseconds / Platform.PixelRatio,\n y: distY / timeDiffseconds / Platform.PixelRatio,\n };\n }\n\n const extendedTouchInfo: ExtendedTouchInfo = {\n ...touch,\n velocityX: prevVelocityRef.current[touch.id]?.x ?? 0,\n velocityY: prevVelocityRef.current[touch.id]?.y ?? 0,\n };\n\n // Save previous touch\n prevTouchInfoRef.current[touch.id] = touch;\n\n if (touch.type === TouchType.Start) {\n delete prevVelocityRef.current[touch.id];\n handlers.onStart && handlers.onStart(touch);\n } else if (touch.type === TouchType.Active) {\n handlers.onActive && handlers.onActive(extendedTouchInfo);\n } else {\n handlers.onEnd && handlers.onEnd(extendedTouchInfo);\n }\n }\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n};\n\n/**\n * Provides a callback for handling touch events in the Skia View.\n * This touch handler only handles single touches.\n * @param handlers Callbacks for the different touch states\n * @param deps optional Dependency array to update the handlers\n * @returns A function that can be used from within the onDraw callback to\n * update and handle touch events. Call it with the touches property from\n * the info object.\n */\nexport const useTouchHandler = (\n handlers: TouchHandlers,\n deps: DependencyList = []\n): TouchHandler => {\n return useInternalTouchHandler(handlers, deps, false);\n};\n\n/**\n * Provides a callback for handling touch events in the Skia View.\n * This touch handler handles multiple touches.\n * @param handlers Callbacks for the different touch states\n * @param deps optional Dependency array to update the handlers\n * @returns A function that can be used from within the onDraw callback to\n * update and handle touch events. Call it with the touches property from\n * the info object.\n */\nexport const useMultiTouchHandler = (\n handlers: TouchHandlers,\n deps: DependencyList = []\n): TouchHandler => {\n return useInternalTouchHandler(handlers, deps, true);\n};\n"],"mappings":"AACA,SAASA,WAAW,EAAEC,MAAM,QAAQ,OAAO;AAG3C,SAASC,QAAQ,QAAQ,aAAa;AAQtC,SAASC,SAAS,QAAQ,SAAS;AAEnC,MAAMC,uBAAuB,GAAGA,CAC9BC,QAAuB,EACvBC,IAAoB,GAAG,EAAE,EACzBC,UAAU,GAAG,KAAK,KACD;EACjB,MAAMC,gBAAgB,GAAGP,MAAM,CAA2C,CAAC,CAAC,CAAC;EAC7E,MAAMQ,eAAe,GAAGR,MAAM,CAAwC,CAAC,CAAC,CAAC;EAEzE,OAAOD,WAAW,CAAEU,OAAgC,IAAK;IACvD;IACA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AAEhC,IAAI,CAAC;AACV,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMuC,eAAe,GAAGA,CAC7BxC,QAAuB,EACvBC,IAAoB,GAAG,EAAE,KACR;EACjB,OAAOF,uBAAuB,CAACC,QAAQ,EAAEC,IAAI,EAAE,KAAK,CAAC;AACvD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMwC,oBAAoB,GAAGA,CAClCzC,QAAuB,EACvBC,IAAoB,GAAG,EAAE,KACR;EACjB,OAAOF,uBAAuB,CAACC,QAAQ,EAAEC,IAAI,EAAE,IAAI,CAAC;AACtD,CAAC","ignoreList":[]}
@@ -1,12 +0,0 @@
1
- export const __esModule: boolean;
2
- /**
3
- * Provides a callback for handling touch events in the Skia View.
4
- * This touch handler only handles single touches.
5
- * @param handlers Callbacks for the different touch states
6
- * @param deps optional Dependency array to update the handlers
7
- * @returns A function that can be used from within the onDraw callback to
8
- * update and handle touch events. Call it with the touches property from
9
- * the info object.
10
- */
11
- export function useTouchHandler(handlers: any, deps?: any[]): (history: any) => void;
12
- export function useMultiTouchHandler(handlers: any, deps?: any[]): (history: any) => void;
@@ -1,2 +0,0 @@
1
- export function useTouchHandler(handlers: any, deps?: any[]): (history: any) => void;
2
- export function useMultiTouchHandler(handlers: any, deps?: any[]): (history: any) => void;
@@ -1,22 +0,0 @@
1
- import type { DependencyList } from "react";
2
- import type { TouchHandlers, TouchHandler } from "./types";
3
- /**
4
- * Provides a callback for handling touch events in the Skia View.
5
- * This touch handler only handles single touches.
6
- * @param handlers Callbacks for the different touch states
7
- * @param deps optional Dependency array to update the handlers
8
- * @returns A function that can be used from within the onDraw callback to
9
- * update and handle touch events. Call it with the touches property from
10
- * the info object.
11
- */
12
- export declare const useTouchHandler: (handlers: TouchHandlers, deps?: DependencyList) => TouchHandler;
13
- /**
14
- * Provides a callback for handling touch events in the Skia View.
15
- * This touch handler handles multiple touches.
16
- * @param handlers Callbacks for the different touch states
17
- * @param deps optional Dependency array to update the handlers
18
- * @returns A function that can be used from within the onDraw callback to
19
- * update and handle touch events. Call it with the touches property from
20
- * the info object.
21
- */
22
- export declare const useMultiTouchHandler: (handlers: TouchHandlers, deps?: DependencyList) => TouchHandler;
@@ -1,113 +0,0 @@
1
- import React from "react";
2
-
3
- import { TouchType } from "../../views/types";
4
-
5
- import type { EmptyProps } from "./setup";
6
- import { mountCanvas, importSkia } from "./setup";
7
-
8
- const SimpleActiveTouch = ({}: EmptyProps) => {
9
- const { useTouchHandler } = importSkia();
10
- const touchHandler = useTouchHandler({
11
- onStart: ({ x, y }) => {
12
- expect(x).toBe(10);
13
- expect(y).toBe(10);
14
- },
15
- onActive: ({ x, y, velocityX, velocityY }) => {
16
- expect(x).toBe(20);
17
- expect(y).toBe(20);
18
- expect(velocityX).toBe(10);
19
- expect(velocityY).toBe(10);
20
- },
21
- });
22
- const history = [
23
- [
24
- {
25
- x: 10,
26
- y: 10,
27
- force: 0,
28
- type: TouchType.Start,
29
- id: 2,
30
- timestamp: 0,
31
- },
32
- ],
33
- [
34
- {
35
- x: 20,
36
- y: 20,
37
- force: 0,
38
- type: TouchType.Active,
39
- id: 2,
40
- timestamp: 1,
41
- },
42
- ],
43
- ];
44
- touchHandler(history);
45
- return null;
46
- };
47
-
48
- const SimpleEndTouch = ({}: EmptyProps) => {
49
- const { useTouchHandler } = importSkia();
50
- const touchHandler = useTouchHandler({
51
- onStart: ({ x, y }) => {
52
- expect(x).toBe(10);
53
- expect(y).toBe(10);
54
- },
55
- onActive: ({ x, y, velocityX, velocityY }) => {
56
- expect(x).toBe(20);
57
- expect(y).toBe(20);
58
- expect(velocityX).toBe(10);
59
- expect(velocityY).toBe(10);
60
- },
61
- onEnd: ({ x, y, velocityX, velocityY }) => {
62
- expect(x).toBe(30);
63
- expect(y).toBe(30);
64
- expect(velocityX).toBe(10);
65
- expect(velocityY).toBe(10);
66
- },
67
- });
68
- const history = [
69
- [
70
- {
71
- x: 10,
72
- y: 10,
73
- force: 0,
74
- type: TouchType.Start,
75
- id: 2,
76
- timestamp: 0,
77
- },
78
- ],
79
- [
80
- {
81
- x: 20,
82
- y: 20,
83
- force: 0,
84
- type: TouchType.Active,
85
- id: 2,
86
- timestamp: 1,
87
- },
88
- ],
89
- [
90
- {
91
- x: 30,
92
- y: 30,
93
- force: 0,
94
- type: TouchType.End,
95
- id: 2,
96
- timestamp: 2,
97
- },
98
- ],
99
- ];
100
- touchHandler(history);
101
- return null;
102
- };
103
-
104
- describe("Test handling of touch information", () => {
105
- it("Should check that the received values are correct", () => {
106
- const { draw } = mountCanvas(<SimpleActiveTouch />);
107
- draw();
108
- });
109
- it("Calculates the velocity properly onEnd event", () => {
110
- const { draw } = mountCanvas(<SimpleEndTouch />);
111
- draw();
112
- });
113
- });
@@ -1,107 +0,0 @@
1
- import type { DependencyList } from "react";
2
- import { useCallback, useRef } from "react";
3
-
4
- import type { Vector } from "../skia/types";
5
- import { Platform } from "../Platform";
6
-
7
- import type {
8
- ExtendedTouchInfo,
9
- TouchHandlers,
10
- TouchHandler,
11
- TouchInfo,
12
- } from "./types";
13
- import { TouchType } from "./types";
14
-
15
- const useInternalTouchHandler = (
16
- handlers: TouchHandlers,
17
- deps: DependencyList = [],
18
- multiTouch = false
19
- ): TouchHandler => {
20
- const prevTouchInfoRef = useRef<{ [key: number]: TouchInfo | undefined }>({});
21
- const prevVelocityRef = useRef<{ [key: number]: Vector | undefined }>({});
22
-
23
- return useCallback((history: Array<Array<TouchInfo>>) => {
24
- // Process all items in the current touch history
25
- history.forEach((touches) => {
26
- // Enumerate touches
27
- for (let i = 0; i < touches.length; i++) {
28
- if (!multiTouch && i > 0) {
29
- break;
30
- }
31
-
32
- const touch = touches[i];
33
- const prevTouch = prevTouchInfoRef.current[touch.id];
34
- // Calculate the velocity from the previous touch.
35
- const timeDiffseconds =
36
- touch.timestamp -
37
- (prevTouchInfoRef.current[touch.id]?.timestamp ?? touch.timestamp);
38
-
39
- const distX = touch.x - (prevTouch?.x ?? touch.x);
40
- const distY = touch.y - (prevTouch?.y ?? touch.y);
41
-
42
- if (
43
- touch.type !== TouchType.Start &&
44
- touch.type !== TouchType.End &&
45
- touch.type !== TouchType.Cancelled &&
46
- timeDiffseconds > 0
47
- ) {
48
- prevVelocityRef.current[touch.id] = {
49
- x: distX / timeDiffseconds / Platform.PixelRatio,
50
- y: distY / timeDiffseconds / Platform.PixelRatio,
51
- };
52
- }
53
-
54
- const extendedTouchInfo: ExtendedTouchInfo = {
55
- ...touch,
56
- velocityX: prevVelocityRef.current[touch.id]?.x ?? 0,
57
- velocityY: prevVelocityRef.current[touch.id]?.y ?? 0,
58
- };
59
-
60
- // Save previous touch
61
- prevTouchInfoRef.current[touch.id] = touch;
62
-
63
- if (touch.type === TouchType.Start) {
64
- delete prevVelocityRef.current[touch.id];
65
- handlers.onStart && handlers.onStart(touch);
66
- } else if (touch.type === TouchType.Active) {
67
- handlers.onActive && handlers.onActive(extendedTouchInfo);
68
- } else {
69
- handlers.onEnd && handlers.onEnd(extendedTouchInfo);
70
- }
71
- }
72
- });
73
- // eslint-disable-next-line react-hooks/exhaustive-deps
74
- }, deps);
75
- };
76
-
77
- /**
78
- * Provides a callback for handling touch events in the Skia View.
79
- * This touch handler only handles single touches.
80
- * @param handlers Callbacks for the different touch states
81
- * @param deps optional Dependency array to update the handlers
82
- * @returns A function that can be used from within the onDraw callback to
83
- * update and handle touch events. Call it with the touches property from
84
- * the info object.
85
- */
86
- export const useTouchHandler = (
87
- handlers: TouchHandlers,
88
- deps: DependencyList = []
89
- ): TouchHandler => {
90
- return useInternalTouchHandler(handlers, deps, false);
91
- };
92
-
93
- /**
94
- * Provides a callback for handling touch events in the Skia View.
95
- * This touch handler handles multiple touches.
96
- * @param handlers Callbacks for the different touch states
97
- * @param deps optional Dependency array to update the handlers
98
- * @returns A function that can be used from within the onDraw callback to
99
- * update and handle touch events. Call it with the touches property from
100
- * the info object.
101
- */
102
- export const useMultiTouchHandler = (
103
- handlers: TouchHandlers,
104
- deps: DependencyList = []
105
- ): TouchHandler => {
106
- return useInternalTouchHandler(handlers, deps, true);
107
- };