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
5.5 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\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\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 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) { _defineProperty(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; }\nimport { ContinousBaseGesture } from \"./gesture\";\nfunction changeEventCalculator(current, previous) {\n 'worklet';\n\n var changePayload;\n if (previous === undefined) {\n changePayload = {\n rotationChange: current.rotation\n };\n } else {\n changePayload = {\n rotationChange: current.rotation - previous.rotation\n };\n }\n return _objectSpread(_objectSpread({}, current), changePayload);\n}\nexport var RotationGesture = function (_ContinousBaseGesture) {\n _inherits(RotationGesture, _ContinousBaseGesture);\n var _super = _createSuper(RotationGesture);\n function RotationGesture() {\n var _this;\n _classCallCheck(this, RotationGesture);\n _this = _super.call(this);\n _this.handlerName = 'RotationGestureHandler';\n return _this;\n }\n _createClass(RotationGesture, [{\n key: \"onChange\",\n value: function onChange(callback) {\n this.handlers.changeEventCalculator = changeEventCalculator;\n return _get(_getPrototypeOf(RotationGesture.prototype), \"onChange\", this).call(this, callback);\n }\n }]);\n return RotationGesture;\n}(ContinousBaseGesture);","map":{"version":3,"sources":["rotationGesture.ts"],"names":["ContinousBaseGesture","changeEventCalculator","current","previous","changePayload","undefined","rotationChange","rotation","RotationGesture","constructor","handlerName","onChange","callback","handlers"],"mappings":";;;;;;;;;;;AAAA,SAASA,oBAAT;AAQA,SAASC,qBAAT,CACEC,OADF,EAEEC,QAFF,EAGE;EACA,SAAA;;EACA,IAAIC,aAAJ;EACA,IAAID,QAAQ,KAAKE,SAAjB,EAA4B;IAC1BD,aAAa,GAAG;MACdE,cAAc,EAAEJ,OAAO,CAACK;IADV,CAAhBH;EAGD,CAJD,MAIO;IACLA,aAAa,GAAG;MACdE,cAAc,EAAEJ,OAAO,CAACK,QAARL,GAAmBC,QAAQ,CAACI;IAD9B,CAAhBH;EAGD;EAED,uCAAYF,OAAL,GAAiBE,aAAAA;AACzB;AAED,WAAaI,eAAN;EAAA;EAAA;EAILC,2BAAc;IAAA;IAAA;IACZ;IAEA,MAAKC,WAAL,GAAmB,wBAAnB;IAAA;EACD;EAAA;IAAA;IAAA,OAEDC,kBACEC,QADM,EAMN;MAEA,IAAA,CAAKC,QAAL,CAAcZ,qBAAd,GAAsCA,qBAAtC;MACA,qFAAsBW,QAAtB;IACD;EAAA;EAAA;AAAA,EApBkCZ,oBAA9B","sourcesContent":["import { ContinousBaseGesture } from './gesture';\nimport { RotationGestureHandlerEventPayload } from '../RotationGestureHandler';\nimport { GestureUpdateEvent } from '../gestureHandlerCommon';\n\ntype RotationGestureChangeEventPayload = {\n rotationChange: number;\n};\n\nfunction changeEventCalculator(\n current: GestureUpdateEvent<RotationGestureHandlerEventPayload>,\n previous?: GestureUpdateEvent<RotationGestureHandlerEventPayload>\n) {\n 'worklet';\n let changePayload: RotationGestureChangeEventPayload;\n if (previous === undefined) {\n changePayload = {\n rotationChange: current.rotation,\n };\n } else {\n changePayload = {\n rotationChange: current.rotation - previous.rotation,\n };\n }\n\n return { ...current, ...changePayload };\n}\n\nexport class RotationGesture extends ContinousBaseGesture<\n RotationGestureHandlerEventPayload,\n RotationGestureChangeEventPayload\n> {\n constructor() {\n super();\n\n this.handlerName = 'RotationGestureHandler';\n }\n\n onChange(\n callback: (\n event: GestureUpdateEvent<\n RotationGestureHandlerEventPayload & RotationGestureChangeEventPayload\n >\n ) => void\n ) {\n // @ts-ignore TS being overprotective, RotationGestureHandlerEventPayload is Record\n this.handlers.changeEventCalculator = changeEventCalculator;\n return super.onChange(callback);\n }\n}\n\nexport type RotationGestureType = InstanceType<typeof RotationGesture>;\n"]},"metadata":{},"sourceType":"module"}