2 lines
20 KiB
JavaScript
2 lines
20 KiB
JavaScript
|
(this.webpackJsonpreact=this.webpackJsonpreact||[]).push([[0],{12:function(e,t,n){e.exports=n(18)},17:function(e,t,n){},18:function(e,t,n){"use strict";n.r(t);var r=n(1),a=n(2),o=n(4),l=n(3),i=n(5),c=n(11),s=n(6),u=n(9),f=n(0),h=n.n(f),d=n(8),v=n.n(d),m=n(7);function p(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t){t.sort((function(e,t){return e-t}));var n=!0;t.forEach((function(t,r){(n=n&&t===r)||p(e,t-1,t)}))}function y(e,t){var n=t.sort((function(e,t){return t-e})),r=!0;n.forEach((function(t,n){(r=r&&t===e.length-n-1)||p(e,t+1,t)}))}function w(e,t){t.sort((function(e,t){return e-t}));var n=t.map((function(t){return e[t]})),r=t.reverse().concat([0]);r.forEach((function(t,n){if(0!==n)for(var a=r[n-1]-1;a>=t;--a)e[a+n]=e[a]})),n.forEach((function(t,n){e[n]=t}))}function E(e,t){var n=t.sort((function(e,t){return t-e})),r=n.map((function(t){return e[t]}));(t=n.reverse().concat([e.length])).forEach((function(n,r){if(0!==r)for(var a=t[r-1]+1;a<n;++a)e[a-r]=e[a]})),r.forEach((function(t,n){e[e.length-n-1]=t}))}n(17);var x=Array.of(),k=!1,S=[];function C(){return JSON.stringify(x.map((function(e){return Object(u.a)({},e,{isSelected:!1})})))}function b(e){var t=JSON.parse(e);x.splice(0,x.length),t.forEach((function(e){I(e),x.push(e)})),k=!0}function M(){return Math.floor(Math.random()*Math.pow(2,31))}function B(e,t){var n=Math.random;Math.random=function(e){return function(){return(Math.pow(2,31)-1&(e=Math.imul(48271,e)))/Math.pow(2,31)}}(e);var r=t();return Math.random=n,r}function X(e,t,n,r,a,o){var l,i,c=a-n,s=o-r,u=c*c+s*s,f=-1;0!==u&&(f=((e-n)*c+(t-r)*s)/u),f<0?(l=n,i=r):f>1?(l=a,i=o):(l=n+f*c,i=r+f*s);var h=e-l,d=t-i;return Math.hypot(h,d)}function Y(e,t,n){if("ellipse"===e.type){var r=Math.abs(t-e.x-e.width/2),a=Math.abs(n-e.y-e.height/2),o=.707,l=.707,i=e.width/2,c=e.height/2;return[0,1,2,3].forEach((function(e){var t=i*o,n=c*l,s=(i*i-c*c)*Math.pow(o,3)/i,u=(c*c-i*i)*Math.pow(l,3)/c,f=t-s,h=n-u,d=r-s,v=a-u,m=Math.hypot(h,f),p=Math.hypot(v,d);o=Math.min(1,Math.max(0,(d*m/p+s)/i)),l=Math.min(1,Math.max(0,(v*m/p+u)/c));var g=Math.hypot(l,o);o/=g,l/=g})),Math.hypot(i*o-r,c*l-a)<10}if("rectangle"===e.type){var u=j(e),f=J(e),h=P(e),d=W(e);return X(t,n,u,h,f,h)<10||X(t,n,f,h,f,d)<10||X(t,n,f,d,u,d)<10||X(t,n,u,d,u,h)<10}if("arrow"===e.type){var v=z(e),m=Object(s.a)(v,8),p=m[0],g=m[1],y=m[2],w=m[3],E=m[4],x=m[5],k=m[6],S=m[7];return X(t-=e.x,n-=e.y,E,x,y,w)<10||X(t,n,p,g,y,w)<10||X(t,n,k,S,y,w)<10}if("text"===e.type){var C=j(e),b=J(e),M=P(e),B=W(e);return t>=C&&t<=b&&n>=M&&n<=B}if("selection"===e.type)return console.warn("This should not happen, we need to investigate why it does."),!1;throw new Error("Unimplemented type "+e.type)}function L(e,t,n,r){if("text"===e.type||"arrow"===e.type)return!1;var a=O(e,r),o=Object.keys(a).filter((function(e){var o=a[e];return t+r.scrollX>=o[0]&&t+r.scrollX<=o[0]+o[2]&&n+r.scrollY>=o[1]&&n+r.scrollY<=o[1]+o[3]}));return o.length>0&&o[0]}function D(e,t,n,r){var a=e*e/(e+Math.abs(n)),o={x:(n>0?0:e-a)+4,y:t-6-4,width:a-8,height:6},l=t*t/(t+Math.abs(r));return{horizontal:o,vertical:{x:e-6-4,y:(r>0?0:t-l)+4,width:6,height:l-12}}}function O(e,t){var n=e.x,r=e.x+e.width,a=e.y,o=e.y+e.height,l={},i=e.width<0?8:-8,c=e.height<0?8:-8;return Math.abs(r-n)>40&&(l.n=[n+(r-n)/2+t.scrollX-4,a-4+t.scrollY+c,8,8],l.s=[n+(r-n)/2+t.scrollX-4,o-4+t.scrollY-c,8,8]),Math.abs(o-a)>40&&(l.w=[n-4+t.scrollX+i,a+(o-a)/2+t.scrollY-4,8,8],l.e=[r-4+t.scrollX-i,a+(o-a)/2+t.scrollY-4,8,8]),l.nw=[n-4+t.scrollX+i,a-4+t.scrollY+c,8,8],l.ne=[r-4+t.scrollX-i,a-4+t.scrollY+c,8,8],l.sw=[n-4+t.scrollX+i,o-4+t.scrollY-c,8,8],l.se=[r-4+t.scrollX-i,o-4+t.scrollY-c,8,8],l}function U(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=r.offsetX,o=r.offsetY,l=r.renderScrollbars,i=void 0===l||l,c=r.renderSelection,s=void 0===c||c;if(t){var f=t.getContext("2d"),h=f.fillStyle;"string"===typeof n.viewBackgroundColor?(f.fillStyle=n.viewBackgroundColor,f.fillRect(0,0,t.width,t.height)):f.clearRect(0,0,t.width,t.height),f.fillStyle=h;var d=le();if(n=Object(u.a)({},n,{scrollX:"number"===typeof a?a:n.scrollX,scrollY:"numb
|
||
|
//# sourceMappingURL=main.3def8d06.chunk.js.map
|