import{e as r}from"./index-cf27e902.js";import{n as l,V as o}from"./index-b54f5418.js";import"./three-dc46505d.js";const n={"2d":{line:a=>({curve:"line",params:[a.point.x,a.point.y,a.point.x+1,a.point.y+1]}),arc:a=>({curve:"arc",params:[a.point.x,a.point.y,a.point.x+5,a.point.y-5,a.point.x+1,a.point.y+1]}),cubic:a=>({curve:"cubic",params:[a.point.x,a.point.y,a.point.x+5,a.point.y+5,a.point.x+5,a.point.y-5,a.point.x+1,a.point.y+1]}),quadratic:a=>({curve:"quadratic",params:[a.point.x,a.point.y,a.point.x+5,a.point.y+5,a.point.x+1,a.point.y+1]})},"3d":{line:a=>({curve:"line",params:[a.point.x,a.point.y,a.point.z,a.point.x+1,a.point.y+1,a.point.z+1]}),cubic:a=>({curve:"cubic",params:[a.point.x,a.point.y,a.point.z,a.point.x+5,a.point.y+5,a.point.z+5,a.point.x-5,a.point.y-5,a.point.z-5,a.point.x+1,a.point.y+1,a.point.z+1]}),quadratic:a=>({curve:"quadratic",params:[a.point.x,a.point.y,a.point.z,a.point.x+5,a.point.y+5,a.point.z+5,a.point.x+1,a.point.y+1,a.point.z+1]})}},h={"2d":{line:(a,i)=>{i.params[i.params.length-2]=a.point.x,i.params[i.params.length-1]=a.point.y},arc:(a,i)=>{i.params[2]=(i.params[0]+a.point.x)/2+10,i.params[3]=(i.params[1]+a.point.y)/2-5,i.params[i.params.length-2]=a.point.x,i.params[i.params.length-1]=a.point.y},cubic:(a,i)=>{const t=i.params.length;i.params[t-6]=i.params[0]+5,i.params[t-5]=i.params[1]+5,i.params[t-4]=a.point.x+5,i.params[t-3]=a.point.y-5,i.params[t-2]=a.point.x,i.params[t-1]=a.point.y},quadratic:(a,i)=>{const t=i.params.length;i.params[t-4]=(a.point.x+i.params[0])/2+5,i.params[t-3]=(a.point.y+i.params[1])/2+5,i.params[t-2]=a.point.x,i.params[t-1]=a.point.y}},"3d":{line:(a,i)=>{i.params[i.params.length-3]=a.point.x,i.params[i.params.length-2]=a.point.y,i.params[i.params.length-1]=a.point.z},cubic:(a,i)=>{const t=i.params.length;i.params[3]=i.params[0]+5,i.params[4]=i.params[1]+5,i.params[5]=i.params[2]+5,i.params[6]=a.point.x-5,i.params[7]=a.point.y-5,i.params[8]=a.point.z-5,i.params[t-3]=a.point.x,i.params[t-2]=a.point.y,i.params[t-1]=a.point.z},quadratic:(a,i)=>{const t=i.params.length;i.params[3]=(a.point.x+i.params[0])/2+5,i.params[4]=(a.point.y+i.params[1])/2+5,i.params[5]=(a.point.z+i.params[2])/2+5,i.params[t-3]=a.point.x,i.params[t-2]=a.point.y,i.params[t-1]=a.point.z}}};var d=function(){var a=this,i=a.$createElement,t=a._self._c||i;return t("div",{staticClass:"pathDrawing-container"},[a._l(a.curveList,function(p){return t("div",{directives:[{name:"tooltip",rawName:"v-tooltip",value:p.label,expression:"item.label"}],key:p.name,staticClass:"path-line-box",class:{"active-box":a.drawPen===p.name},on:{click:function(s){return a.$store.commit("path/drawPen",p.name)}}},[t("vis-icon",{attrs:{code:p.icon}})],1)}),t("div",{directives:[{name:"tooltip",rawName:"v-tooltip",value:"退出绘制",expression:"'退出绘制'"}],staticClass:"exist-path-box",on:{click:function(p){return a.$store.commit("path/draw",{status:!1,geometry:"",drawType:a.drawType})}}},[t("vis-icon",{attrs:{code:"#iconredo"}})],1)],2)},c=[];const y={data(){return{count:0}},computed:{draw(){return this.$store.getters["path/draw"]},drawPen(){return this.$store.getters["path/drawPen"]},drawGeometry(){return this.$store.getters["path/drawGeometry"]},drawPath(){return this.$store.getters["path/drawPath"]},drawType(){return this.$store.getters["path/drawType"]},curveList(){return this.drawType==="2d"?[{icon:"#iconzhexian",name:"line",label:"直线"},{icon:"#iconyuanhu",name:"arc",label:"圆弧"},{icon:"#iconercibeisaier",name:"quadratic",label:"二次贝塞尔"},{icon:"#iconsancibeisaier",name:"cubic",label:"三次贝塞尔"}]:[{icon:"#iconzhexian",name:"line",label:"直线"},{icon:"#iconercibeisaier",name:"quadratic",label:"二次贝塞尔"},{icon:"#iconsancibeisaier",name:"cubic",label:"三次贝塞尔"}]}},watch:{draw:{handler(a){const i=r.pathSketcher;a&&(r.selectionDisable=!0,i.addEventListener("write",t=>{this.drawPath.curves.push(o.observable(n[this.drawType][this.drawPen](t))),this.count+=1,this.drawGeometry.divisions=this.count*100}),i.addEventListener("move",t=>{const p=this.drawPath.curves[this.drawPath.curves.length-1];if(p.curve!==this.drawPen){this.drawPath.curves.pop();const s=o.observable(n[this.drawType][this.drawPen](t));s.params[0]=p.params[0],s.params[1]=p.params[1],this.drawType==="3d"&&(s.params[2]=p.params[2]),this.drawPath.curves.push(s)}h[this.drawType][this.drawPen](t,this.drawPath.curves[this.drawPath.curves.length-1])}),i.addEventListener("end",t=>{this.drawPath.curves.pop(),r.selectionDisable=!1}))},immediate:!0}}},m={};var e=l(y,d,c,!1,x,"1deb6ef6",null,null);function x(a){for(let i in m)this[i]=m[i]}const u=function(){return e.exports}();export{u as default};
