{"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,OAAA,aAAA,CAAA,aAAA,KAAYF,OAAL,GAAiBE,aAAAA;AACzB;AAED,WAAaI,eAAN,aAAA,qBAAA;EAAA,SAAA,CAAA,eAAA,EAAA,qBAAA;EAAA,IAAA,MAAA,GAAA,YAAA,CAAA,eAAA;EAILC,SAAAA,gBAAAA,EAAc;IAAA,IAAA,KAAA;IAAA,eAAA,OAAA,eAAA;IACZ,KAAA,GAAA,MAAA,CAAA,IAAA;IAEA,KAAA,CAAKC,WAAL,GAAmB,wBAAnB;IAAA,OAAA,KAAA;EACD;EAAA,YAAA,CAAA,eAAA;IAAA,GAAA;IAAA,KAAA,EAEDC,SAAAA,SACEC,QADM,EAMN;MAEA,IAAA,CAAKC,QAAL,CAAcZ,qBAAd,GAAsCA,qBAAtC;MACA,OAAA,IAAA,CAAA,eAAA,CAAA,eAAA,CAAA,SAAA,qBAAA,IAAA,OAAsBW,QAAtB;IACD;EAAA;EAAA,OAAA,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"}