"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../events/add-pointer-event.mjs.js"),n=require("../../utils/get-context-window.mjs.js"),s=require("./PanSession.mjs.js"),t=require("../../../../../motion-dom/dist/es/render/Feature.mjs.js"),o=require("../../../../../motion-utils/dist/es/noop.mjs.js"),r=require("../../../../../motion-dom/dist/es/frameloop/frame.mjs.js");const i=e=>(n,s)=>{e&&r.frame.update((()=>e(n,s)),!1,!0)};class a extends t.Feature{constructor(){super(...arguments),this.removePointerDownListener=o.noop}onPointerDown(e){this.session=new s.PanSession(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:n.getContextWindow(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:s,onPanEnd:t}=this.node.getProps();return{onSessionStart:i(e),onStart:i(n),onMove:i(s),onEnd:(e,n)=>{delete this.session,t&&r.frame.postRender((()=>t(e,n)))}}}mount(){this.removePointerDownListener=e.addPointerEvent(this.node.current,"pointerdown",(e=>this.onPointerDown(e)))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}exports.PanGesture=a;
//# sourceMappingURL=index.mjs.js.map
