import { ContinousBaseGesture } from './gesture' ; import { RotationGestureHandlerEventPayload } from '../RotationGestureHandler' ; import { GestureUpdateEvent } from '../gestureHandlerCommon' ; type RotationGestureChangeEventPayload = { rotationChange : number ; } ; function changeEventCalculator ( current , previous ? ) { 'worklet' ; let changePayload ; if ( previous === undefined ) { changePayload = { rotationChange : current . rotation , } ; } else { changePayload = { rotationChange : current . rotation - previous . rotation , } ; } return { ... current , ... changePayload } ; } export class RotationGesture extends ContinousBaseGesture < RotationGestureHandlerEventPayload , RotationGestureChangeEventPayload > { constructor ( ) { super ( ) ; this . handlerName = 'RotationGestureHandler' ; } onChange ( callback ) { this . handlers . changeEventCalculator = changeEventCalculator ; return super . onChange ( callback ) ; } } export type RotationGestureType = InstanceType < typeof RotationGesture > ;