2 lines
28 KiB
JavaScript
2 lines
28 KiB
JavaScript
|
|
(self["webpackChunkcomplexes"]=self["webpackChunkcomplexes"]||[]).push([[421],{12952:function(e,l,a){var t="Expected a function",n=NaN,o="[object Symbol]",i=/^\s+|\s+$/g,s=/^[-+]0x[0-9a-f]+$/i,r=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt,d="object"==typeof a.g&&a.g&&a.g.Object===Object&&a.g,v="object"==typeof self&&self&&self.Object===Object&&self,f=d||v||Function("return this")(),g=Object.prototype,p=g.toString,C=Math.max,m=Math.min,h=function(){return f.Date.now()};function x(e,l,a){var n,o,i,s,r,u,c=0,d=!1,v=!1,f=!0;if("function"!=typeof e)throw new TypeError(t);function g(l){var a=n,t=o;return n=o=void 0,c=l,s=e.apply(t,a),s}function p(e){return c=e,r=setTimeout(k,l),d?g(e):s}function x(e){var a=e-u,t=e-c,n=l-a;return v?m(n,i-t):n}function _(e){var a=e-u,t=e-c;return void 0===u||a>=l||a<0||v&&t>=i}function k(){var e=h();if(_(e))return L(e);r=setTimeout(k,x(e))}function L(e){return r=void 0,f&&n?g(e):(n=o=void 0,s)}function y(){void 0!==r&&clearTimeout(r),c=0,n=u=o=r=void 0}function F(){return void 0===r?s:L(h())}function V(){var e=h(),a=_(e);if(n=arguments,o=this,u=e,a){if(void 0===r)return p(u);if(v)return r=setTimeout(k,l),g(u)}return void 0===r&&(r=setTimeout(k,l)),s}return l=w(l)||0,b(a)&&(d=!!a.leading,v="maxWait"in a,i=v?C(w(a.maxWait)||0,l):i,f="trailing"in a?!!a.trailing:f),V.cancel=y,V.flush=F,V}function b(e){var l=typeof e;return!!e&&("object"==l||"function"==l)}function _(e){return!!e&&"object"==typeof e}function k(e){return"symbol"==typeof e||_(e)&&p.call(e)==o}function w(e){if("number"==typeof e)return e;if(k(e))return n;if(b(e)){var l="function"==typeof e.valueOf?e.valueOf():e;e=b(l)?l+"":l}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(i,"");var a=r.test(e);return a||u.test(e)?c(e.slice(2),a?2:8):s.test(e)?n:+e}e.exports=x},71953:function(e,l,a){"use strict";a.r(l),a.d(l,{default:function(){return G}});a(44114);var t=a(56768),n=a(90144),o=a(76882),i=a(84961),s=a(24232),r=a(45130),u=a(12463),c=(a(17642),a(58004),a(33853),a(45876),a(32475),a(15024),a(31698),a(6017));function d(){const e=(0,n.KR)(null),l=(0,n.KR)(null),a=(0,n.KR)(null),o=(0,n.KR)(null),i=(0,n.KR)([]),s=(0,n.KR)(null),r=(0,n.KR)(null),u=(0,n.KR)(""),d=(0,n.KR)({isVisible:!1,figure:null,x:0,y:0});function v(t){if(e.value=t.target,l.value=e.value.getContext("2d"),!a.value||!l.value||!e.value)return;if(d.value.isVisible)return void(d.value.isVisible=!1);const n=t.clientX-e.value.getBoundingClientRect().left,o=t.clientY-e.value.getBoundingClientRect().top;null===s.value&&(s.value=[]),null!==s.value&&(s.value.push({x:n,y:o}),p(s.value)&&(c.A.$emit("canvas:figure-added",{points:s.value,background:"173, 169, 219"}),s.value=null)),x()}function f(t){if(e.value=t.target,l.value=e.value.getContext("2d"),t.preventDefault(),a.value&&l.value&&e.value){if(!(s.value&&s.value.length>0)){const a=t.clientX-e.value.getBoundingClientRect().left,n=t.clientY-e.value.getBoundingClientRect().top;for(const e of i.value){const t=C(e.points);l.value.isPointInPath(t,a,n)&&(u.value=e.id,d.value.isVisible=!0,d.value.figure=e,d.value.x=a,d.value.y=n)}return d.value}return s.value.pop(),x(),null}}function g(t){if(e.value=t.target,l.value=e.value.getContext("2d"),!a.value||!l.value||!e.value)return;const n=t.clientX-e.value.getBoundingClientRect().left,o=t.clientY-e.value.getBoundingClientRect().top;for(const e of i.value){const a=C(e.points);if(l.value.isPointInPath(a,n,o))return r.value=e.id,void x(!0,e.id)}r.value=null,x()}function p(e){if(e.length>=3){const l=e[0],a=e[e.length-1],t=Math.abs(l.x-a.x),n=Math.abs(l.y-a.y);return t<10&&n<10}return!1}function C(e){if(!e)return;const l=new Path2D;l.moveTo(e[0].x,e[0].y);for(let a=1;a<e.length;a++)l.lineTo(e[a].x,e[a].y);return l.closePath(),l}function m(e){const l=i.value.findIndex((l=>l.id===e));l>=0&&i.value.splice(l,1),localStorage.setItem("figures",JSON.stringify(i.value)),x()}(0,t.wB)(a,(()=>x()));const h=(t,n)=>{if(e.value=n,l.value=e.value.getContext("2d"),o.value=localStorage.getItem("imageSize")?JSON.parse(localStorage.getItem("imageSize")):null,i.value=localStorage.getItem("figures")?JSON.parse(localStorage.getI
|
||
|
|
//# sourceMappingURL=bd6b25afd59320fc.js.map
|