"use strict";const t=require("../common/src/instantiationDecorator.js"),e=require("../common/config.js"),o=require("./props.js"),s=require("../common/utils.js"),i=require("../common/utils.wxs.js"),r=require("../../../../common/vendor.js"),n=require("../common/wechat.js"),c=`${e.prefix}-draggable`,h=t.uniComponent({name:c,options:{styleIsolation:"shared"},props:{...o.props},emits:["move","start","end"],data:()=>({prefix:e.prefix,classPrefix:c,tools:i.tools,systemInfo:n.getWindowInfo()}),mounted(){this.computedRect()},methods:{onTouchStart(t){const{systemInfo:e}=this;"none"!==this.direction&&(this.startX=t.touches[0].clientX+e.windowWidth-this.rect.right,this.startY=t.touches[0].clientY+e.windowHeight-this.rect.bottom,this.$emit("start",{startX:this.startX,startY:this.startY,rect:this.rect,e:t}))},onTouchMove(t){const{systemInfo:e}=this;if("none"===this.direction)return;let o=this.startX-t.touches[0].clientX,s=this.startY-t.touches[0].clientY;"vertical"===this.direction&&(o=e.windowWidth-this.rect.right),"horizontal"===this.direction&&(s=e.windowHeight-this.rect.bottom),this.$emit("move",{x:o,y:s,rect:this.rect,e:t})},async onTouchEnd(t){"none"!==this.direction&&(await this.computedRect(),this.$emit("end",{rect:this.rect,e:t}))},async computedRect(){this.rect={right:0,bottom:0,width:0,height:0};try{this.rect=await s.getRect(this,`.${this.classPrefix}`)}catch(t){}}}});const a=r._export_sfc(h,[["render",function(t,e,o,s,i,n){return{a:r.n(t.classPrefix),b:r.n(t.tClass),c:r.s(t.tools._style([t.customStyle])),d:r.o(((...e)=>t.onTouchStart&&t.onTouchStart(...e))),e:r.o(((...e)=>t.onTouchMove&&t.onTouchMove(...e))),f:r.o(((...e)=>t.onTouchEnd&&t.onTouchEnd(...e)))}}],["__scopeId","data-v-74d90c49"]]);wx.createComponent(a);
