You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
6.1 KiB
1 line
6.1 KiB
{"ast":null,"code":"import _classCallCheck from \"@babel/runtime/helpers/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/createClass\";\nimport _get from \"@babel/runtime/helpers/get\";\nimport _inherits from \"@babel/runtime/helpers/inherits\";\nimport _possibleConstructorReturn from \"@babel/runtime/helpers/possibleConstructorReturn\";\nimport _getPrototypeOf from \"@babel/runtime/helpers/getPrototypeOf\";\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nimport DiscreteGestureHandler from \"./DiscreteGestureHandler\";\nimport * as NodeManager from \"./NodeManager\";\nimport PressGestureHandler from \"./PressGestureHandler\";\nimport { TEST_MIN_IF_NOT_NAN, VEC_LEN_SQ } from \"./utils\";\nvar NativeViewGestureHandler = function (_PressGestureHandler) {\n _inherits(NativeViewGestureHandler, _PressGestureHandler);\n var _super = _createSuper(NativeViewGestureHandler);\n function NativeViewGestureHandler() {\n _classCallCheck(this, NativeViewGestureHandler);\n return _super.apply(this, arguments);\n }\n _createClass(NativeViewGestureHandler, [{\n key: \"isNative\",\n get: function get() {\n return true;\n }\n }, {\n key: \"onRawEvent\",\n value: function onRawEvent(ev) {\n var _this = this;\n _get(_getPrototypeOf(NativeViewGestureHandler.prototype), \"onRawEvent\", this).call(this, ev);\n if (!ev.isFinal) {\n if (TEST_MIN_IF_NOT_NAN(VEC_LEN_SQ({\n x: ev.deltaX,\n y: ev.deltaY\n }), 10)) {\n if (this.config.disallowInterruption) {\n var gestures = Object.values(NodeManager.getNodes()).filter(function (gesture) {\n var handlerTag = gesture.handlerTag,\n view = gesture.view,\n isGestureRunning = gesture.isGestureRunning;\n return handlerTag !== _this.handlerTag && isGestureRunning && gesture instanceof DiscreteGestureHandler && view && _this.view.contains(view);\n });\n for (var gesture of gestures) {\n gesture.forceInvalidate(ev);\n }\n }\n }\n }\n }\n }]);\n return NativeViewGestureHandler;\n}(PressGestureHandler);\nexport default NativeViewGestureHandler;","map":{"version":3,"sources":["NativeViewGestureHandler.ts"],"names":["DiscreteGestureHandler","NodeManager","PressGestureHandler","TEST_MIN_IF_NOT_NAN","VEC_LEN_SQ","NativeViewGestureHandler","isNative","onRawEvent","ev","isFinal","x","deltaX","y","deltaY","config","disallowInterruption","gestures","values","getNodes","filter","gesture","handlerTag","view","isGestureRunning","contains","forceInvalidate"],"mappings":";;;;;;;;AAAA,OAAOA,sBAAP;AAEA,OAAO,KAAKC,WAAZ;AACA,OAAOC,mBAAP;AACA,SAASC,mBAAT,EAA8BC,UAA9B;AAAA,IAEMC,wBAAN;EAAA;EAAA;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA,KACMC,eAAW;MACb,OAAO,IAAP;IACD;EAAA;IAAA;IAAA,OAEDC,oBAAWC,EAAD,EAAqB;MAAA;MAC7B,yFAAiBA,EAAjB;MACA,IAAI,CAACA,EAAE,CAACC,OAAR,EAAiB;QAEf,IAAIN,mBAAmB,CAACC,UAAU,CAAC;UAAEM,CAAC,EAAEF,EAAE,CAACG,MAAR;UAAgBC,CAAC,EAAEJ,EAAE,CAACK;QAAtB,CAAD,CAAX,EAA6C,EAA7C,CAAvB,EAAyE;UAEvE,IAAI,IAAA,CAAKC,MAAL,CAAYC,oBAAhB,EAAsC;YACpC,IAAMC,QAAQ,GAAG,MAAM,CAACC,MAAP,CAAchB,WAAW,CAACiB,QAAZjB,EAAd,CAAA,CAAsCkB,MAAtC,CACdC,UAAAA,OAAD,EAAa;cACX,IAAQC,UAAF,GAAyCD,OAA/C,CAAQC,UAAF;gBAAcC,IAAd,GAAyCF,OAA/C,CAAoBE,IAAd;gBAAoBC,gBAAAA,GAAqBH,OAA/C,CAA0BG,gBAAAA;cAC1B,OAEEF,UAAU,KAAK,KAAA,CAAKA,UAApBA,IAEAE,gBAFAF,IAIAD,OAAO,YAAYpB,sBAJnBqB,IAMAC,IANAD,IAQA,KAAA,CAAKC,IAAL,CAAUE,QAAV,CAAmBF,IAAnB,CAAA;YAEH,CAfc,CADmB;YAmBpC,KAAK,IAAMF,OAAX,IAAsBJ,QAAtB,EAAgC;cAE9BI,OAAO,CAACK,eAARL,CAAwBZ,EAAxBY,CAAAA;YACD;UACF;QACF;MACF;IACF;EAAA;EAAA;AAAA,EArCoClB,mBAAvC;AAwCA,eAAeG,wBAAf","sourcesContent":["import DiscreteGestureHandler from './DiscreteGestureHandler';\nimport { HammerInputExt } from './GestureHandler';\nimport * as NodeManager from './NodeManager';\nimport PressGestureHandler from './PressGestureHandler';\nimport { TEST_MIN_IF_NOT_NAN, VEC_LEN_SQ } from './utils';\n\nclass NativeViewGestureHandler extends PressGestureHandler {\n get isNative() {\n return true;\n }\n\n onRawEvent(ev: HammerInputExt) {\n super.onRawEvent(ev);\n if (!ev.isFinal) {\n // if (this.ref instanceof ScrollView) {\n if (TEST_MIN_IF_NOT_NAN(VEC_LEN_SQ({ x: ev.deltaX, y: ev.deltaY }), 10)) {\n // @ts-ignore FIXME(TS) config type\n if (this.config.disallowInterruption) {\n const gestures = Object.values(NodeManager.getNodes()).filter(\n (gesture) => {\n const { handlerTag, view, isGestureRunning } = gesture;\n return (\n // Check if this gesture isn't self\n handlerTag !== this.handlerTag &&\n // Ensure the gesture needs to be cancelled\n isGestureRunning &&\n // ScrollView can cancel discrete gestures like taps and presses\n gesture instanceof DiscreteGestureHandler &&\n // Ensure a view exists and is a child of the current view\n view &&\n // @ts-ignore FIXME(TS) view type\n this.view.contains(view)\n );\n }\n );\n // Cancel all of the gestures that passed the filter\n for (const gesture of gestures) {\n // TODO: Bacon: Send some cached event.\n gesture.forceInvalidate(ev);\n }\n }\n }\n }\n }\n}\n\nexport default NativeViewGestureHandler;\n"]},"metadata":{},"sourceType":"module"} |