@shopify/react-native-skia 1.4.2 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- package/android/CMakeLists.txt +38 -6
- package/android/build.gradle +1 -0
- package/android/cpp/jni/include/JniSkiaBaseView.h +0 -4
- package/android/cpp/jni/include/JniSkiaDomView.h +0 -6
- package/android/cpp/jni/include/JniSkiaPictureView.h +0 -6
- package/android/cpp/rnskia-android/RNSkAndroidView.h +0 -20
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +0 -72
- package/cpp/rnskia/RNSkDomView.cpp +0 -79
- package/cpp/rnskia/RNSkDomView.h +1 -39
- package/cpp/rnskia/RNSkPictureView.h +0 -1
- package/cpp/rnskia/RNSkView.h +0 -17
- package/ios/RNSkia-iOS/DisplayLink.mm +7 -0
- package/ios/RNSkia-iOS/SkiaUIView.mm +0 -51
- package/lib/commonjs/mock/index.js +0 -1
- package/lib/commonjs/mock/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.d.ts +1 -2
- package/lib/commonjs/renderer/Canvas.js +0 -3
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/commonjs/views/SkiaBaseWebView.d.ts +2 -11
- package/lib/commonjs/views/SkiaBaseWebView.js +3 -31
- package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
- package/lib/commonjs/views/SkiaDomView.js +0 -12
- package/lib/commonjs/views/SkiaDomView.js.map +1 -1
- package/lib/commonjs/views/SkiaDomView.web.d.ts +2 -2
- package/lib/commonjs/views/SkiaDomView.web.js +1 -6
- package/lib/commonjs/views/SkiaDomView.web.js.map +1 -1
- package/lib/commonjs/views/SkiaJSDomView.js +0 -12
- package/lib/commonjs/views/SkiaJSDomView.js.map +1 -1
- package/lib/commonjs/views/index.d.ts +0 -1
- package/lib/commonjs/views/index.js +0 -11
- package/lib/commonjs/views/index.js.map +1 -1
- package/lib/commonjs/views/types.d.ts +0 -26
- package/lib/commonjs/views/types.js +0 -8
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/commonjs/web/WithSkiaWeb.js +4 -1
- package/lib/commonjs/web/WithSkiaWeb.js.map +1 -1
- package/lib/module/mock/index.js +0 -1
- package/lib/module/mock/index.js.map +1 -1
- package/lib/module/renderer/Canvas.d.ts +1 -2
- package/lib/module/renderer/Canvas.js +0 -3
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/views/SkiaBaseWebView.d.ts +2 -11
- package/lib/module/views/SkiaBaseWebView.js +3 -31
- package/lib/module/views/SkiaBaseWebView.js.map +1 -1
- package/lib/module/views/SkiaDomView.js +0 -12
- package/lib/module/views/SkiaDomView.js.map +1 -1
- package/lib/module/views/SkiaDomView.web.d.ts +2 -2
- package/lib/module/views/SkiaDomView.web.js +1 -6
- package/lib/module/views/SkiaDomView.web.js.map +1 -1
- package/lib/module/views/SkiaJSDomView.js +0 -12
- package/lib/module/views/SkiaJSDomView.js.map +1 -1
- package/lib/module/views/index.d.ts +0 -1
- package/lib/module/views/index.js +0 -1
- package/lib/module/views/index.js.map +1 -1
- package/lib/module/views/types.d.ts +0 -26
- package/lib/module/views/types.js +1 -7
- package/lib/module/views/types.js.map +1 -1
- package/lib/module/web/WithSkiaWeb.js +4 -1
- package/lib/module/web/WithSkiaWeb.js.map +1 -1
- package/lib/typescript/lib/commonjs/mock/index.d.ts +0 -1
- package/lib/typescript/lib/commonjs/views/SkiaBaseWebView.d.ts +0 -3
- package/lib/typescript/lib/commonjs/views/SkiaDomView.web.d.ts +1 -1
- package/lib/typescript/lib/commonjs/views/types.d.ts +0 -1
- package/lib/typescript/lib/module/mock/index.d.ts +0 -1
- package/lib/typescript/lib/module/views/SkiaBaseWebView.d.ts +0 -3
- package/lib/typescript/lib/module/views/SkiaDomView.web.d.ts +1 -1
- package/lib/typescript/lib/module/views/index.d.ts +0 -1
- package/lib/typescript/lib/module/views/types.d.ts +1 -1
- package/lib/typescript/src/renderer/Canvas.d.ts +1 -2
- package/lib/typescript/src/views/SkiaBaseWebView.d.ts +2 -11
- package/lib/typescript/src/views/SkiaDomView.web.d.ts +2 -2
- package/lib/typescript/src/views/index.d.ts +0 -1
- package/lib/typescript/src/views/types.d.ts +0 -26
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskottie.xcframework/Info.plist +5 -5
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/ios/libskparagraph.xcframework/Info.plist +5 -5
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/ios/libskshaper.xcframework/Info.plist +5 -5
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libskunicode_core.xcframework/ios-arm64_arm64e/libskunicode_core.a +0 -0
- package/libs/ios/libskunicode_core.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
- package/libs/ios/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
- package/libs/ios/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
- package/libs/ios/libsvg.xcframework/Info.plist +5 -5
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +3 -6
- package/src/mock/index.ts +0 -1
- package/src/renderer/Canvas.tsx +1 -5
- package/src/renderer/__tests__/setup.tsx +0 -2
- package/src/skia/web/JsiSkia.ts +1 -1
- package/src/views/SkiaBaseWebView.tsx +5 -42
- package/src/views/SkiaDomView.tsx +2 -14
- package/src/views/SkiaDomView.web.tsx +2 -9
- package/src/views/SkiaJSDomView.tsx +2 -14
- package/src/views/index.ts +0 -1
- package/src/views/types.ts +0 -32
- package/src/web/WithSkiaWeb.tsx +3 -1
- package/cpp/rnskia/RNSkInfoParameter.h +0 -92
- package/lib/commonjs/renderer/__tests__/TouchHandler.spec.d.ts +0 -1
- package/lib/commonjs/views/useTouchHandler.d.ts +0 -22
- package/lib/commonjs/views/useTouchHandler.js +0 -83
- package/lib/commonjs/views/useTouchHandler.js.map +0 -1
- package/lib/module/renderer/__tests__/TouchHandler.spec.d.ts +0 -1
- package/lib/module/views/useTouchHandler.d.ts +0 -22
- package/lib/module/views/useTouchHandler.js +0 -75
- package/lib/module/views/useTouchHandler.js.map +0 -1
- package/lib/typescript/lib/commonjs/views/useTouchHandler.d.ts +0 -12
- package/lib/typescript/lib/module/views/useTouchHandler.d.ts +0 -2
- package/lib/typescript/src/renderer/__tests__/TouchHandler.spec.d.ts +0 -1
- package/lib/typescript/src/views/useTouchHandler.d.ts +0 -22
- package/src/renderer/__tests__/TouchHandler.spec.tsx +0 -113
- package/src/views/useTouchHandler.ts +0 -107
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_views","_Skia","_SkiaJSDomView","_Reconciler","_HostComponents","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","useCanvasRef","useRef","exports","useOnSizeEvent","resultValue","onLayout","useCallback","event","width","height","nativeEvent","layout","value","Canvas","forwardRef","children","style","debug","mode","
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_views","_Skia","_SkiaJSDomView","_Reconciler","_HostComponents","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","useCanvasRef","useRef","exports","useOnSizeEvent","resultValue","onLayout","useCallback","event","width","height","nativeEvent","layout","value","Canvas","forwardRef","children","style","debug","mode","onSize","_onSize","_onLayout","props","forwardedRef","innerRef","ref","useCombinedRefs","redraw","_innerRef$current","current","getNativeId","_innerRef$current$nat","_innerRef$current2","id","nativeId","root","useMemo","SkiaRoot","Skia","NATIVE_DOM","useEffect","render","unmount","createElement","SkiaDomView","dom","SkiaJSDomView","refs","targetRef","React","forEach"],"sources":["Canvas.tsx"],"sourcesContent":["import React, {\n useEffect,\n useCallback,\n useMemo,\n forwardRef,\n useRef,\n} from \"react\";\nimport type {\n RefObject,\n ReactNode,\n MutableRefObject,\n ForwardedRef,\n FunctionComponent,\n} from \"react\";\nimport type { LayoutChangeEvent } from \"react-native\";\n\nimport { SkiaDomView } from \"../views\";\nimport { Skia } from \"../skia/Skia\";\nimport type { SkiaBaseViewProps } from \"../views\";\nimport { SkiaJSDomView } from \"../views/SkiaJSDomView\";\n\nimport { SkiaRoot } from \"./Reconciler\";\nimport { NATIVE_DOM } from \"./HostComponents\";\n\nexport const useCanvasRef = () => useRef<SkiaDomView>(null);\n\nexport interface CanvasProps extends SkiaBaseViewProps {\n ref?: RefObject<SkiaDomView>;\n children: ReactNode;\n}\n\nconst useOnSizeEvent = (\n resultValue: SkiaBaseViewProps[\"onSize\"],\n onLayout?: (event: LayoutChangeEvent) => void\n) => {\n return useCallback(\n (event: LayoutChangeEvent) => {\n if (onLayout) {\n onLayout(event);\n }\n const { width, height } = event.nativeEvent.layout;\n\n if (resultValue) {\n resultValue.value = { width, height };\n }\n },\n [onLayout, resultValue]\n );\n};\n\nexport const Canvas = forwardRef<SkiaDomView, CanvasProps>(\n (\n {\n children,\n style,\n debug,\n mode,\n onSize: _onSize,\n onLayout: _onLayout,\n ...props\n },\n forwardedRef\n ) => {\n const onLayout = useOnSizeEvent(_onSize, _onLayout);\n const innerRef = useCanvasRef();\n const ref = useCombinedRefs(forwardedRef, innerRef);\n const redraw = useCallback(() => {\n innerRef.current?.redraw();\n }, [innerRef]);\n const getNativeId = useCallback(() => {\n const id = innerRef.current?.nativeId ?? -1;\n return id;\n }, [innerRef]);\n\n const root = useMemo(\n () => new SkiaRoot(Skia, NATIVE_DOM, redraw, getNativeId),\n [redraw, getNativeId]\n );\n\n // Render effect\n useEffect(() => {\n root.render(children);\n }, [children, root, redraw]);\n\n useEffect(() => {\n return () => {\n root.unmount();\n };\n }, [root]);\n\n if (NATIVE_DOM) {\n return (\n <SkiaDomView\n ref={ref}\n style={style}\n root={root.dom}\n onLayout={onLayout}\n mode={mode}\n debug={debug}\n {...props}\n />\n );\n } else {\n return (\n <SkiaJSDomView\n Skia={Skia}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={ref as any}\n style={style}\n root={root.dom}\n onLayout={onLayout}\n mode={mode}\n debug={debug}\n {...props}\n />\n );\n }\n }\n) as FunctionComponent<CanvasProps & React.RefAttributes<SkiaDomView>>;\n\n/**\n * Combines a list of refs into a single ref. This can be used to provide\n * both a forwarded ref and an internal ref keeping the same functionality\n * on both of the refs.\n * @param refs Array of refs to combine\n * @returns A single ref that can be used in a ref prop.\n */\nconst useCombinedRefs = <T,>(\n ...refs: Array<MutableRefObject<T> | ForwardedRef<T>>\n) => {\n const targetRef = React.useRef<T>(null);\n React.useEffect(() => {\n refs.forEach((ref) => {\n if (ref) {\n if (typeof ref === \"function\") {\n ref(targetRef.current);\n } else {\n ref.current = targetRef.current;\n }\n }\n });\n }, [refs]);\n return targetRef;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAA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AAAlD,QAAA;MACV+B,GAAG,EAAEA,GAAI;MACTT,KAAK,EAAEA,KAAM;MACbmB,IAAI,EAAEA,IAAI,CAACU,GAAI;MACfxC,QAAQ,EAAEA,QAAS;MACnBa,IAAI,EAAEA,IAAK;MACXD,KAAK,EAAEA;IAAM,GACTK,KAAK,CACV,CAAC;EAEN,CAAC,MAAM;IACL,oBACExD,MAAA,CAAAc,OAAA,CAAA+D,aAAA,CAACxE,cAAA,CAAA2E,aAAa,EAAApD,QAAA;MACZ4C,IAAI,EAAEA;MACN;MAAA;MACAb,GAAG,EAAEA,GAAW;MAChBT,KAAK,EAAEA,KAAM;MACbmB,IAAI,EAAEA,IAAI,CAACU,GAAI;MACfxC,QAAQ,EAAEA,QAAS;MACnBa,IAAI,EAAEA,IAAK;MACXD,KAAK,EAAEA;IAAM,GACTK,KAAK,CACV,CAAC;EAEN;AACF,CACF,CAAsE;;AAEtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMI,eAAe,GAAGA,CACtB,GAAGqB,IAAkD,KAClD;EACH,MAAMC,SAAS,GAAGC,cAAK,CAAChD,MAAM,CAAI,IAAI,CAAC;EACvCgD,cAAK,CAACT,SAAS,CAAC,MAAM;IACpBO,IAAI,CAACG,OAAO,CAAEzB,GAAG,IAAK;MACpB,IAAIA,GAAG,EAAE;QACP,IAAI,OAAOA,GAAG,KAAK,UAAU,EAAE;UAC7BA,GAAG,CAACuB,SAAS,CAACnB,OAAO,CAAC;QACxB,CAAC,MAAM;UACLJ,GAAG,CAACI,OAAO,GAAGmB,SAAS,CAACnB,OAAO;QACjC;MACF;IACF,CAAC,CAAC;EACJ,CAAC,EAAE,CAACkB,IAAI,CAAC,CAAC;EACV,OAAOC,SAAS;AAClB,CAAC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_JsiSkPoint","require","_JsiSkPaint","_JsiSkRect","_JsiSkColor","_JsiSkSurfaceFactory","_JsiSkRRect","_JsiSkRSXform","_JsiSkContourMeasureIter","_JsiSkPictureRecorder","_JsiSkPictureFactory","_JsiSkPathFactory","_JsiSkMatrix","_JsiSkColorFilterFactory","_JsiSkTypefaceFactory","_JsiSkMaskFilterFactory","_JsiSkRuntimeEffectFactory","_JsiSkImageFilterFactory","_JsiSkShaderFactory","_JsiSkPathEffectFactory","_JsiSkDataFactory","_JsiSkImageFactory","_JsiSkSVGFactory","_JsiSkTextBlobFactory","_JsiSkFont","_JsiSkVerticesFactory","_JsiSkPath","_JsiSkTypeface","_JsiSkTypefaceFontProviderFactory","_JsiSkFontMgrFactory","_JsiSkAnimatedImageFactory","_JsiSkParagraphBuilderFactory","_JsiSkNativeBufferFactory","_JsiVideo","JsiSkApi","CanvasKit","Point","x","y","JsiSkPoint","Float32Array","of","RuntimeShaderBuilder","_","Error","RRectXY","rect","rx","ry","JsiSkRRect","RSXform","scos","ssin","tx","ty","JsiSkRSXform","RSXformFromRadians","scale","r","px","py","s","Math","sin","c","cos","Color","ContourMeasureIter","path","forceClosed","resScale","JsiSkContourMeasureIter","JsiSkPath","fromValue","Paint","paint","JsiSkPaint","setAntiAlias","PictureRecorder","JsiSkPictureRecorder","Picture","JsiSkPictureFactory","Path","JsiSkPathFactory","Matrix","matrix","JsiSkMatrix","identity","ColorFilter","JsiSkColorFilterFactory","Font","typeface","size","JsiSkFont","undefined","JsiSkTypeface","Typeface","JsiSkTypefaceFactory","MaskFilter","JsiSkMaskFilterFactory","RuntimeEffect","JsiSkRuntimeEffectFactory","ImageFilter","JsiSkImageFilterFactory","Shader","JsiSkShaderFactory","PathEffect","JsiSkPathEffectFactory","MakeVertices","bind","Data","JsiSkDataFactory","Image","JsiSkImageFactory","AnimatedImage","JsiSkAnimatedImageFactory","SVG","JsiSkSVGFactory","TextBlob","JsiSkTextBlobFactory","XYWHRect","width","height","JsiSkRect","Surface","JsiSkSurfaceFactory","TypefaceFontProvider","JsiSkTypefaceFontProviderFactory","FontMgr","JsiSkFontMgrFactory","ParagraphBuilder","JsiSkParagraphBuilderFactory","NativeBuffer","JsiSkNativeBufferFactory","Video","createVideo","Context","_surface","_width","_height","exports"],"sources":["JsiSkia.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n SkContourMeasureIter,\n Skia,\n SkPath,\n SkRect,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n SkTypeface,\n} from \"../types\";\n\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { Color } from \"./JsiSkColor\";\nimport { JsiSkSurfaceFactory } from \"./JsiSkSurfaceFactory\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkRSXform } from \"./JsiSkRSXform\";\nimport { JsiSkContourMeasureIter } from \"./JsiSkContourMeasureIter\";\nimport { JsiSkPictureRecorder } from \"./JsiSkPictureRecorder\";\nimport { JsiSkPictureFactory } from \"./JsiSkPictureFactory\";\nimport { JsiSkPathFactory } from \"./JsiSkPathFactory\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkColorFilterFactory } from \"./JsiSkColorFilterFactory\";\nimport { JsiSkTypefaceFactory } from \"./JsiSkTypefaceFactory\";\nimport { JsiSkMaskFilterFactory } from \"./JsiSkMaskFilterFactory\";\nimport { JsiSkRuntimeEffectFactory } from \"./JsiSkRuntimeEffectFactory\";\nimport { JsiSkImageFilterFactory } from \"./JsiSkImageFilterFactory\";\nimport { JsiSkShaderFactory } from \"./JsiSkShaderFactory\";\nimport { JsiSkPathEffectFactory } from \"./JsiSkPathEffectFactory\";\nimport { JsiSkDataFactory } from \"./JsiSkDataFactory\";\nimport { JsiSkImageFactory } from \"./JsiSkImageFactory\";\nimport { JsiSkSVGFactory } from \"./JsiSkSVGFactory\";\nimport { JsiSkTextBlobFactory } from \"./JsiSkTextBlobFactory\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { MakeVertices } from \"./JsiSkVerticesFactory\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkTypeface } from \"./JsiSkTypeface\";\nimport { JsiSkTypefaceFontProviderFactory } from \"./JsiSkTypefaceFontProviderFactory\";\nimport { JsiSkFontMgrFactory } from \"./JsiSkFontMgrFactory\";\nimport { JsiSkAnimatedImageFactory } from \"./JsiSkAnimatedImageFactory\";\nimport { JsiSkParagraphBuilderFactory } from \"./JsiSkParagraphBuilderFactory\";\nimport { JsiSkNativeBufferFactory } from \"./JsiSkNativeBufferFactory\";\nimport { createVideo } from \"./JsiVideo\";\n\nexport const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({\n Point: (x: number, y: number) =>\n new JsiSkPoint(CanvasKit, Float32Array.of(x, y)),\n RuntimeShaderBuilder: (_: SkRuntimeEffect): SkRuntimeShaderBuilder => {\n throw new Error(\"Not implemented on React Native Web\");\n },\n RRectXY: (rect: SkRect, rx: number, ry: number) =>\n new JsiSkRRect(CanvasKit, rect, rx, ry),\n RSXform: (scos: number, ssin: number, tx: number, ty: number) =>\n new JsiSkRSXform(CanvasKit, Float32Array.of(scos, ssin, tx, ty)),\n RSXformFromRadians: (\n scale: number,\n r: number,\n tx: number,\n ty: number,\n px: number,\n py: number\n ) => {\n const s = Math.sin(r) * scale;\n const c = Math.cos(r) * scale;\n return new JsiSkRSXform(\n CanvasKit,\n Float32Array.of(c, s, tx - c * px + s * py, ty - s * px - c * py)\n );\n },\n Color,\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ): SkContourMeasureIter =>\n new JsiSkContourMeasureIter(\n CanvasKit,\n new CanvasKit.ContourMeasureIter(\n JsiSkPath.fromValue(path),\n forceClosed,\n resScale\n )\n ),\n Paint: () => {\n const paint = new JsiSkPaint(CanvasKit, new CanvasKit.Paint());\n paint.setAntiAlias(true);\n return paint;\n },\n PictureRecorder: () =>\n new JsiSkPictureRecorder(CanvasKit, new CanvasKit.PictureRecorder()),\n Picture: new JsiSkPictureFactory(CanvasKit),\n Path: new JsiSkPathFactory(CanvasKit),\n Matrix: (matrix?: readonly number[]) =>\n new JsiSkMatrix(\n CanvasKit,\n matrix\n ? Float32Array.of(...matrix)\n : Float32Array.of(...CanvasKit.Matrix.identity())\n ),\n ColorFilter: new JsiSkColorFilterFactory(CanvasKit),\n Font: (typeface?: SkTypeface, size?: number) =>\n new JsiSkFont(\n CanvasKit,\n new CanvasKit.Font(\n typeface === undefined ? null : JsiSkTypeface.fromValue(typeface),\n size\n )\n ),\n Typeface: new JsiSkTypefaceFactory(CanvasKit),\n MaskFilter: new JsiSkMaskFilterFactory(CanvasKit),\n RuntimeEffect: new JsiSkRuntimeEffectFactory(CanvasKit),\n ImageFilter: new JsiSkImageFilterFactory(CanvasKit),\n Shader: new JsiSkShaderFactory(CanvasKit),\n PathEffect: new JsiSkPathEffectFactory(CanvasKit),\n MakeVertices: MakeVertices.bind(null, CanvasKit),\n Data: new JsiSkDataFactory(CanvasKit),\n Image: new JsiSkImageFactory(CanvasKit),\n AnimatedImage: new JsiSkAnimatedImageFactory(CanvasKit),\n SVG: new JsiSkSVGFactory(CanvasKit),\n TextBlob: new JsiSkTextBlobFactory(CanvasKit),\n XYWHRect: (x: number, y: number, width: number, height: number) => {\n return new JsiSkRect(CanvasKit, CanvasKit.XYWHRect(x, y, width, height));\n },\n Surface: new JsiSkSurfaceFactory(CanvasKit),\n TypefaceFontProvider: new JsiSkTypefaceFontProviderFactory(CanvasKit),\n FontMgr: new JsiSkFontMgrFactory(CanvasKit),\n ParagraphBuilder: new JsiSkParagraphBuilderFactory(CanvasKit),\n NativeBuffer: new JsiSkNativeBufferFactory(CanvasKit),\n Video: createVideo.bind(null, CanvasKit),\n Context: (_surface: bigint, _width: number, _height: number) => {\n throw new Error(\"Not implemented on React Native Web\");\n }\n});\n"],"mappings":";;;;;;AAYA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IA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AChD2E,IAAI,EAAE,IAAIC,kCAAgB,CAAC5E,SAAS,CAAC;EACrC6E,KAAK,EAAE,IAAIC,oCAAiB,CAAC9E,SAAS,CAAC;EACvC+E,aAAa,EAAE,IAAIC,oDAAyB,CAAChF,SAAS,CAAC;EACvDiF,GAAG,EAAE,IAAIC,gCAAe,CAAClF,SAAS,CAAC;EACnCmF,QAAQ,EAAE,IAAIC,0CAAoB,CAACpF,SAAS,CAAC;EAC7CqF,QAAQ,EAAEA,CAACnF,CAAS,EAAEC,CAAS,EAAEmF,KAAa,EAAEC,MAAc,KAAK;IACjE,OAAO,IAAIC,oBAAS,CAACxF,SAAS,EAAEA,SAAS,CAACqF,QAAQ,CAACnF,CAAC,EAAEC,CAAC,EAAEmF,KAAK,EAAEC,MAAM,CAAC,CAAC;EAC1E,CAAC;EACDE,OAAO,EAAE,IAAIC,wCAAmB,CAAC1F,SAAS,CAAC;EAC3C2F,oBAAoB,EAAE,IAAIC,kEAAgC,CAAC5F,SAAS,CAAC;EACrE6F,OAAO,EAAE,IAAIC,wCAAmB,CAAC9F,SAAS,CAAC;EAC3C+F,gBAAgB,EAAE,IAAIC,0DAA4B,CAAChG,SAAS,CAAC;EAC7DiG,YAAY,EAAE,IAAIC,kDAAwB,CAAClG,SAAS,CAAC;EACrDmG,KAAK,EAAEC,qBAAW,CAAC1B,IAAI,CAAC,IAAI,EAAE1E,SAAS,CAAC;EACxCqG,OAAO,EAAEA,CAACC,QAAgB,EAAEC,MAAc,EAAEC,OAAe,KAAK;IAC9D,MAAM,IAAI/F,KAAK,CAAC,qCAAqC,CAAC;EACxD;AACF,CAAC,CAAC;AAACgG,OAAA,CAAA1G,QAAA,GAAAA,QAAA","ignoreList":[]}
|
1
|
+
{"version":3,"names":["_JsiSkPoint","require","_JsiSkPaint","_JsiSkRect","_JsiSkColor","_JsiSkSurfaceFactory","_JsiSkRRect","_JsiSkRSXform","_JsiSkContourMeasureIter","_JsiSkPictureRecorder","_JsiSkPictureFactory","_JsiSkPathFactory","_JsiSkMatrix","_JsiSkColorFilterFactory","_JsiSkTypefaceFactory","_JsiSkMaskFilterFactory","_JsiSkRuntimeEffectFactory","_JsiSkImageFilterFactory","_JsiSkShaderFactory","_JsiSkPathEffectFactory","_JsiSkDataFactory","_JsiSkImageFactory","_JsiSkSVGFactory","_JsiSkTextBlobFactory","_JsiSkFont","_JsiSkVerticesFactory","_JsiSkPath","_JsiSkTypeface","_JsiSkTypefaceFontProviderFactory","_JsiSkFontMgrFactory","_JsiSkAnimatedImageFactory","_JsiSkParagraphBuilderFactory","_JsiSkNativeBufferFactory","_JsiVideo","JsiSkApi","CanvasKit","Point","x","y","JsiSkPoint","Float32Array","of","RuntimeShaderBuilder","_","Error","RRectXY","rect","rx","ry","JsiSkRRect","RSXform","scos","ssin","tx","ty","JsiSkRSXform","RSXformFromRadians","scale","r","px","py","s","Math","sin","c","cos","Color","ContourMeasureIter","path","forceClosed","resScale","JsiSkContourMeasureIter","JsiSkPath","fromValue","Paint","paint","JsiSkPaint","setAntiAlias","PictureRecorder","JsiSkPictureRecorder","Picture","JsiSkPictureFactory","Path","JsiSkPathFactory","Matrix","matrix","JsiSkMatrix","identity","ColorFilter","JsiSkColorFilterFactory","Font","typeface","size","JsiSkFont","undefined","JsiSkTypeface","Typeface","JsiSkTypefaceFactory","MaskFilter","JsiSkMaskFilterFactory","RuntimeEffect","JsiSkRuntimeEffectFactory","ImageFilter","JsiSkImageFilterFactory","Shader","JsiSkShaderFactory","PathEffect","JsiSkPathEffectFactory","MakeVertices","bind","Data","JsiSkDataFactory","Image","JsiSkImageFactory","AnimatedImage","JsiSkAnimatedImageFactory","SVG","JsiSkSVGFactory","TextBlob","JsiSkTextBlobFactory","XYWHRect","width","height","JsiSkRect","Surface","JsiSkSurfaceFactory","TypefaceFontProvider","JsiSkTypefaceFontProviderFactory","FontMgr","JsiSkFontMgrFactory","ParagraphBuilder","JsiSkParagraphBuilderFactory","NativeBuffer","JsiSkNativeBufferFactory","Video","createVideo","Context","_surface","_width","_height","exports"],"sources":["JsiSkia.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n SkContourMeasureIter,\n Skia,\n SkPath,\n SkRect,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n SkTypeface,\n} from \"../types\";\n\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { Color } from \"./JsiSkColor\";\nimport { JsiSkSurfaceFactory } from \"./JsiSkSurfaceFactory\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkRSXform } from \"./JsiSkRSXform\";\nimport { JsiSkContourMeasureIter } from \"./JsiSkContourMeasureIter\";\nimport { JsiSkPictureRecorder } from \"./JsiSkPictureRecorder\";\nimport { JsiSkPictureFactory } from \"./JsiSkPictureFactory\";\nimport { JsiSkPathFactory } from \"./JsiSkPathFactory\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkColorFilterFactory } from \"./JsiSkColorFilterFactory\";\nimport { JsiSkTypefaceFactory } from \"./JsiSkTypefaceFactory\";\nimport { JsiSkMaskFilterFactory } from \"./JsiSkMaskFilterFactory\";\nimport { JsiSkRuntimeEffectFactory } from \"./JsiSkRuntimeEffectFactory\";\nimport { JsiSkImageFilterFactory } from \"./JsiSkImageFilterFactory\";\nimport { JsiSkShaderFactory } from \"./JsiSkShaderFactory\";\nimport { JsiSkPathEffectFactory } from \"./JsiSkPathEffectFactory\";\nimport { JsiSkDataFactory } from \"./JsiSkDataFactory\";\nimport { JsiSkImageFactory } from \"./JsiSkImageFactory\";\nimport { JsiSkSVGFactory } from \"./JsiSkSVGFactory\";\nimport { JsiSkTextBlobFactory } from \"./JsiSkTextBlobFactory\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { MakeVertices } from \"./JsiSkVerticesFactory\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkTypeface } from \"./JsiSkTypeface\";\nimport { JsiSkTypefaceFontProviderFactory } from \"./JsiSkTypefaceFontProviderFactory\";\nimport { JsiSkFontMgrFactory } from \"./JsiSkFontMgrFactory\";\nimport { JsiSkAnimatedImageFactory } from \"./JsiSkAnimatedImageFactory\";\nimport { JsiSkParagraphBuilderFactory } from \"./JsiSkParagraphBuilderFactory\";\nimport { JsiSkNativeBufferFactory } from \"./JsiSkNativeBufferFactory\";\nimport { createVideo } from \"./JsiVideo\";\n\nexport const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({\n Point: (x: number, y: number) =>\n new JsiSkPoint(CanvasKit, Float32Array.of(x, y)),\n RuntimeShaderBuilder: (_: SkRuntimeEffect): SkRuntimeShaderBuilder => {\n throw new Error(\"Not implemented on React Native Web\");\n },\n RRectXY: (rect: SkRect, rx: number, ry: number) =>\n new JsiSkRRect(CanvasKit, rect, rx, ry),\n RSXform: (scos: number, ssin: number, tx: number, ty: number) =>\n new JsiSkRSXform(CanvasKit, Float32Array.of(scos, ssin, tx, ty)),\n RSXformFromRadians: (\n scale: number,\n r: number,\n tx: number,\n ty: number,\n px: number,\n py: number\n ) => {\n const s = Math.sin(r) * scale;\n const c = Math.cos(r) * scale;\n return new JsiSkRSXform(\n CanvasKit,\n Float32Array.of(c, s, tx - c * px + s * py, ty - s * px - c * py)\n );\n },\n Color,\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ): SkContourMeasureIter =>\n new JsiSkContourMeasureIter(\n CanvasKit,\n new CanvasKit.ContourMeasureIter(\n JsiSkPath.fromValue(path),\n forceClosed,\n resScale\n )\n ),\n Paint: () => {\n const paint = new JsiSkPaint(CanvasKit, new CanvasKit.Paint());\n paint.setAntiAlias(true);\n return paint;\n },\n PictureRecorder: () =>\n new JsiSkPictureRecorder(CanvasKit, new CanvasKit.PictureRecorder()),\n Picture: new JsiSkPictureFactory(CanvasKit),\n Path: new JsiSkPathFactory(CanvasKit),\n Matrix: (matrix?: readonly number[]) =>\n new JsiSkMatrix(\n CanvasKit,\n matrix\n ? Float32Array.of(...matrix)\n : Float32Array.of(...CanvasKit.Matrix.identity())\n ),\n ColorFilter: new JsiSkColorFilterFactory(CanvasKit),\n Font: (typeface?: SkTypeface, size?: number) =>\n new JsiSkFont(\n CanvasKit,\n new CanvasKit.Font(\n typeface === undefined ? null : JsiSkTypeface.fromValue(typeface),\n size\n )\n ),\n Typeface: new JsiSkTypefaceFactory(CanvasKit),\n MaskFilter: new JsiSkMaskFilterFactory(CanvasKit),\n RuntimeEffect: new JsiSkRuntimeEffectFactory(CanvasKit),\n ImageFilter: new JsiSkImageFilterFactory(CanvasKit),\n Shader: new JsiSkShaderFactory(CanvasKit),\n PathEffect: new JsiSkPathEffectFactory(CanvasKit),\n MakeVertices: MakeVertices.bind(null, CanvasKit),\n Data: new JsiSkDataFactory(CanvasKit),\n Image: new JsiSkImageFactory(CanvasKit),\n AnimatedImage: new JsiSkAnimatedImageFactory(CanvasKit),\n SVG: new JsiSkSVGFactory(CanvasKit),\n TextBlob: new JsiSkTextBlobFactory(CanvasKit),\n XYWHRect: (x: number, y: number, width: number, height: number) => {\n return new JsiSkRect(CanvasKit, CanvasKit.XYWHRect(x, y, width, height));\n },\n Surface: new JsiSkSurfaceFactory(CanvasKit),\n TypefaceFontProvider: new JsiSkTypefaceFontProviderFactory(CanvasKit),\n FontMgr: new JsiSkFontMgrFactory(CanvasKit),\n ParagraphBuilder: new JsiSkParagraphBuilderFactory(CanvasKit),\n NativeBuffer: new JsiSkNativeBufferFactory(CanvasKit),\n Video: createVideo.bind(null, CanvasKit),\n Context: (_surface: bigint, _width: number, _height: number) => {\n throw new Error(\"Not implemented on React Native Web\");\n },\n});\n"],"mappings":";;;;;;AAYA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,oBAAA,GAAAJ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AAC;EACrC6E,KAAK,EAAE,IAAIC,oCAAiB,CAAC9E,SAAS,CAAC;EACvC+E,aAAa,EAAE,IAAIC,oDAAyB,CAAChF,SAAS,CAAC;EACvDiF,GAAG,EAAE,IAAIC,gCAAe,CAAClF,SAAS,CAAC;EACnCmF,QAAQ,EAAE,IAAIC,0CAAoB,CAACpF,SAAS,CAAC;EAC7CqF,QAAQ,EAAEA,CAACnF,CAAS,EAAEC,CAAS,EAAEmF,KAAa,EAAEC,MAAc,KAAK;IACjE,OAAO,IAAIC,oBAAS,CAACxF,SAAS,EAAEA,SAAS,CAACqF,QAAQ,CAACnF,CAAC,EAAEC,CAAC,EAAEmF,KAAK,EAAEC,MAAM,CAAC,CAAC;EAC1E,CAAC;EACDE,OAAO,EAAE,IAAIC,wCAAmB,CAAC1F,SAAS,CAAC;EAC3C2F,oBAAoB,EAAE,IAAIC,kEAAgC,CAAC5F,SAAS,CAAC;EACrE6F,OAAO,EAAE,IAAIC,wCAAmB,CAAC9F,SAAS,CAAC;EAC3C+F,gBAAgB,EAAE,IAAIC,0DAA4B,CAAChG,SAAS,CAAC;EAC7DiG,YAAY,EAAE,IAAIC,kDAAwB,CAAClG,SAAS,CAAC;EACrDmG,KAAK,EAAEC,qBAAW,CAAC1B,IAAI,CAAC,IAAI,EAAE1E,SAAS,CAAC;EACxCqG,OAAO,EAAEA,CAACC,QAAgB,EAAEC,MAAc,EAAEC,OAAe,KAAK;IAC9D,MAAM,IAAI/F,KAAK,CAAC,qCAAqC,CAAC;EACxD;AACF,CAAC,CAAC;AAACgG,OAAA,CAAA1G,QAAA,GAAAA,QAAA","ignoreList":[]}
|
@@ -1,13 +1,10 @@
|
|
1
1
|
import React from "react";
|
2
|
-
import type { PointerEvent } from "react";
|
3
2
|
import type { SkRect, SkCanvas } from "../skia/types";
|
4
|
-
import type { DrawMode, SkiaBaseViewProps
|
5
|
-
import { TouchType } from "./types";
|
3
|
+
import type { DrawMode, SkiaBaseViewProps } from "./types";
|
6
4
|
export declare abstract class SkiaBaseWebView<TProps extends SkiaBaseViewProps> extends React.Component<TProps> {
|
7
5
|
constructor(props: TProps);
|
8
6
|
private _surface;
|
9
7
|
private _unsubscriptions;
|
10
|
-
private _touches;
|
11
8
|
private _canvas;
|
12
9
|
private _canvasRef;
|
13
10
|
private _mode;
|
@@ -33,7 +30,7 @@ export declare abstract class SkiaBaseWebView<TProps extends SkiaBaseViewProps>
|
|
33
30
|
/**
|
34
31
|
* Override to render
|
35
32
|
*/
|
36
|
-
protected abstract renderInCanvas(canvas: SkCanvas
|
33
|
+
protected abstract renderInCanvas(canvas: SkCanvas): void;
|
37
34
|
/**
|
38
35
|
* Sends a redraw request to the native SkiaView.
|
39
36
|
*/
|
@@ -49,12 +46,6 @@ export declare abstract class SkiaBaseWebView<TProps extends SkiaBaseViewProps>
|
|
49
46
|
* @param mode Drawing mode to use.
|
50
47
|
*/
|
51
48
|
setDrawMode(mode: DrawMode): void;
|
52
|
-
private handleTouchEvent;
|
53
|
-
createTouchHandler(touchType: TouchType): (evt: PointerEvent) => void;
|
54
|
-
private onStart;
|
55
|
-
private onActive;
|
56
|
-
private onCancel;
|
57
|
-
private onEnd;
|
58
49
|
private onLayout;
|
59
50
|
render(): React.JSX.Element;
|
60
51
|
}
|
@@ -7,7 +7,6 @@ exports.SkiaBaseWebView = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
8
8
|
var _JsiSkSurface = require("../skia/web/JsiSkSurface");
|
9
9
|
var _Platform = require("../Platform");
|
10
|
-
var _types = require("./types");
|
11
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
12
11
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
13
12
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
@@ -20,7 +19,6 @@ class SkiaBaseWebView extends _react.default.Component {
|
|
20
19
|
super(props);
|
21
20
|
_defineProperty(this, "_surface", null);
|
22
21
|
_defineProperty(this, "_unsubscriptions", []);
|
23
|
-
_defineProperty(this, "_touches", []);
|
24
22
|
_defineProperty(this, "_canvas", null);
|
25
23
|
_defineProperty(this, "_canvasRef", /*#__PURE__*/_react.default.createRef());
|
26
24
|
_defineProperty(this, "_mode", void 0);
|
@@ -28,10 +26,6 @@ class SkiaBaseWebView extends _react.default.Component {
|
|
28
26
|
_defineProperty(this, "requestId", 0);
|
29
27
|
_defineProperty(this, "width", 0);
|
30
28
|
_defineProperty(this, "height", 0);
|
31
|
-
_defineProperty(this, "onStart", this.createTouchHandler(_types.TouchType.Start));
|
32
|
-
_defineProperty(this, "onActive", this.createTouchHandler(_types.TouchType.Active));
|
33
|
-
_defineProperty(this, "onCancel", this.createTouchHandler(_types.TouchType.Cancelled));
|
34
|
-
_defineProperty(this, "onEnd", this.createTouchHandler(_types.TouchType.End));
|
35
29
|
_defineProperty(this, "onLayout", this.onLayoutEvent.bind(this));
|
36
30
|
this._mode = (_props$mode = props.mode) !== null && _props$mode !== void 0 ? _props$mode : "default";
|
37
31
|
}
|
@@ -97,7 +91,7 @@ class SkiaBaseWebView extends _react.default.Component {
|
|
97
91
|
makeImageSnapshot(rect) {
|
98
92
|
var _this$_surface, _this$_surface2;
|
99
93
|
this._canvas.clear(CanvasKit.TRANSPARENT);
|
100
|
-
this.renderInCanvas(this._canvas
|
94
|
+
this.renderInCanvas(this._canvas);
|
101
95
|
(_this$_surface = this._surface) === null || _this$_surface === void 0 || _this$_surface.ref.flush();
|
102
96
|
return (_this$_surface2 = this._surface) === null || _this$_surface2 === void 0 ? void 0 : _this$_surface2.makeImageSnapshot(rect);
|
103
97
|
}
|
@@ -114,13 +108,11 @@ class SkiaBaseWebView extends _react.default.Component {
|
|
114
108
|
this._redrawRequests = 0;
|
115
109
|
if (this._canvas) {
|
116
110
|
var _this$_surface3;
|
117
|
-
const touches = [...this._touches];
|
118
|
-
this._touches = [];
|
119
111
|
const canvas = this._canvas;
|
120
112
|
canvas.clear(Float32Array.of(0, 0, 0, 0));
|
121
113
|
canvas.save();
|
122
114
|
canvas.scale(pd, pd);
|
123
|
-
this.renderInCanvas(canvas
|
115
|
+
this.renderInCanvas(canvas);
|
124
116
|
canvas.restore();
|
125
117
|
(_this$_surface3 = this._surface) === null || _this$_surface3 === void 0 || _this$_surface3.ref.flush();
|
126
118
|
}
|
@@ -144,20 +136,6 @@ class SkiaBaseWebView extends _react.default.Component {
|
|
144
136
|
this._mode = mode;
|
145
137
|
this.tick();
|
146
138
|
}
|
147
|
-
handleTouchEvent(evt, touchType) {
|
148
|
-
this._touches.push({
|
149
|
-
id: evt.pointerId,
|
150
|
-
x: evt.clientX - evt.currentTarget.getClientRects()[0].left,
|
151
|
-
y: evt.clientY - evt.currentTarget.getClientRects()[0].top,
|
152
|
-
force: evt.pressure,
|
153
|
-
type: touchType,
|
154
|
-
timestamp: Date.now()
|
155
|
-
});
|
156
|
-
this.redraw();
|
157
|
-
}
|
158
|
-
createTouchHandler(touchType) {
|
159
|
-
return evt => this.handleTouchEvent(evt, touchType);
|
160
|
-
}
|
161
139
|
render() {
|
162
140
|
const {
|
163
141
|
mode,
|
@@ -171,13 +149,7 @@ class SkiaBaseWebView extends _react.default.Component {
|
|
171
149
|
style: {
|
172
150
|
display: "flex",
|
173
151
|
flex: 1
|
174
|
-
}
|
175
|
-
onPointerDown: this.onStart,
|
176
|
-
onPointerMove: this.onActive,
|
177
|
-
onPointerUp: this.onEnd,
|
178
|
-
onPointerCancel: this.onCancel,
|
179
|
-
onPointerLeave: this.onEnd,
|
180
|
-
onPointerOut: this.onEnd
|
152
|
+
}
|
181
153
|
}));
|
182
154
|
}
|
183
155
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_JsiSkSurface","_Platform","_types","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","_defineProperty","_toPropertyKey","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","pd","Platform","PixelRatio","SkiaBaseWebView","React","Component","constructor","props","_props$mode","createRef","createTouchHandler","TouchType","Start","Active","Cancelled","End","onLayoutEvent","_mode","mode","unsubscribeAll","_unsubscriptions","forEach","u","evt","CanvasKit","global","canvas","_canvasRef","current","width","clientWidth","height","clientHeight","surface","MakeWebGLCanvasSurface","Error","_surface","JsiSkSurface","_canvas","getCanvas","redraw","onLayout","getSize","componentDidMount","tick","componentDidUpdate","componentWillUnmount","cancelAnimationFrame","requestId","_this$_canvasRef$curr","getContext","getExtension","loseContext","makeImageSnapshot","rect","_this$_surface","_this$_surface2","clear","TRANSPARENT","renderInCanvas","ref","flush","_redrawRequests","_this$_surface3","touches","_touches","Float32Array","of","save","scale","restore","requestAnimationFrame","setDrawMode","handleTouchEvent","touchType","push","id","pointerId","x","clientX","currentTarget","getClientRects","left","y","clientY","top","force","pressure","type","timestamp","Date","now","render","debug","viewProps","createElement","View","style","display","flex","onPointerDown","onStart","onPointerMove","onActive","onPointerUp","onEnd","onPointerCancel","onCancel","onPointerLeave","onPointerOut","exports"],"sources":["SkiaBaseWebView.tsx"],"sourcesContent":["/* global HTMLCanvasElement */\nimport React from \"react\";\nimport type { PointerEvent } from \"react\";\nimport type { LayoutChangeEvent } from \"react-native\";\n\nimport type { SkRect, SkCanvas } from \"../skia/types\";\nimport { JsiSkSurface } from \"../skia/web/JsiSkSurface\";\nimport { Platform } from \"../Platform\";\n\nimport type { DrawMode, SkiaBaseViewProps, TouchInfo } from \"./types\";\nimport { TouchType } from \"./types\";\n\nconst pd = Platform.PixelRatio;\n\nexport abstract class SkiaBaseWebView<\n TProps extends SkiaBaseViewProps\n> extends React.Component<TProps> {\n constructor(props: TProps) {\n super(props);\n this._mode = props.mode ?? \"default\";\n }\n\n private _surface: JsiSkSurface | null = null;\n private _unsubscriptions: Array<() => void> = [];\n private _touches: Array<TouchInfo> = [];\n private _canvas: SkCanvas | null = null;\n private _canvasRef = React.createRef<HTMLCanvasElement>();\n private _mode: DrawMode;\n private _redrawRequests = 0;\n private requestId = 0;\n\n protected width = 0;\n protected height = 0;\n\n private unsubscribeAll() {\n this._unsubscriptions.forEach((u) => u());\n this._unsubscriptions = [];\n }\n\n private onLayoutEvent(evt: LayoutChangeEvent) {\n const { CanvasKit } = global;\n // Reset canvas / surface on layout change\n const canvas = this._canvasRef.current;\n if (canvas) {\n this.width = canvas.clientWidth;\n this.height = canvas.clientHeight;\n canvas.width = this.width * pd;\n canvas.height = this.height * pd;\n const surface = CanvasKit.MakeWebGLCanvasSurface(canvas);\n if (!surface) {\n throw new Error(\"Could not create surface\");\n }\n this._surface = new JsiSkSurface(CanvasKit, surface);\n this._canvas = this._surface.getCanvas();\n this.redraw();\n }\n // Call onLayout callback if it exists\n if (this.props.onLayout) {\n this.props.onLayout(evt);\n }\n }\n\n protected getSize() {\n return { width: this.width, height: this.height };\n }\n\n componentDidMount() {\n // Start render loop\n this.tick();\n }\n\n componentDidUpdate() {\n this.redraw();\n }\n\n componentWillUnmount() {\n this.unsubscribeAll();\n cancelAnimationFrame(this.requestId);\n // eslint-disable-next-line max-len\n // https://stackoverflow.com/questions/23598471/how-do-i-clean-up-and-unload-a-webgl-canvas-context-from-gpu-after-use\n // https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_lose_context\n // We delete the context, only if the context has been intialized\n if (this._surface) {\n this._canvasRef.current\n ?.getContext(\"webgl2\")\n ?.getExtension(\"WEBGL_lose_context\")\n ?.loseContext();\n }\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n this._canvas!.clear(CanvasKit.TRANSPARENT);\n this.renderInCanvas(this._canvas!, []);\n this._surface?.ref.flush();\n return this._surface?.makeImageSnapshot(rect);\n }\n\n /**\n * Override to render\n */\n protected abstract renderInCanvas(\n canvas: SkCanvas,\n touches: TouchInfo[]\n ): void;\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n private tick() {\n if (this._mode === \"continuous\" || this._redrawRequests > 0) {\n this._redrawRequests = 0;\n if (this._canvas) {\n const touches = [...this._touches];\n this._touches = [];\n const canvas = this._canvas!;\n canvas.clear(Float32Array.of(0, 0, 0, 0));\n canvas.save();\n canvas.scale(pd, pd);\n this.renderInCanvas(canvas, touches);\n canvas.restore();\n this._surface?.ref.flush();\n }\n }\n this.requestId = requestAnimationFrame(this.tick.bind(this));\n }\n\n public redraw() {\n this._redrawRequests++;\n }\n\n /**\n * Updates the drawing mode for the skia view. This is the same\n * as declaratively setting the mode property on the SkiaView.\n * There are two drawing modes, \"continuous\" and \"default\",\n * where the continuous mode will continuously redraw the view and\n * the default mode will only redraw when any of the regular react\n * properties are changed like size and margins.\n * @param mode Drawing mode to use.\n */\n public setDrawMode(mode: DrawMode) {\n this._mode = mode;\n this.tick();\n }\n\n private handleTouchEvent(evt: PointerEvent, touchType: TouchType) {\n this._touches.push({\n id: evt.pointerId,\n x: evt.clientX - evt.currentTarget.getClientRects()[0].left,\n y: evt.clientY - evt.currentTarget.getClientRects()[0].top,\n force: evt.pressure,\n type: touchType,\n timestamp: Date.now(),\n });\n this.redraw();\n }\n\n createTouchHandler(touchType: TouchType) {\n return (evt: PointerEvent) => this.handleTouchEvent(evt, touchType);\n }\n\n private onStart = this.createTouchHandler(TouchType.Start);\n private onActive = this.createTouchHandler(TouchType.Active);\n private onCancel = this.createTouchHandler(TouchType.Cancelled);\n private onEnd = this.createTouchHandler(TouchType.End);\n private onLayout = this.onLayoutEvent.bind(this);\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <Platform.View {...viewProps} onLayout={this.onLayout}>\n <canvas\n ref={this._canvasRef}\n style={{ display: \"flex\", flex: 1 }}\n onPointerDown={this.onStart}\n onPointerMove={this.onActive}\n onPointerUp={this.onEnd}\n onPointerCancel={this.onCancel}\n onPointerLeave={this.onEnd}\n onPointerOut={this.onEnd}\n />\n </Platform.View>\n );\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAGA,IAAAG,MAAA,GAAAH,OAAA;AAAoC,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,SAAA,WAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,CAAA,aAAAP,CAAA,MAAAA,CAAA,GAAAQ,SAAA,CAAAC,MAAA,EAAAT,CAAA,UAAAU,CAAA,GAAAF,SAAA,CAAAR,CAAA,YAAAW,CAAA,IAAAD,CAAA,OAAAE,cAAA,CAAAC,IAAA,CAAAH,CAAA,EAAAC,CAAA,MAAAJ,CAAA,CAAAI,CAAA,IAAAD,CAAA,CAAAC,CAAA,aAAAJ,CAAA,KAAAJ,QAAA,CAAAW,KAAA,OAAAN,SAAA;AAAA,SAAAO,gBAAAf,CAAA,EAAAW,CAAA,EAAAD,CAAA,YAAAC,CAAA,GAAAK,cAAA,CAAAL,CAAA,MAAAX,CAAA,GAAAI,MAAA,CAAAa,cAAA,CAAAjB,CAAA,EAAAW,CAAA,IAAAO,KAAA,EAAAR,CAAA,EAAAS,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAArB,CAAA,CAAAW,CAAA,IAAAD,CAAA,EAAAV,CAAA;AAAA,SAAAgB,eAAAN,CAAA,QAAAY,CAAA,GAAAC,YAAA,CAAAb,CAAA,uCAAAY,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAb,CAAA,EAAA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Aa,CAACC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAACI,GAAG;MAC1DC,KAAK,EAAE/D,GAAG,CAACgE,QAAQ;MACnBC,IAAI,EAAEd,SAAS;MACfe,SAAS,EAAEC,IAAI,CAACC,GAAG,CAAC;IACtB,CAAC,CAAC;IACF,IAAI,CAACnD,MAAM,CAAC,CAAC;EACf;EAEA9B,kBAAkBA,CAACgE,SAAoB,EAAE;IACvC,OAAQnD,GAAiB,IAAK,IAAI,CAACkD,gBAAgB,CAAClD,GAAG,EAAEmD,SAAS,CAAC;EACrE;EAQAkB,MAAMA,CAAA,EAAG;IACP,MAAM;MAAE1E,IAAI;MAAE2E,KAAK,GAAG,KAAK;MAAE,GAAGC;IAAU,CAAC,GAAG,IAAI,CAACvF,KAAK;IACxD,oBACE1C,MAAA,CAAAQ,OAAA,CAAA0H,aAAA,CAAC9H,SAAA,CAAAgC,QAAQ,CAAC+F,IAAI,EAAA1H,QAAA,KAAKwH,SAAS;MAAErD,QAAQ,EAAE,IAAI,CAACA;IAAS,iBACpD5E,MAAA,CAAAQ,OAAA,CAAA0H,aAAA;MACEnC,GAAG,EAAE,IAAI,CAACjC,UAAW;MACrBsE,KAAK,EAAE;QAAEC,OAAO,EAAE,MAAM;QAAEC,IAAI,EAAE;MAAE,CAAE;MACpCC,aAAa,EAAE,IAAI,CAACC,OAAQ;MAC5BC,aAAa,EAAE,IAAI,CAACC,QAAS;MAC7BC,WAAW,EAAE,IAAI,CAACC,KAAM;MACxBC,eAAe,EAAE,IAAI,CAACC,QAAS;MAC/BC,cAAc,EAAE,IAAI,CAACH,KAAM;MAC3BI,YAAY,EAAE,IAAI,CAACJ;IAAM,CAC1B,CACY,CAAC;EAEpB;AACF;AAACK,OAAA,CAAA3G,eAAA,GAAAA,eAAA","ignoreList":[]}
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_JsiSkSurface","_Platform","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","_defineProperty","_toPropertyKey","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","pd","Platform","PixelRatio","SkiaBaseWebView","React","Component","constructor","props","_props$mode","createRef","onLayoutEvent","_mode","mode","unsubscribeAll","_unsubscriptions","forEach","u","evt","CanvasKit","global","canvas","_canvasRef","current","width","clientWidth","height","clientHeight","surface","MakeWebGLCanvasSurface","Error","_surface","JsiSkSurface","_canvas","getCanvas","redraw","onLayout","getSize","componentDidMount","tick","componentDidUpdate","componentWillUnmount","cancelAnimationFrame","requestId","_this$_canvasRef$curr","getContext","getExtension","loseContext","makeImageSnapshot","rect","_this$_surface","_this$_surface2","clear","TRANSPARENT","renderInCanvas","ref","flush","_redrawRequests","_this$_surface3","Float32Array","of","save","scale","restore","requestAnimationFrame","setDrawMode","render","debug","viewProps","createElement","View","style","display","flex","exports"],"sources":["SkiaBaseWebView.tsx"],"sourcesContent":["/* global HTMLCanvasElement */\nimport React from \"react\";\nimport type { LayoutChangeEvent } from \"react-native\";\n\nimport type { SkRect, SkCanvas } from \"../skia/types\";\nimport { JsiSkSurface } from \"../skia/web/JsiSkSurface\";\nimport { Platform } from \"../Platform\";\n\nimport type { DrawMode, SkiaBaseViewProps } from \"./types\";\n\nconst pd = Platform.PixelRatio;\n\nexport abstract class SkiaBaseWebView<\n TProps extends SkiaBaseViewProps\n> extends React.Component<TProps> {\n constructor(props: TProps) {\n super(props);\n this._mode = props.mode ?? \"default\";\n }\n\n private _surface: JsiSkSurface | null = null;\n private _unsubscriptions: Array<() => void> = [];\n private _canvas: SkCanvas | null = null;\n private _canvasRef = React.createRef<HTMLCanvasElement>();\n private _mode: DrawMode;\n private _redrawRequests = 0;\n private requestId = 0;\n\n protected width = 0;\n protected height = 0;\n\n private unsubscribeAll() {\n this._unsubscriptions.forEach((u) => u());\n this._unsubscriptions = [];\n }\n\n private onLayoutEvent(evt: LayoutChangeEvent) {\n const { CanvasKit } = global;\n // Reset canvas / surface on layout change\n const canvas = this._canvasRef.current;\n if (canvas) {\n this.width = canvas.clientWidth;\n this.height = canvas.clientHeight;\n canvas.width = this.width * pd;\n canvas.height = this.height * pd;\n const surface = CanvasKit.MakeWebGLCanvasSurface(canvas);\n if (!surface) {\n throw new Error(\"Could not create surface\");\n }\n this._surface = new JsiSkSurface(CanvasKit, surface);\n this._canvas = this._surface.getCanvas();\n this.redraw();\n }\n // Call onLayout callback if it exists\n if (this.props.onLayout) {\n this.props.onLayout(evt);\n }\n }\n\n protected getSize() {\n return { width: this.width, height: this.height };\n }\n\n componentDidMount() {\n // Start render loop\n this.tick();\n }\n\n componentDidUpdate() {\n this.redraw();\n }\n\n componentWillUnmount() {\n this.unsubscribeAll();\n cancelAnimationFrame(this.requestId);\n // eslint-disable-next-line max-len\n // https://stackoverflow.com/questions/23598471/how-do-i-clean-up-and-unload-a-webgl-canvas-context-from-gpu-after-use\n // https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_lose_context\n // We delete the context, only if the context has been intialized\n if (this._surface) {\n this._canvasRef.current\n ?.getContext(\"webgl2\")\n ?.getExtension(\"WEBGL_lose_context\")\n ?.loseContext();\n }\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n this._canvas!.clear(CanvasKit.TRANSPARENT);\n this.renderInCanvas(this._canvas!);\n this._surface?.ref.flush();\n return this._surface?.makeImageSnapshot(rect);\n }\n\n /**\n * Override to render\n */\n protected abstract renderInCanvas(canvas: SkCanvas): void;\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n private tick() {\n if (this._mode === \"continuous\" || this._redrawRequests > 0) {\n this._redrawRequests = 0;\n if (this._canvas) {\n const canvas = this._canvas!;\n canvas.clear(Float32Array.of(0, 0, 0, 0));\n canvas.save();\n canvas.scale(pd, pd);\n this.renderInCanvas(canvas);\n canvas.restore();\n this._surface?.ref.flush();\n }\n }\n this.requestId = requestAnimationFrame(this.tick.bind(this));\n }\n\n public redraw() {\n this._redrawRequests++;\n }\n\n /**\n * Updates the drawing mode for the skia view. This is the same\n * as declaratively setting the mode property on the SkiaView.\n * There are two drawing modes, \"continuous\" and \"default\",\n * where the continuous mode will continuously redraw the view and\n * the default mode will only redraw when any of the regular react\n * properties are changed like size and margins.\n * @param mode Drawing mode to use.\n */\n public setDrawMode(mode: DrawMode) {\n this._mode = mode;\n this.tick();\n }\n\n private onLayout = this.onLayoutEvent.bind(this);\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <Platform.View {...viewProps} onLayout={this.onLayout}>\n <canvas ref={this._canvasRef} style={{ display: \"flex\", flex: 1 }} />\n </Platform.View>\n );\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAAuC,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,SAAA,WAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,CAAA,aAAAP,CAAA,MAAAA,CAAA,GAAAQ,SAAA,CAAAC,MAAA,EAAAT,CAAA,UAAAU,CAAA,GAAAF,SAAA,CAAAR,CAAA,YAAAW,CAAA,IAAAD,CAAA,OAAAE,cAAA,CAAAC,IAAA,CAAAH,CAAA,EAAAC,CAAA,MAAAJ,CAAA,CAAAI,CAAA,IAAAD,CAAA,CAAAC,CAAA,aAAAJ,CAAA,KAAAJ,QAAA,CAAAW,KAAA,OAAAN,SAAA;AAAA,SAAAO,gBAAAf,CAAA,EAAAW,CAAA,EAAAD,CAAA,YAAAC,CAAA,GAAAK,cAAA,CAAAL,CAAA,MAAAX,CAAA,GAAAI,MAAA,CAAAa,cAAA,CAA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E,eAAA,GAAAA,eAAA","ignoreList":[]}
|
@@ -24,19 +24,12 @@ class SkiaDomView extends _react.default.Component {
|
|
24
24
|
this._nativeId = _SkiaViewNativeId.SkiaViewNativeId.current++;
|
25
25
|
const {
|
26
26
|
root,
|
27
|
-
onTouch,
|
28
27
|
onSize
|
29
28
|
} = props;
|
30
29
|
if (root) {
|
31
30
|
assertSkiaViewApi();
|
32
31
|
_api.SkiaViewApi.setJsiProperty(this._nativeId, "root", root);
|
33
32
|
}
|
34
|
-
if (onTouch) {
|
35
|
-
assertSkiaViewApi();
|
36
|
-
console.warn(`The onTouch property is deprecated and will be removed in the next Skia release.
|
37
|
-
See: https://shopify.github.io/react-native-skia/docs/animations/gestures`);
|
38
|
-
_api.SkiaViewApi.setJsiProperty(this._nativeId, "onTouch", onTouch);
|
39
|
-
}
|
40
33
|
if (onSize) {
|
41
34
|
assertSkiaViewApi();
|
42
35
|
_api.SkiaViewApi.setJsiProperty(this._nativeId, "onSize", onSize);
|
@@ -48,17 +41,12 @@ See: https://shopify.github.io/react-native-skia/docs/animations/gestures`);
|
|
48
41
|
componentDidUpdate(prevProps) {
|
49
42
|
const {
|
50
43
|
root,
|
51
|
-
onTouch,
|
52
44
|
onSize
|
53
45
|
} = this.props;
|
54
46
|
if (root !== prevProps.root) {
|
55
47
|
assertSkiaViewApi();
|
56
48
|
_api.SkiaViewApi.setJsiProperty(this._nativeId, "root", root);
|
57
49
|
}
|
58
|
-
if (onTouch !== prevProps.onTouch) {
|
59
|
-
assertSkiaViewApi();
|
60
|
-
_api.SkiaViewApi.setJsiProperty(this._nativeId, "onTouch", onTouch);
|
61
|
-
}
|
62
50
|
if (onSize !== prevProps.onSize) {
|
63
51
|
assertSkiaViewApi();
|
64
52
|
_api.SkiaViewApi.setJsiProperty(this._nativeId, "onSize", onSize);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_Platform","_SkiaDomViewNativeComponent","_api","_SkiaViewNativeId","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","_defineProperty","_toPropertyKey","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","NativeSkiaDomView","Platform","OS","SkiaDomViewNativeComponent","SkiaDomView","React","Component","constructor","props","_nativeId","SkiaViewNativeId","current","root","
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_Platform","_SkiaDomViewNativeComponent","_api","_SkiaViewNativeId","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","_defineProperty","_toPropertyKey","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","NativeSkiaDomView","Platform","OS","SkiaDomViewNativeComponent","SkiaDomView","React","Component","constructor","props","_nativeId","SkiaViewNativeId","current","root","onSize","assertSkiaViewApi","SkiaViewApi","setJsiProperty","nativeId","componentDidUpdate","prevProps","makeImageSnapshot","rect","makeImageSnapshotAsync","redraw","requestRedraw","render","mode","debug","viewProps","createElement","collapsable","nativeID","exports","Error"],"sources":["SkiaDomView.tsx"],"sourcesContent":["import React from \"react\";\nimport type { HostComponent } from \"react-native\";\n\nimport type { SkRect } from \"../skia/types\";\nimport { Platform } from \"../Platform\";\nimport SkiaDomViewNativeComponent from \"../specs/SkiaDomViewNativeComponent\";\n\nimport { SkiaViewApi } from \"./api\";\nimport type { SkiaDomViewProps } from \"./types\";\nimport { SkiaViewNativeId } from \"./SkiaViewNativeId\";\n\nconst NativeSkiaDomView: HostComponent<SkiaDomViewProps> =\n Platform.OS !== \"web\"\n ? SkiaDomViewNativeComponent\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (null as any);\n\nexport class SkiaDomView extends React.Component<SkiaDomViewProps> {\n constructor(props: SkiaDomViewProps) {\n super(props);\n this._nativeId = SkiaViewNativeId.current++;\n const { root, onSize } = props;\n if (root) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"root\", root);\n }\n if (onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n }\n\n private _nativeId: number;\n\n public get nativeId() {\n return this._nativeId;\n }\n\n componentDidUpdate(prevProps: SkiaDomViewProps) {\n const { root, onSize } = this.props;\n if (root !== prevProps.root) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"root\", root);\n }\n if (onSize !== prevProps.onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshotAsync(rect?: SkRect) {\n assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshotAsync(this._nativeId, rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n public redraw() {\n assertSkiaViewApi();\n SkiaViewApi.requestRedraw(this._nativeId);\n }\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <NativeSkiaDomView\n collapsable={false}\n nativeID={`${this._nativeId}`}\n mode={mode}\n debug={debug}\n {...viewProps}\n />\n );\n }\n}\n\nconst assertSkiaViewApi = () => {\n if (\n SkiaViewApi === null ||\n SkiaViewApi.setJsiProperty === null ||\n SkiaViewApi.requestRedraw === null ||\n SkiaViewApi.makeImageSnapshot === null\n ) {\n throw Error(\"Skia View Api was not found.\");\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,2BAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAA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CAACC,IAAa,EAAE;IACtCP,iBAAiB,CAAC,CAAC;IACnB,OAAOC,gBAAW,CAACK,iBAAiB,CAAC,IAAI,CAACX,SAAS,EAAEY,IAAI,CAAC;EAC5D;;EAEA;AACF;AACA;AACA;AACA;EACSC,sBAAsBA,CAACD,IAAa,EAAE;IAC3CP,iBAAiB,CAAC,CAAC;IACnB,OAAOC,gBAAW,CAACO,sBAAsB,CAAC,IAAI,CAACb,SAAS,EAAEY,IAAI,CAAC;EACjE;;EAEA;AACF;AACA;EACSE,MAAMA,CAAA,EAAG;IACdT,iBAAiB,CAAC,CAAC;IACnBC,gBAAW,CAACS,aAAa,CAAC,IAAI,CAACf,SAAS,CAAC;EAC3C;EAEAgB,MAAMA,CAAA,EAAG;IACP,MAAM;MAAEC,IAAI;MAAEC,KAAK,GAAG,KAAK;MAAE,GAAGC;IAAU,CAAC,GAAG,IAAI,CAACpB,KAAK;IACxD,oBACE5C,MAAA,CAAAS,OAAA,CAAAwD,aAAA,CAAC7B,iBAAiB,EAAA1B,QAAA;MAChBwD,WAAW,EAAE,KAAM;MACnBC,QAAQ,EAAE,GAAG,IAAI,CAACtB,SAAS,EAAG;MAC9BiB,IAAI,EAAEA,IAAK;MACXC,KAAK,EAAEA;IAAM,GACTC,SAAS,CACd,CAAC;EAEN;AACF;AAACI,OAAA,CAAA5B,WAAA,GAAAA,WAAA;AAED,MAAMU,iBAAiB,GAAGA,CAAA,KAAM;EAC9B,IACEC,gBAAW,KAAK,IAAI,IACpBA,gBAAW,CAACC,cAAc,KAAK,IAAI,IACnCD,gBAAW,CAACS,aAAa,KAAK,IAAI,IAClCT,gBAAW,CAACK,iBAAiB,KAAK,IAAI,EACtC;IACA,MAAMa,KAAK,CAAC,8BAA8B,CAAC;EAC7C;AACF,CAAC","ignoreList":[]}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { SkCanvas } from "../skia/types";
|
2
2
|
import { SkiaBaseWebView } from "./SkiaBaseWebView";
|
3
|
-
import type { SkiaDomViewProps
|
3
|
+
import type { SkiaDomViewProps } from "./types";
|
4
4
|
export declare class SkiaDomView extends SkiaBaseWebView<SkiaDomViewProps> {
|
5
5
|
constructor(props: SkiaDomViewProps);
|
6
|
-
protected renderInCanvas(canvas: SkCanvas
|
6
|
+
protected renderInCanvas(canvas: SkCanvas): void;
|
7
7
|
}
|
@@ -11,12 +11,7 @@ class SkiaDomView extends _SkiaBaseWebView.SkiaBaseWebView {
|
|
11
11
|
constructor(props) {
|
12
12
|
super(props);
|
13
13
|
}
|
14
|
-
renderInCanvas(canvas
|
15
|
-
if (this.props.onTouch) {
|
16
|
-
console.warn(`The onTouch property is deprecated and will be removed in the next Skia release.
|
17
|
-
See: https://shopify.github.io/react-native-skia/docs/animations/gestures`);
|
18
|
-
this.props.onTouch([touches]);
|
19
|
-
}
|
14
|
+
renderInCanvas(canvas) {
|
20
15
|
if (this.props.onSize) {
|
21
16
|
const {
|
22
17
|
width,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_skia","require","_DrawingContext","_SkiaBaseWebView","SkiaDomView","SkiaBaseWebView","constructor","props","renderInCanvas","canvas","
|
1
|
+
{"version":3,"names":["_skia","require","_DrawingContext","_SkiaBaseWebView","SkiaDomView","SkiaBaseWebView","constructor","props","renderInCanvas","canvas","onSize","width","height","getSize","value","root","ctx","JsiDrawingContext","Skia","render","exports"],"sources":["SkiaDomView.web.tsx"],"sourcesContent":["import { Skia } from \"../skia\";\nimport type { SkCanvas } from \"../skia/types\";\nimport { JsiDrawingContext } from \"../dom/types/DrawingContext\";\n\nimport { SkiaBaseWebView } from \"./SkiaBaseWebView\";\nimport type { SkiaDomViewProps } from \"./types\";\n\nexport class SkiaDomView extends SkiaBaseWebView<SkiaDomViewProps> {\n constructor(props: SkiaDomViewProps) {\n super(props);\n }\n\n protected renderInCanvas(canvas: SkCanvas): void {\n if (this.props.onSize) {\n const { width, height } = this.getSize();\n this.props.onSize.value = { width, height };\n }\n if (this.props.root) {\n const ctx = new JsiDrawingContext(Skia, canvas);\n this.props.root.render(ctx);\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAF,OAAA;AAGO,MAAMG,WAAW,SAASC,gCAAe,CAAmB;EACjEC,WAAWA,CAACC,KAAuB,EAAE;IACnC,KAAK,CAACA,KAAK,CAAC;EACd;EAEUC,cAAcA,CAACC,MAAgB,EAAQ;IAC/C,IAAI,IAAI,CAACF,KAAK,CAACG,MAAM,EAAE;MACrB,MAAM;QAAEC,KAAK;QAAEC;MAAO,CAAC,GAAG,IAAI,CAACC,OAAO,CAAC,CAAC;MACxC,IAAI,CAACN,KAAK,CAACG,MAAM,CAACI,KAAK,GAAG;QAAEH,KAAK;QAAEC;MAAO,CAAC;IAC7C;IACA,IAAI,IAAI,CAACL,KAAK,CAACQ,IAAI,EAAE;MACnB,MAAMC,GAAG,GAAG,IAAIC,iCAAiB,CAACC,UAAI,EAAET,MAAM,CAAC;MAC/C,IAAI,CAACF,KAAK,CAACQ,IAAI,CAACI,MAAM,CAACH,GAAG,CAAC;IAC7B;EACF;AACF;AAACI,OAAA,CAAAhB,WAAA,GAAAA,WAAA","ignoreList":[]}
|
@@ -25,19 +25,12 @@ class SkiaJSDomView extends _react.default.Component {
|
|
25
25
|
this._nativeId = _SkiaViewNativeId.SkiaViewNativeId.current++;
|
26
26
|
const {
|
27
27
|
root,
|
28
|
-
onTouch,
|
29
28
|
onSize
|
30
29
|
} = props;
|
31
30
|
if (root) {
|
32
31
|
assertSkiaViewApi();
|
33
32
|
_api.SkiaViewApi.setJsiProperty(this._nativeId, "root", root);
|
34
33
|
}
|
35
|
-
if (onTouch) {
|
36
|
-
assertSkiaViewApi();
|
37
|
-
console.warn(`The onTouch property is deprecated and will be removed in the next Skia release.
|
38
|
-
See: https://shopify.github.io/react-native-skia/docs/animations/gestures`);
|
39
|
-
_api.SkiaViewApi.setJsiProperty(this._nativeId, "onTouch", onTouch);
|
40
|
-
}
|
41
34
|
if (onSize) {
|
42
35
|
assertSkiaViewApi();
|
43
36
|
_api.SkiaViewApi.setJsiProperty(this._nativeId, "onSize", onSize);
|
@@ -49,17 +42,12 @@ See: https://shopify.github.io/react-native-skia/docs/animations/gestures`);
|
|
49
42
|
componentDidUpdate(prevProps) {
|
50
43
|
const {
|
51
44
|
root,
|
52
|
-
onTouch,
|
53
45
|
onSize
|
54
46
|
} = this.props;
|
55
47
|
if (root !== prevProps.root && root !== undefined) {
|
56
48
|
assertSkiaViewApi();
|
57
49
|
this.draw();
|
58
50
|
}
|
59
|
-
if (onTouch !== prevProps.onTouch) {
|
60
|
-
assertSkiaViewApi();
|
61
|
-
_api.SkiaViewApi.setJsiProperty(this._nativeId, "onTouch", onTouch);
|
62
|
-
}
|
63
51
|
if (onSize !== prevProps.onSize) {
|
64
52
|
assertSkiaViewApi();
|
65
53
|
_api.SkiaViewApi.setJsiProperty(this._nativeId, "onSize", onSize);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_Platform","_SkiaPictureViewNativeComponent","_types","_api","_SkiaViewNativeId","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","_defineProperty","_toPropertyKey","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","NativeSkiaPictureView","Platform","OS","SkiaPictureViewNativeComponent","SkiaJSDomView","React","Component","constructor","props","_nativeId","SkiaViewNativeId","current","root","
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_Platform","_SkiaPictureViewNativeComponent","_types","_api","_SkiaViewNativeId","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","_defineProperty","_toPropertyKey","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","NativeSkiaPictureView","Platform","OS","SkiaPictureViewNativeComponent","SkiaJSDomView","React","Component","constructor","props","_nativeId","SkiaViewNativeId","current","root","onSize","assertSkiaViewApi","SkiaViewApi","setJsiProperty","nativeId","componentDidUpdate","prevProps","undefined","draw","makeImageSnapshot","rect","redraw","Skia","rec","PictureRecorder","canvas","beginRecording","ctx","JsiDrawingContext","render","picture","finishRecordingAsPicture","componentWillUnmount","mode","debug","viewProps","createElement","collapsable","nativeID","exports","requestRedraw","Error"],"sources":["SkiaJSDomView.tsx"],"sourcesContent":["import React from \"react\";\nimport type { HostComponent } from \"react-native\";\n\nimport type { Skia, SkRect } from \"../skia/types\";\nimport { Platform } from \"../Platform\";\nimport SkiaPictureViewNativeComponent from \"../specs/SkiaPictureViewNativeComponent\";\nimport { JsiDrawingContext } from \"../dom/types\";\n\nimport { SkiaViewApi } from \"./api\";\nimport type { SkiaPictureViewProps, SkiaDomViewProps } from \"./types\";\nimport { SkiaViewNativeId } from \"./SkiaViewNativeId\";\n\nconst NativeSkiaPictureView: HostComponent<SkiaPictureViewProps> =\n Platform.OS !== \"web\"\n ? SkiaPictureViewNativeComponent\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (null as any);\n\nexport class SkiaJSDomView extends React.Component<\n SkiaDomViewProps & { Skia: Skia }\n> {\n constructor(props: SkiaDomViewProps & { Skia: Skia }) {\n super(props);\n this._nativeId = SkiaViewNativeId.current++;\n const { root, onSize } = props;\n if (root) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"root\", root);\n }\n if (onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n }\n\n private _nativeId: number;\n\n public get nativeId() {\n return this._nativeId;\n }\n\n componentDidUpdate(prevProps: SkiaDomViewProps & { Skia: Skia }) {\n const { root, onSize } = this.props;\n if (root !== prevProps.root && root !== undefined) {\n assertSkiaViewApi();\n this.draw();\n }\n if (onSize !== prevProps.onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n public redraw() {\n assertSkiaViewApi();\n this.draw();\n //SkiaViewApi.requestRedraw(this._nativeId);\n }\n\n private draw() {\n const { root, Skia } = this.props;\n if (root !== undefined) {\n assertSkiaViewApi();\n const rec = Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n const ctx = new JsiDrawingContext(Skia, canvas);\n root.render(ctx);\n const picture = rec.finishRecordingAsPicture();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", picture);\n }\n }\n\n /**\n * Clear up the dom node when unmounting to release resources.\n */\n componentWillUnmount(): void {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", null);\n }\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <NativeSkiaPictureView\n collapsable={false}\n nativeID={`${this._nativeId}`}\n mode={mode}\n debug={debug}\n {...viewProps}\n />\n );\n }\n}\n\nconst assertSkiaViewApi = () => {\n if (\n SkiaViewApi === null ||\n SkiaViewApi.setJsiProperty === null ||\n SkiaViewApi.requestRedraw === null ||\n SkiaViewApi.makeImageSnapshot === null\n ) {\n throw Error(\"Skia View Api was not found.\");\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,+BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEA,IAAAI,IAAA,GAAAJ,OAAA;AAEA,IAAAK,iBAAA,GAAAL,OAAA;AAAsD,SAAAD,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,G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iBAAiB,GAAGA,CAAA,KAAM;EAC9B,IACEC,gBAAW,KAAK,IAAI,IACpBA,gBAAW,CAACC,cAAc,KAAK,IAAI,IACnCD,gBAAW,CAAC4B,aAAa,KAAK,IAAI,IAClC5B,gBAAW,CAACO,iBAAiB,KAAK,IAAI,EACtC;IACA,MAAMsB,KAAK,CAAC,8BAA8B,CAAC;EAC7C;AACF,CAAC","ignoreList":[]}
|
@@ -36,15 +36,4 @@ Object.keys(_types).forEach(function (key) {
|
|
36
36
|
}
|
37
37
|
});
|
38
38
|
});
|
39
|
-
var _useTouchHandler = require("./useTouchHandler");
|
40
|
-
Object.keys(_useTouchHandler).forEach(function (key) {
|
41
|
-
if (key === "default" || key === "__esModule") return;
|
42
|
-
if (key in exports && exports[key] === _useTouchHandler[key]) return;
|
43
|
-
Object.defineProperty(exports, key, {
|
44
|
-
enumerable: true,
|
45
|
-
get: function () {
|
46
|
-
return _useTouchHandler[key];
|
47
|
-
}
|
48
|
-
});
|
49
|
-
});
|
50
39
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_SkiaPictureView","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_SkiaDomView","_types"
|
1
|
+
{"version":3,"names":["_SkiaPictureView","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_SkiaDomView","_types"],"sources":["index.ts"],"sourcesContent":["export * from \"./SkiaPictureView\";\nexport * from \"./SkiaDomView\";\nexport * from \"./types\";\n"],"mappings":";;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,gBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,gBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,gBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,YAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,YAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,YAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,YAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,MAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,MAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,MAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,MAAA,CAAAN,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
@@ -7,36 +7,11 @@ export type NativeSkiaViewProps = ViewProps & {
|
|
7
7
|
mode?: DrawMode;
|
8
8
|
debug?: boolean;
|
9
9
|
};
|
10
|
-
export declare enum TouchType {
|
11
|
-
Start = 0,
|
12
|
-
Active = 1,
|
13
|
-
End = 2,
|
14
|
-
Cancelled = 3
|
15
|
-
}
|
16
|
-
export interface TouchInfo {
|
17
|
-
x: number;
|
18
|
-
y: number;
|
19
|
-
force: number;
|
20
|
-
type: TouchType;
|
21
|
-
id: number;
|
22
|
-
timestamp: number;
|
23
|
-
}
|
24
10
|
export interface DrawingInfo {
|
25
11
|
width: number;
|
26
12
|
height: number;
|
27
13
|
timestamp: number;
|
28
|
-
touches: Array<Array<TouchInfo>>;
|
29
14
|
}
|
30
|
-
export type ExtendedTouchInfo = TouchInfo & {
|
31
|
-
velocityX: number;
|
32
|
-
velocityY: number;
|
33
|
-
};
|
34
|
-
export type TouchHandlers = {
|
35
|
-
onStart?: (touchInfo: TouchInfo) => void;
|
36
|
-
onActive?: (touchInfo: ExtendedTouchInfo) => void;
|
37
|
-
onEnd?: (touchInfo: ExtendedTouchInfo) => void;
|
38
|
-
};
|
39
|
-
export type TouchHandler = (touchInfo: Array<Array<TouchInfo>>) => void;
|
40
15
|
export interface ISkiaViewApi {
|
41
16
|
setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;
|
42
17
|
requestRedraw: (nativeId: number) => void;
|
@@ -68,5 +43,4 @@ export interface SkiaPictureViewProps extends SkiaBaseViewProps {
|
|
68
43
|
}
|
69
44
|
export interface SkiaDomViewProps extends SkiaBaseViewProps {
|
70
45
|
root?: RenderNode<GroupProps>;
|
71
|
-
onTouch?: TouchHandler;
|
72
46
|
}
|
@@ -3,12 +3,4 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.TouchType = void 0;
|
7
|
-
let TouchType = exports.TouchType = /*#__PURE__*/function (TouchType) {
|
8
|
-
TouchType[TouchType["Start"] = 0] = "Start";
|
9
|
-
TouchType[TouchType["Active"] = 1] = "Active";
|
10
|
-
TouchType[TouchType["End"] = 2] = "End";
|
11
|
-
TouchType[TouchType["Cancelled"] = 3] = "Cancelled";
|
12
|
-
return TouchType;
|
13
|
-
}({});
|
14
6
|
//# sourceMappingURL=types.js.map
|