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
18 KiB
1 line
18 KiB
{"ast":null,"code":"import _defineProperty2 from \"@babel/runtime/helpers/defineProperty\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/objectWithoutProperties\";\nimport _classCallCheck from \"@babel/runtime/helpers/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/assertThisInitialized\";\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\";\nvar _excluded = [\"enabled\"];\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty2(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\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; } }\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}\nimport { State } from \"../../State\";\nimport GestureHandler from \"./GestureHandler\";\nimport RotationGestureDetector from \"../detectors/RotationGestureDetector\";\nvar ROTATION_RECOGNITION_THRESHOLD = Math.PI / 36;\nvar RotationGestureHandler = function (_GestureHandler) {\n _inherits(RotationGestureHandler, _GestureHandler);\n var _super = _createSuper(RotationGestureHandler);\n function RotationGestureHandler() {\n var _this;\n _classCallCheck(this, RotationGestureHandler);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"rotation\", 0);\n _defineProperty(_assertThisInitialized(_this), \"velocity\", 0);\n _defineProperty(_assertThisInitialized(_this), \"cachedAnchorX\", 0);\n _defineProperty(_assertThisInitialized(_this), \"cachedAnchorY\", 0);\n _defineProperty(_assertThisInitialized(_this), \"rotationGestureListener\", {\n onRotationBegin: function onRotationBegin(_detector) {\n return true;\n },\n onRotation: function onRotation(detector) {\n var previousRotation = _this.rotation;\n _this.rotation += detector.getRotation();\n var delta = detector.getTimeDelta();\n if (delta > 0) {\n _this.velocity = (_this.rotation - previousRotation) / delta;\n }\n if (Math.abs(_this.rotation) >= ROTATION_RECOGNITION_THRESHOLD && _this.currentState === State.BEGAN) {\n _this.activate();\n }\n return true;\n },\n onRotationEnd: function onRotationEnd(_detector) {\n _this.end();\n }\n });\n _defineProperty(_assertThisInitialized(_this), \"rotationGestureDetector\", new RotationGestureDetector(_this.rotationGestureListener));\n return _this;\n }\n _createClass(RotationGestureHandler, [{\n key: \"init\",\n value: function init(ref, propsRef) {\n _get(_getPrototypeOf(RotationGestureHandler.prototype), \"init\", this).call(this, ref, propsRef);\n this.setShouldCancelWhenOutside(false);\n }\n }, {\n key: \"updateGestureConfig\",\n value: function updateGestureConfig(_ref) {\n var _ref$enabled = _ref.enabled,\n enabled = _ref$enabled === void 0 ? true : _ref$enabled,\n props = _objectWithoutProperties(_ref, _excluded);\n _get(_getPrototypeOf(RotationGestureHandler.prototype), \"updateGestureConfig\", this).call(this, _objectSpread({\n enabled: enabled\n }, props));\n }\n }, {\n key: \"transformNativeEvent\",\n value: function transformNativeEvent() {\n return {\n rotation: this.rotation ? this.rotation : 0,\n anchorX: this.getAnchorX(),\n anchorY: this.getAnchorY(),\n velocity: this.velocity ? this.velocity : 0\n };\n }\n }, {\n key: \"getAnchorX\",\n value: function getAnchorX() {\n var anchorX = this.rotationGestureDetector.getAnchorX();\n return anchorX ? anchorX : this.cachedAnchorX;\n }\n }, {\n key: \"getAnchorY\",\n value: function getAnchorY() {\n var anchorY = this.rotationGestureDetector.getAnchorY();\n return anchorY ? anchorY : this.cachedAnchorY;\n }\n }, {\n key: \"onPointerDown\",\n value: function onPointerDown(event) {\n this.tracker.addToTracker(event);\n _get(_getPrototypeOf(RotationGestureHandler.prototype), \"onPointerDown\", this).call(this, event);\n }\n }, {\n key: \"onPointerAdd\",\n value: function onPointerAdd(event) {\n this.tracker.addToTracker(event);\n _get(_getPrototypeOf(RotationGestureHandler.prototype), \"onPointerAdd\", this).call(this, event);\n this.tryBegin();\n this.rotationGestureDetector.onTouchEvent(event, this.tracker);\n }\n }, {\n key: \"onPointerMove\",\n value: function onPointerMove(event) {\n if (this.tracker.getTrackedPointersCount() < 2) {\n return;\n }\n if (this.getAnchorX()) {\n this.cachedAnchorX = this.getAnchorX();\n }\n if (this.getAnchorY()) {\n this.cachedAnchorY = this.getAnchorY();\n }\n this.tracker.track(event);\n this.rotationGestureDetector.onTouchEvent(event, this.tracker);\n _get(_getPrototypeOf(RotationGestureHandler.prototype), \"onPointerMove\", this).call(this, event);\n }\n }, {\n key: \"onPointerOutOfBounds\",\n value: function onPointerOutOfBounds(event) {\n if (this.tracker.getTrackedPointersCount() < 2) {\n return;\n }\n if (this.getAnchorX()) {\n this.cachedAnchorX = this.getAnchorX();\n }\n if (this.getAnchorY()) {\n this.cachedAnchorY = this.getAnchorY();\n }\n this.tracker.track(event);\n this.rotationGestureDetector.onTouchEvent(event, this.tracker);\n _get(_getPrototypeOf(RotationGestureHandler.prototype), \"onPointerOutOfBounds\", this).call(this, event);\n }\n }, {\n key: \"onPointerUp\",\n value: function onPointerUp(event) {\n _get(_getPrototypeOf(RotationGestureHandler.prototype), \"onPointerUp\", this).call(this, event);\n this.tracker.removeFromTracker(event.pointerId);\n this.rotationGestureDetector.onTouchEvent(event, this.tracker);\n if (this.currentState !== State.ACTIVE) {\n return;\n }\n if (this.currentState === State.ACTIVE) {\n this.end();\n } else {\n this.fail();\n }\n }\n }, {\n key: \"onPointerRemove\",\n value: function onPointerRemove(event) {\n _get(_getPrototypeOf(RotationGestureHandler.prototype), \"onPointerRemove\", this).call(this, event);\n this.rotationGestureDetector.onTouchEvent(event, this.tracker);\n this.tracker.removeFromTracker(event.pointerId);\n }\n }, {\n key: \"onPointerCancel\",\n value: function onPointerCancel(event) {\n _get(_getPrototypeOf(RotationGestureHandler.prototype), \"onPointerCancel\", this).call(this, event);\n this.end();\n this.reset();\n }\n }, {\n key: \"tryBegin\",\n value: function tryBegin() {\n if (this.currentState !== State.UNDETERMINED) {\n return;\n }\n this.begin();\n }\n }, {\n key: \"activate\",\n value: function activate(_force) {\n _get(_getPrototypeOf(RotationGestureHandler.prototype), \"activate\", this).call(this);\n }\n }, {\n key: \"onReset\",\n value: function onReset() {\n if (this.currentState === State.ACTIVE) {\n return;\n }\n this.rotation = 0;\n this.velocity = 0;\n this.rotationGestureDetector.reset();\n }\n }]);\n return RotationGestureHandler;\n}(GestureHandler);\nexport { RotationGestureHandler as default };","map":{"version":3,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,KAA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AgBhB,KAAD,EAA4B;MACnD,4FAAsBA,KAAtB;MACA,KAAKlB,GAAL;MAEA,KAAKmC,KAAL;IACD;EAAA;IAAA;IAAA,OAESb,oBAAiB;MACzB,IAAI,KAAK1B,YAAL,KAAsBpB,KAAK,CAAC4D,YAAhC,EAA8C;QAC5C;MACD;MAED,KAAKC,KAAL;IACD;EAAA;IAAA;IAAA,OAEMvC,kBAASwC,MAAD,EAAyB;MACtC;IACD;EAAA;IAAA;IAAA,OAESC,mBAAgB;MACxB,IAAI,KAAK3C,YAAL,KAAsBpB,KAAK,CAACuD,MAAhC,EAAwC;QACtC;MACD;MAED,KAAKzC,QAAL,GAAgB,CAAhB;MACA,KAAKI,QAAL,GAAgB,CAAhB;MACA,KAAKoB,uBAAL,CAA6BqB,KAA7B;IACD;EAAA;EAAA;AAAA,EAvKiD1D,cAArC;AAAA,SAAMK,sBAAN","names":["State","GestureHandler","RotationGestureDetector","ROTATION_RECOGNITION_THRESHOLD","Math","PI","RotationGestureHandler","args","_defineProperty","onRotationBegin","_detector","onRotation","detector","previousRotation","rotation","getRotation","delta","getTimeDelta","velocity","abs","currentState","BEGAN","activate","onRotationEnd","end","rotationGestureListener","init","ref","propsRef","setShouldCancelWhenOutside","updateGestureConfig","enabled","props","transformNativeEvent","anchorX","getAnchorX","anchorY","getAnchorY","rotationGestureDetector","cachedAnchorX","cachedAnchorY","onPointerDown","event","tracker","addToTracker","onPointerAdd","tryBegin","onTouchEvent","onPointerMove","getTrackedPointersCount","track","onPointerOutOfBounds","onPointerUp","removeFromTracker","pointerId","ACTIVE","fail","onPointerRemove","onPointerCancel","reset","UNDETERMINED","begin","_force","onReset"],"sources":["/Users/mathildejean/Documents/BUT/LaSuperMeteo/LaSuperMeteo/iut-expo-starter/node_modules/react-native-gesture-handler/lib/module/web/handlers/RotationGestureHandler.ts"],"sourcesContent":["import { State } from '../../State';\nimport { AdaptedEvent, Config } from '../interfaces';\n\nimport GestureHandler from './GestureHandler';\nimport RotationGestureDetector, {\n RotationGestureListener,\n} from '../detectors/RotationGestureDetector';\n\nconst ROTATION_RECOGNITION_THRESHOLD = Math.PI / 36;\n\nexport default class RotationGestureHandler extends GestureHandler {\n private rotation = 0;\n private velocity = 0;\n\n private cachedAnchorX = 0;\n private cachedAnchorY = 0;\n\n private rotationGestureListener: RotationGestureListener = {\n onRotationBegin: (_detector: RotationGestureDetector): boolean => true,\n onRotation: (detector: RotationGestureDetector): boolean => {\n const previousRotation: number = this.rotation;\n this.rotation += detector.getRotation();\n\n const delta = detector.getTimeDelta();\n\n if (delta > 0) {\n this.velocity = (this.rotation - previousRotation) / delta;\n }\n\n if (\n Math.abs(this.rotation) >= ROTATION_RECOGNITION_THRESHOLD &&\n this.currentState === State.BEGAN\n ) {\n this.activate();\n }\n\n return true;\n },\n onRotationEnd: (_detector: RotationGestureDetector): void => {\n this.end();\n },\n };\n\n private rotationGestureDetector: RotationGestureDetector =\n new RotationGestureDetector(this.rotationGestureListener);\n\n public init(ref: number, propsRef: React.RefObject<unknown>): void {\n super.init(ref, propsRef);\n\n this.setShouldCancelWhenOutside(false);\n }\n\n public updateGestureConfig({ enabled = true, ...props }: Config): void {\n super.updateGestureConfig({ enabled: enabled, ...props });\n }\n\n protected transformNativeEvent() {\n return {\n rotation: this.rotation ? this.rotation : 0,\n anchorX: this.getAnchorX(),\n anchorY: this.getAnchorY(),\n velocity: this.velocity ? this.velocity : 0,\n };\n }\n\n public getAnchorX(): number {\n const anchorX = this.rotationGestureDetector.getAnchorX();\n\n return anchorX ? anchorX : this.cachedAnchorX;\n }\n\n public getAnchorY(): number {\n const anchorY = this.rotationGestureDetector.getAnchorY();\n\n return anchorY ? anchorY : this.cachedAnchorY;\n }\n\n protected onPointerDown(event: AdaptedEvent): void {\n this.tracker.addToTracker(event);\n super.onPointerDown(event);\n }\n\n protected onPointerAdd(event: AdaptedEvent): void {\n this.tracker.addToTracker(event);\n super.onPointerAdd(event);\n\n this.tryBegin();\n this.rotationGestureDetector.onTouchEvent(event, this.tracker);\n }\n\n protected onPointerMove(event: AdaptedEvent): void {\n if (this.tracker.getTrackedPointersCount() < 2) {\n return;\n }\n\n if (this.getAnchorX()) {\n this.cachedAnchorX = this.getAnchorX();\n }\n if (this.getAnchorY()) {\n this.cachedAnchorY = this.getAnchorY();\n }\n\n this.tracker.track(event);\n\n this.rotationGestureDetector.onTouchEvent(event, this.tracker);\n\n super.onPointerMove(event);\n }\n\n protected onPointerOutOfBounds(event: AdaptedEvent): void {\n if (this.tracker.getTrackedPointersCount() < 2) {\n return;\n }\n\n if (this.getAnchorX()) {\n this.cachedAnchorX = this.getAnchorX();\n }\n if (this.getAnchorY()) {\n this.cachedAnchorY = this.getAnchorY();\n }\n\n this.tracker.track(event);\n\n this.rotationGestureDetector.onTouchEvent(event, this.tracker);\n\n super.onPointerOutOfBounds(event);\n }\n\n protected onPointerUp(event: AdaptedEvent): void {\n super.onPointerUp(event);\n this.tracker.removeFromTracker(event.pointerId);\n this.rotationGestureDetector.onTouchEvent(event, this.tracker);\n\n if (this.currentState !== State.ACTIVE) {\n return;\n }\n\n if (this.currentState === State.ACTIVE) {\n this.end();\n } else {\n this.fail();\n }\n }\n\n protected onPointerRemove(event: AdaptedEvent): void {\n super.onPointerRemove(event);\n this.rotationGestureDetector.onTouchEvent(event, this.tracker);\n this.tracker.removeFromTracker(event.pointerId);\n }\n\n protected onPointerCancel(event: AdaptedEvent): void {\n super.onPointerCancel(event);\n this.end();\n\n this.reset();\n }\n\n protected tryBegin(): void {\n if (this.currentState !== State.UNDETERMINED) {\n return;\n }\n\n this.begin();\n }\n\n public activate(_force?: boolean): void {\n super.activate();\n }\n\n protected onReset(): void {\n if (this.currentState === State.ACTIVE) {\n return;\n }\n\n this.rotation = 0;\n this.velocity = 0;\n this.rotationGestureDetector.reset();\n }\n}\n"]},"metadata":{},"sourceType":"module","externalDependencies":[]} |