-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.js
1 lines (1 loc) · 18.7 KB
/
index.js
1
(function(){"use strict";var w=function(){var t=this,r=t.$createElement,e=t._self._c||r;return e("svg",{attrs:{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 500 500"}},[e("rect",{staticClass:"faded",attrs:{x:"139.61",y:"138.52",width:"220.78",height:"220.78",rx:"18",ry:"18"}}),e("path",{staticClass:"vibrant",attrs:{d:"M115.39,189.74a7.5,7.5,0,0,1-7.5-7.5v-43a32.54,32.54,0,0,1,32.5-32.5h43a7.5,7.5,0,0,1,0,15h-43a17.52,17.52,0,0,0-17.5,17.5v43A7.5,7.5,0,0,1,115.39,189.74Zm276.72-7.5v-43a32.54,32.54,0,0,0-32.5-32.5h-43a7.5,7.5,0,0,0,0,15h43a17.52,17.52,0,0,1,17.5,17.5v43a7.5,7.5,0,1,0,15,0Zm0,176.27v-43a7.5,7.5,0,1,0-15,0v43a17.52,17.52,0,0,1-17.5,17.5h-43a7.5,7.5,0,0,0,0,15h43A32.54,32.54,0,0,0,392.11,358.52Zm-201.27,25a7.5,7.5,0,0,0-7.5-7.5h-43a17.52,17.52,0,0,1-17.5-17.5v-43a7.5,7.5,0,0,0-15,0v43a32.54,32.54,0,0,0,32.5,32.5h43A7.5,7.5,0,0,0,190.84,383.52ZM287,241H257V211.9a7.5,7.5,0,0,0-15,0V241H213a7.5,7.5,0,0,0,0,15h29v29.9a7.5,7.5,0,0,0,15,0V256h30a7.5,7.5,0,0,0,0-15Z"}})])},b=[];function d(t,r,e,s,a,o,l,n){var i=typeof t=="function"?t.options:t;r&&(i.render=r,i.staticRenderFns=e,i._compiled=!0),s&&(i.functional=!0),o&&(i._scopeId="data-v-"+o);var c;if(l?(c=function(h){h=h||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!h&&typeof __VUE_SSR_CONTEXT__!="undefined"&&(h=__VUE_SSR_CONTEXT__),a&&a.call(this,h),h&&h._registeredComponents&&h._registeredComponents.add(l)},i._ssrRegister=c):a&&(c=n?function(){a.call(this,(i.functional?this.parent:this).$root.$options.shadowRoot)}:a),c)if(i.functional){i._injectStyles=c;var m=i.render;i.render=function(g,C){return c.call(C),m(g,C)}}else{var u=i.beforeCreate;i.beforeCreate=u?[].concat(u,c):[c]}return{exports:t,options:i}}const M={},f={};var z=d(M,w,b,!1,R,null,null,null);function R(t){for(let r in f)this[r]=f[r]}var A=function(){return z.exports}(),F=function(){var t=this,r=t.$createElement,e=t._self._c||r;return e("svg",{attrs:{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 500 500"}},[e("path",{staticClass:"faded",attrs:{d:"M371,178.55v142.9A56.41,56.41,0,0,0,322.34,370H179.42A56.43,56.43,0,0,0,131,321.46V178.55A56.44,56.44,0,0,0,179.43,130H322.35a46.59,46.59,0,0,1-.46-5.79c.08,1.85.32,4.11.58,6.11A56.53,56.53,0,0,0,371,178.55Z"}}),e("path",{staticClass:"vibrant",attrs:{d:"M179.39,385a56.42,56.42,0,0,0,.51-7.63c0-.12,0-.25,0-.37a55.73,55.73,0,0,0-.47-7H322c0,2.29-.29,4.62-.3,7,0,.12.07.25.07.37a56.37,56.37,0,0,0,.6,7.63ZM378.5,179H378a50.1,50.1,0,0,1-7-.48v142.9a55.85,55.85,0,0,1,7-.45h.26a54.89,54.89,0,0,1,7.74.52v-143A65,65,0,0,1,378.5,179Zm-56.62-55c0-.19,0-.38,0-.56s0-.65,0-1a63,63,0,0,1,.5-7.5h-143a55.06,55.06,0,0,1,.62,7.64V123a55.69,55.69,0,0,1-.57,7H322.35a46.59,46.59,0,0,1-.46-5.79A1.09,1.09,0,0,1,321.88,124ZM123.5,179H123a55.72,55.72,0,0,1-7-.48V321.46a55.72,55.72,0,0,1,7-.48h.5a58.09,58.09,0,0,1,7.5.49V178.55A58.08,58.08,0,0,1,123.5,179ZM392.31,83.61c-.52-.19-1-.61-1.56-.61h0a16.8,16.8,0,0,1-3.41-.84s0,0,0,0c-1-.21-1.91-.37-2.89-.52s-2-.24-3-.32l-1-.07c-.71,0-1.42,0-2.13,0-.92,0-1.84,0-2.75.1A41.48,41.48,0,0,0,337.63,115s0,.09,0,.14a41.19,41.19,0,0,0-.62,7.5v.6a37.61,37.61,0,0,0,.69,6.76s0,.09,0,.14a41.46,41.46,0,0,0,24.69,30.66l1.24.5c.89.34,1.8.65,2.72.93s2,.58,3.1.81c.52.12,1,.22,1.58.32v0c.85.16,1.71.28,2.58.38h0c.85.09,1.72.15,2.59.19.59,0,1.18,0,1.78,0h.26a41.19,41.19,0,0,0,7.5-.66l.24,0a41.45,41.45,0,0,0,6.31-79.69ZM386,147.87l-.24.08a26.16,26.16,0,0,1-7.5,1.09H378a25.69,25.69,0,0,1-7-1l-.24-.07A26.48,26.48,0,0,1,353,130.14c0-.05,0-.09,0-.14a26,26,0,0,1-1-7c0-.12,0-.24,0-.36a26.16,26.16,0,0,1,1.09-7.5c0-.05,0-.09,0-.14a26.39,26.39,0,1,1,33,32.87ZM164.27,115.14a.85.85,0,0,0-.06-.14A41.4,41.4,0,1,0,116,163.36a40.31,40.31,0,0,0,7,.67h.5a41.37,41.37,0,0,0,40.72-33.9c0-.05.07-.09.07-.14a38.45,38.45,0,0,0,.71-7v-.36A41.19,41.19,0,0,0,164.27,115.14ZM148.85,130s0,.09,0,.14A26.47,26.47,0,0,1,131,148a26.11,26.11,0,0,1-7.5,1.09H123a26.11,26.11,0,0,1-7-1.08,26.39,26.39,0,1,1,32.77-33s0,.09,0,.14a26.16,26.16,0,0,1,1.09,7.5c0,.12,0,.24,0,.36A26,26,0,0,1,148.85,130ZM386,336.7l-.24,0a42.1,42.1,0,0,0-7.5-.66H378a40.32,40.32,0,0,0-7,.62l-.24,0a41.5,41.5,0,0,0-33.21,33.21s0,.09,0,.13a37.59,37.59,0,0,0-.6,7v.37a41.2,41.2,0,0,0,.61,7.5s0,.09,0,.13A41.38,41.38,0,1,0,386,336.7Zm-7.74,67.06A26.44,26.44,0,0,1,353,385l0-.13a26.21,26.21,0,0,1-1.09-7.5c0-.12,0-.25,0-.37a26,26,0,0,1,1-7l0-.13a26.48,26.48,0,0,1,17.8-17.81L371,352a25.69,25.69,0,0,1,7-1h.26a26.16,26.16,0,0,1,7.5,1.09l.24.08a26.39,26.39,0,0,1-7.74,51.62ZM164.29,370h0s0,0,0,0,0,0,0,0A41.21,41.21,0,0,0,131,337h0c-2.43-1-4.93-.86-7.49-.86-.17,0-.34-.08-.51-.07a40.31,40.31,0,0,0-7,.62A41.38,41.38,0,1,0,164.19,385h0s.06-.09.07-.13a41.19,41.19,0,0,0,.73-7.5V377A38.45,38.45,0,0,0,164.29,370Zm-14.39,7.37a26.21,26.21,0,0,1-1.09,7.5l0,.13A26.39,26.39,0,1,1,116,352.06a26.11,26.11,0,0,1,7-1.08h.5a26.11,26.11,0,0,1,7.5,1.09,26.47,26.47,0,0,1,17.81,17.81l0,.13a26,26,0,0,1,1,7C149.9,377.12,149.9,377.25,149.9,377.37Z"}})])},S=[];const Z={},_={};var D=d(Z,F,S,!1,V,null,null,null);function V(t){for(let r in _)this[r]=_[r]}var H=function(){return D.exports}(),T=function(){var t=this,r=t.$createElement,e=t._self._c||r;return e("svg",{attrs:{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 500 500"}},[e("path",{staticClass:"faded",attrs:{d:"M374,198.11a54.07,54.07,0,0,1-58.88-3.72L276.91,232.6A31.46,31.46,0,1,1,266.31,222l38.15-38.15a54.08,54.08,0,0,1-4.24-59.17,134.32,134.32,0,0,0-145,29.48,134,134,0,1,0,218.76,44Z"}}),e("path",{staticClass:"vibrant",attrs:{d:"M355.37,354.27a149,149,0,1,1-45.69-241.9c-.16.14-.32.3-.48.46a52.45,52.45,0,0,0-4.75,5.43,53.73,53.73,0,0,0-4.23,6.41,134.32,134.32,0,0,0-145,29.48,134,134,0,1,0,218.76,44,52.49,52.49,0,0,0,6.39-4.25,54.84,54.84,0,0,0,5.23-4.6l.64-.66A149.27,149.27,0,0,1,355.37,354.27Zm24.8-177.92a41.9,41.9,0,0,1-3.49,4c-.62.62-1.25,1.21-1.9,1.78a40.46,40.46,0,0,1-6.14,4.48,41.47,41.47,0,0,1-44.44-1.25,40.66,40.66,0,0,1-6-5h0a40.68,40.68,0,0,1-4.63-5.52A41.51,41.51,0,0,1,311.78,130a41,41,0,0,1,4.46-6.16c.6-.69,1.24-1.38,1.9-2a42.93,42.93,0,0,1,3.81-3.37,41.39,41.39,0,0,1,58.22,57.94Zm-14.09-44a26.41,26.41,0,0,0-30-5.14,25.77,25.77,0,0,0-6.63,4.51q-.33.3-.66.63a26.37,26.37,0,0,0-4.37,31.54,25.93,25.93,0,0,0,4.37,5.79,26.19,26.19,0,0,0,6.36,4.69,26.49,26.49,0,0,0,25.82-.68,26.09,26.09,0,0,0,5.15-4c.25-.25.49-.5.71-.75a25.76,25.76,0,0,0,4.49-6.66A26.42,26.42,0,0,0,366.08,132.38ZM276.91,232.6A31.46,31.46,0,1,1,266.31,222l38.15-38.15a52.24,52.24,0,0,0,4.74,5.42,53.8,53.8,0,0,0,5.93,5.13Zm-11.24,11.25a16.46,16.46,0,1,0-4,16.7A16.33,16.33,0,0,0,265.67,243.85Z"}})])},B=[];const N={},v={};var j=d(N,T,B,!1,E,null,null,null);function E(t){for(let r in v)this[r]=v[r]}var W=function(){return j.exports}(),O=function(){var t=this,r=t.$createElement,e=t._self._c||r;return e("svg",{attrs:{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 500 500"}},[e("title",[t._v("zoom")]),e("path",{staticClass:"vibrant",attrs:{d:"M230.89,330.14a99.76,99.76,0,1,1,99.76-99.76A99.87,99.87,0,0,1,230.89,330.14Zm0-184.52a84.76,84.76,0,1,0,84.76,84.76A84.85,84.85,0,0,0,230.89,145.63Z"}}),e("rect",{staticClass:"vibrant",attrs:{x:"318.47",y:"282.53",width:"20",height:"93.04",transform:"translate(-136.47 328.64) rotate(-45)"}}),e("rect",{staticClass:"vibrant",attrs:{x:"190.03",y:"221.27",width:"81.72",height:"18.22",transform:"translate(461.27 -0.51) rotate(90)"}}),e("rect",{staticClass:"vibrant",attrs:{x:"190.03",y:"221.27",width:"81.72",height:"18.22",transform:"translate(461.78 460.77) rotate(180)"}})])},X=[];const L={},p={};var P=d(L,O,X,!1,Y,null,null,null);function Y(t){for(let r in p)this[r]=p[r]}var I=function(){return P.exports}(),q=function(){var t=this,r=t.$createElement,e=t._self._c||r;return e("div",{class:["marker marker-pin",{dragging:t.current}],style:"top:"+t.top+";left:"+t.left+";",on:{mousedown:t.initPinDrag}},[e("div",{staticClass:"count"},[t._v(t._s(t.index+1))])])},U=[];const G={data(){return{}},props:{marker:Object,current:Boolean,index:Number},computed:{top:function(){return this.marker.y*100+"%"},left:function(){return this.marker.x*100+"%"}},methods:{initPinDrag(){this.$emit("initDragResize",{index:this.index,type:this.marker.type,drag:!0,resize:!1})}}},x={};var J=d(G,q,U,!1,K,null,null,null);function K(t){for(let r in x)this[r]=x[r]}var Q=function(){return J.exports}(),tt=function(){var t=this,r=t.$createElement,e=t._self._c||r;return e("div",{class:["marker marker-rect",{dragging:t.current}],style:"top:"+t.top+";left:"+t.left+";width:"+t.width+";height:"+t.height+";"},[e("div",{staticClass:"count"},[t._v(t._s(t.index+1))]),e("div",{staticClass:"resize-helpers"},[e("div",{staticClass:"handle top-left",on:{mousedown:function(s){return t.initResize("top-left")}}}),e("div",{staticClass:"handle top-right",on:{mousedown:function(s){return t.initResize("top-right")}}}),e("div",{staticClass:"handle bottom-left",on:{mousedown:function(s){return t.initResize("bottom-left")}}}),e("div",{staticClass:"handle bottom-right",on:{mousedown:function(s){return t.initResize("bottom-right")}}})])])},et=[];const rt={data(){return{}},props:{marker:Object,current:Boolean,index:Number},computed:{top:function(){return this.marker.y*100+"%"},left:function(){return this.marker.x*100+"%"},width:function(){return this.marker.w*100+"%"},height:function(){return this.marker.h*100+"%"}},methods:{initResize(t){this.$emit("initDragResize",{index:this.index,type:this.marker.type,drag:!1,resize:!0,handle:t})}}},y={};var st=d(rt,tt,et,!1,at,null,null,null);function at(t){for(let r in y)this[r]=y[r]}var it=function(){return st.exports}(),nt=function(){var t=this,r=t.$createElement,e=t._self._c||r;return e("div",{class:["marker marker-circle",{dragging:t.current}],style:"top:"+t.top+";left:"+t.left+";width:"+t.width+";height:"+t.height+";"},[e("div",{staticClass:"count"},[t._v(t._s(t.index+1))]),e("div",{staticClass:"resize-helpers",style:"transform: rotate("+t.computedRotate+"deg);"},[e("div",{staticClass:"handle top",on:{mousedown:t.initCircleResize}}),e("div",{staticClass:"handle center",on:{mousedown:t.initCircleDrag}})])])},ot=[];const lt={data(){return{}},props:{marker:Object,current:Boolean,index:Number,rotate:Number},computed:{computedRotate:function(){return this.rotate*1+90},top:function(){return this.marker.y*100+"%"},left:function(){return this.marker.x*100+"%"},width:function(){return this.marker.w*100+"%"},height:function(){return this.marker.h*100+"%"}},methods:{initCircleResize(){this.$emit("initDragResize",{index:this.index,type:this.marker.type,drag:!1,resize:!0})},initCircleDrag(){this.$emit("initDragResize",{index:this.index,type:this.marker.type,drag:!0,resize:!1})}}},$={};var ct=d(lt,nt,ot,!1,ht,null,null,null);function ht(t){for(let r in $)this[r]=$[r]}var dt=function(){return ct.exports}(),ut=function(){var t=this,r=t.$createElement,e=t._self._c||r;return e("div",{ref:"container",class:["annotator",{"annotator-disabled":t.disabled}],attrs:{"data-theme":t.theme,"data-color":t.currentColor},on:{mousemove:t.panImage}},[e("div",{staticClass:"annotator-background"}),t.src?t._e():e("div",{staticClass:"annotator-placeholder"},[e("div",{staticClass:"annotator-placeholder-ctn"},[t._v(" Please select an image ")])]),t.src?e("div",{staticClass:"annotator-toolbar"},[e("div",{staticClass:"annotator-toolbar-inner"},[t._l(t.tools,function(s){return e("div",{class:["tool",s,{selected:t.currentTool==s}],on:{click:function(a){return t.setTool(s)}}},[e("icon-"+s,{tag:"component"})],1)}),t.zoom?e("div",{class:["tool","zoom-button",{selected:t.fullsize}],on:{click:t.toggleFullsize}},[e("icon-zoom",{tag:"component"})],1):t._e(),e("div",{staticClass:"color"},[e("div",{staticClass:"color-selected blue",on:{click:t.toggleSelector}},[e("div",{staticClass:"circle"}),e("svg",{attrs:{viewBox:"0 0 16 16"}},[e("use",{attrs:{href:"#icon-angle-down"}})])]),t.showSelector?e("div",{staticClass:"color-selector"},[e("ul",{staticClass:"colors"},t._l(t.colors,function(s){return e("li",{class:["color-entry",s],on:{click:function(a){return t.setColor(s)}}},[e("div",{staticClass:"circle"})])}),0)]):t._e()])],2),t.debug?e("div",{staticClass:"annotator-toolbar-debug"},[e("div",{staticClass:"coord x"},[t._v(t._s(t.coords.x))]),e("div",{staticClass:"coord y"},[t._v(t._s(t.coords.y))])]):t._e()]):t._e(),t.src?e("div",{staticClass:"annotator-ctn",on:{mousemove:t.updateCoords}},[e("div",{class:["image",{fullsize:t.fullsize}]},[e("div",{staticClass:"image-ctn",style:t.customTransform},[e("div",{ref:"markers",staticClass:"markers",on:{mousemove:t.updateCoords,mousedown:t.addMarker,dblclick:t.addMarker}},t._l(t.markers,function(s,a){return e("marker-"+s.type,{key:a,tag:"component",attrs:{index:a,current:a==t.drag.index,marker:s,rotate:t.rotate},on:{initDragResize:t.initDragResize}})}),1),e("img",{ref:"image",attrs:{src:t.src}})])])]):t._e()])},mt=[],pt="";const gt={components:{markerPin:Q,markerRect:it,markerCircle:dt,iconPin:A,iconRect:H,iconCircle:W,iconZoom:I},data(){return{showSelector:!1,currentTool:"",manualColor:"",storedColor:"",rotate:0,src:"",coords:{x:0,y:0,xabs:0,yabs:0},drag:{index:Number,type:String,isDragging:!1,isResizing:!1,handle:String,xref:Number,yref:Number,wref:Number,href:Number,maxRadius:Number},markers:[],customTransform:void 0,fullsize:!1,translate:Boolean,tools:Array,colors:Array,theme:String,debug:Boolean,max:[Boolean,Number],zoom:Boolean,dblclick:Boolean,image:[Boolean,String]}},props:{storage:Object},computed:{currentColor(){return this.storedColor!=""?this.storedColor:this.manualColor},id(){return this.$store.state.content.current},pageValues(){return this.$store.getters["content/values"](this.id)},currentLanguage(){return this.$store.state.languages?this.$store.state.languages.current:this.$language},disabled(){return!this.translate&&!this.$panel.language.default}},created(){document.addEventListener("mouseup",this.stopDragging),this.load().then(t=>{this.tools=t.tools,this.colors=t.colors,this.theme=t.theme,this.debug=t.debug,this.storage=t.storage,this.max=t.max,this.translate=t.translate,this.dblclick=t.dblclick,t.image&&(this.src=t.image),this.currentTool=this.tools[0],this.manualColor=this.colors[0]})},watch:{pageValues:{immediate:!0,handler(){this.updateValues()}}},destroyed(){document.removeEventListener("mouseup",this.stopDragging)},methods:{panImage(t){if(!this.zoom||!this.fullsize)return!1;let r=this.$refs.container,e=r.getBoundingClientRect(),s=r.clientWidth,a=r.clientHeight,o=t.clientX-e.left,l=t.clientY-e.top,n=o/s,i=l/a,c=this.$refs.image,m=c.clientWidth,u=c.clientHeight,h=m>s?(m-s+150)*n-40:0,g=u>a?(u-a+150)*i-40:0;this.customTransform="transform: translate("+-h+"px,"+-g+"px)"},toggleFullsize(){if(!this.zoom)return!1;this.fullsize?(this.fullsize=!1,this.customTransform=void 0):this.fullsize=!0},toggleSelector(){this.showSelector=!this.showSelector},setColor(t){this.storage.color?(this.setValue(this.storage.color,t),this.updateColor()):this.manualColor=t,this.showSelector=!1},setTool(t){this.currentTool=t},updateCoords(t){let r=this.$refs.markers,e=r.getBoundingClientRect(),s=r.clientWidth,a=r.clientHeight,o=t.clientX-e.left,l=t.clientY-e.top,n=o/s,i=l/a;n=Math.max(0,Math.min(1,n.toFixed(4))),i=Math.max(0,Math.min(1,i.toFixed(4))),this.coords.x=n,this.coords.y=i,this.coords.xabs=o,this.coords.yabs=l,this.drag.isDragging&&this.dragMarker(t),this.drag.isResizing&&this.resizeMarker(t)},addMarker(t){if(t.target,t.target!=this.$refs.markers||this.max&&this.markers.length>=this.max||t.type=="mousedown"&&this.currentTool=="pin"&&this.dblclick)return!1;if(t.which!=1)return t.preventDefault(),!1;let r={type:this.currentTool,x:this.coords.x,y:this.coords.y,w:0,h:0};this.markers.push(r),this.drag.index=this.markers.length-1,this.drag.isResizing=!0,this.drag.type=this.currentTool,this.drag.handle="bottom-right",this.drag.xref=this.coords.x,this.drag.yref=this.coords.y,this.drag.maxRadius=this.getClosestSide(this.coords.xabs,this.coords.yabs)},getClosestSide(t,r){let e=this.$refs.markers,s=e.clientWidth,a=e.clientHeight,o=r,l=a-r,n=t,i=s-t;return Math.min(o,l,n,i)},dragMarker(t){let r=this.markers[this.drag.index];if(this.drag.type=="pin"&&(r.x=this.coords.x,r.y=this.coords.y),this.drag.type=="circle"){this.$refs.markers;let e=r.w/2,s=1-e,a=r.h/2,o=1-a,l=Math.min(s,Math.max(e,this.coords.x)),n=Math.min(o,Math.max(a,this.coords.y));r.x=l,r.y=n}},resizeMarker(t){let r=this.markers[this.drag.index];if(this.drag.type=="rect"){let e=parseFloat(r.x),s=parseFloat(r.y),a=parseFloat(r.w),o=parseFloat(r.h),l=parseFloat(this.drag.xref),n=parseFloat(this.drag.yref),i=parseFloat(this.drag.wref),c=parseFloat(this.drag.href);this.drag.handle=="bottom-right"?(a=this.coords.x-l,o=this.coords.y-n):this.drag.handle=="top-left"?(e=Math.min(l+i,this.coords.x),s=Math.min(n+c,this.coords.y),a=i+(l-e),o=c+(n-s)):this.drag.handle=="top-right"?(s=Math.min(n+c,this.coords.y),a=i+(this.coords.x-(l+i)),o=c+(n-s)):this.drag.handle=="bottom-left"&&(e=Math.min(l+i,this.coords.x),a=i+(l-e),o=this.coords.y-n),r.x=Math.max(0,Math.min(1,e.toFixed(4))),r.y=Math.max(0,Math.min(1,s.toFixed(4))),r.w=Math.max(0,Math.min(1,a.toFixed(4))),r.h=Math.max(0,Math.min(1,o.toFixed(4)))}else if(this.drag.type=="circle"){let e=this.$refs.markers,s=e.clientWidth,a=e.clientHeight,o=this.coords.xabs-this.drag.xref*s,l=this.coords.yabs-this.drag.yref*a,n=Math.sqrt(Math.pow(o,2)+Math.pow(l,2));n=Math.min(this.drag.maxRadius,n),n=n/s,o=n*2,l=o*s/a,r.w=o.toFixed(4),r.h=l.toFixed(4);let i=Math.atan2(this.coords.yabs-this.drag.yref*a,this.coords.xabs-this.drag.xref*s)*180/Math.PI;this.rotate=i.toFixed(4)}},initDragResize(t){if(this.drag.index=t.index,this.drag.isDragging=t.drag,this.drag.isResizing=t.resize,this.drag.type=t.type,t.resize){let r=this.$refs.markers,e=this.markers[this.drag.index];t.type=="circle"&&(this.drag.xref=e.x,this.drag.yref=e.y,this.drag.maxRadius=this.getClosestSide(e.x*r.clientWidth,e.y*r.clientHeight)),t.type=="rect"&&(this.drag.handle=t.handle,this.drag.xref=e.x,this.drag.yref=e.y,this.drag.wref=e.w,this.drag.href=e.h)}},stopDragging(t){if(!this.drag.isDragging&&!this.drag.isResizing)return!1;this.updateStructure(),this.drag.index=Number,this.drag.isDragging=!1,this.drag.isResizing=!1,this.drag.type=String,this.drag.handle=String,this.drag.maxRadius=Number,this.rotate=0},updateValues(){for(let t in this.pageValues){if(!Object.values(this.storage).includes(t))continue;let r=this.pageValues[t];this.setValue(t,r)}},setValue(t,r){try{for(let e in this.storage)if(this.storage[e]===t)switch(e){case"src":Array.isArray(r)?r.length?this.src=r[0].url:this.src="":this.src=r;break;case"color":this.storedColor=r;break;case"markers":if(!Array.isArray(r)){console.warn("could not adapt field to markers datapoint, not an array: ",r);break}this.markers=r;break;default:this[e]=r;break}}catch(e){console.warn(e)}},updateStructure(){this.storage.markers&&this.$store.dispatch("content/update",[this.storage.markers,this.markers,this.id])},updateColor(){this.storage.color&&this.$store.dispatch("content/update",[this.storage.color,this.storedColor,this.id])}}},k={};var ft=d(gt,ut,mt,!1,_t,null,null,null);function _t(t){for(let r in k)this[r]=k[r]}var vt=function(){return ft.exports}();panel.plugin("sylvainjule/annotator",{sections:{annotator:vt}})})();