import{Interactable as t}from"../../core/Interactable.prod.js";import o from"../../utils/is.prod.js";function e({interaction:t}){if("drag"!==t.prepared.name)return;const o=t.prepared.axis;"x"===o?(t.coords.cur.page.y=t.coords.start.page.y,t.coords.cur.client.y=t.coords.start.client.y,t.coords.velocity.client.y=0,t.coords.velocity.page.y=0):"y"===o&&(t.coords.cur.page.x=t.coords.start.page.x,t.coords.cur.client.x=t.coords.start.client.x,t.coords.velocity.client.x=0,t.coords.velocity.page.x=0)}function r({iEvent:t,interaction:o}){if("drag"!==o.prepared.name)return;const e=o.prepared.axis;if("x"===e||"y"===e){const r="x"===e?"y":"x";t.page[r]=o.coords.start.page[r],t.client[r]=o.coords.start.client[r],t.delta[r]=0}}const s={id:"actions/drag",install(t){const{actions:o,Interactable:e,defaults:r}=t;e.prototype.draggable=s.draggable,o.map.drag=s,o.methodDict.drag="draggable",r.actions.drag=s.defaults},listeners:{"interactions:before-action-move":e,"interactions:action-resume":e,"interactions:action-move":r,"auto-start:check"(t){const{interaction:o,interactable:e,buttons:r}=t,s=e.options.drag;if(s&&s.enabled&&(!o.pointerIsDown||!/mouse|pointer/.test(o.pointerType)||0!=(r&e.options.drag.mouseButtons)))return t.action={name:"drag",axis:"start"===s.lockAxis?s.startAxis:s.lockAxis},!1}},draggable(t){return o.object(t)?(this.options.drag.enabled=!1!==t.enabled,this.setPerAction("drag",t),this.setOnEvents("drag",t),/^(xy|x|y|start)$/.test(t.lockAxis)&&(this.options.drag.lockAxis=t.lockAxis),/^(xy|x|y)$/.test(t.startAxis)&&(this.options.drag.startAxis=t.startAxis),this):o.bool(t)?(this.options.drag.enabled=t,this):this.options.drag},beforeMove:e,move:r,defaults:{startAxis:"xy",lockAxis:"xy"},getCursor(){return"move"}};export default s; //# sourceMappingURL=plugin.prod.js.map