import { ContinousBaseGesture } from './gesture' ; import { PinchGestureHandlerEventPayload } from '../PinchGestureHandler' ; import { GestureUpdateEvent } from '../gestureHandlerCommon' ; type PinchGestureChangeEventPayload = { scaleChange : number ; } ; function changeEventCalculator ( current , previous ? ) { 'worklet' ; let changePayload ; if ( previous === undefined ) { changePayload = { scaleChange : current . scale , } ; } else { changePayload = { scaleChange : current . scale / previous . scale , } ; } return { ... current , ... changePayload } ; } export class PinchGesture extends ContinousBaseGesture < PinchGestureHandlerEventPayload , PinchGestureChangeEventPayload > { constructor ( ) { super ( ) ; this . handlerName = 'PinchGestureHandler' ; } onChange ( callback ) { this . handlers . changeEventCalculator = changeEventCalculator ; return super . onChange ( callback ) ; } } export type PinchGestureType = InstanceType < typeof PinchGesture > ;