mirror of
https://github.com/thepaperpilot/Planar-Pioneers.git
synced 2024-11-29 19:35:31 +00:00
2 lines
13 KiB
JavaScript
2 lines
13 KiB
JavaScript
import{w as Et}from"./wheel.f2ae740f.js";import{a as At}from"./amator.1e5a40c8.js";import{n as Zt}from"./ngraph.events.083734c6.js";var zt=Ot;function Ot(o,a,u){typeof u!="object"&&(u={});var c=typeof u.minVelocity=="number"?u.minVelocity:5,h=typeof u.amplitude=="number"?u.amplitude:.25,g=typeof u.cancelAnimationFrame=="function"?u.cancelAnimationFrame:Ft(),i=typeof u.requestAnimationFrame=="function"?u.requestAnimationFrame:Lt(),b,x,s=342,l,d,w,p,E,Z,A,T;return{start:L,stop:_,cancel:j};function j(){g(l),g(T)}function L(){b=o(),p=A=d=E=0,x=new Date,g(l),g(T),l=i($)}function $(){var B=Date.now(),F=B-x;x=B;var C=o(),M=C.x-b.x,N=C.y-b.y;b=C;var S=1e3/(1+F);d=.8*M*S+.2*d,E=.8*N*S+.2*E,l=i($)}function _(){g(l),g(T);var B=o();w=B.x,Z=B.y,x=Date.now(),(d<-c||d>c)&&(p=h*d,w+=p),(E<-c||E>c)&&(A=h*E,Z+=A),T=i(O)}function O(){var B=Date.now()-x,F=!1,C=0,M=0;p&&(C=-p*Math.exp(-B/s),C>.5||C<-.5?F=!0:C=p=0),A&&(M=-A*Math.exp(-B/s),M>.5||M<-.5?F=!0:M=A=0),F&&(a(w+C,Z+M),T=i(O))}}function Ft(){return typeof cancelAnimationFrame=="function"?cancelAnimationFrame:clearTimeout}function Lt(){return typeof requestAnimationFrame=="function"?requestAnimationFrame:function(o){return setTimeout(o,16)}}var Nt=Pt;function Pt(o){if(o)return{capture:Ve,release:Ve};var a,u,c,h=!1;return{capture:g,release:i};function g(b){h=!0,u=window.document.onselectstart,c=window.document.ondragstart,window.document.onselectstart=Ye,a=b,a.ondragstart=Ye}function i(){!h||(h=!1,window.document.onselectstart=u,a&&(a.ondragstart=c))}}function Ye(o){return o.stopPropagation(),!1}function Ve(){}var It=Rt;function Rt(){this.x=0,this.y=0,this.scale=1}var de={exports:{}};de.exports=qt;de.exports.canAttach=Ue;function qt(o,a){if(!Ue(o))throw new Error("svg element is required for svg.panzoom to work");var u=o.ownerSVGElement;if(!u)throw new Error("Do not apply panzoom to the root <svg> element. Use its child instead (e.g. <g></g>). As of March 2016 only FireFox supported transform on the root element");a.disableKeyboardInteraction||u.setAttribute("tabindex",0);var c={getBBox:g,getScreenCTM:i,getOwner:h,applyTransform:x,initTransform:b};return c;function h(){return u}function g(){var s=o.getBBox();return{left:s.x,top:s.y,width:s.width,height:s.height}}function i(){var s=u.getCTM();return s||u.getScreenCTM()}function b(s){var l=o.getCTM();l===null&&(l=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGMatrix()),s.x=l.e,s.y=l.f,s.scale=l.a,u.removeAttributeNS(null,"viewBox")}function x(s){o.setAttribute("transform","matrix("+s.scale+" 0 0 "+s.scale+" "+s.x+" "+s.y+")")}}function Ue(o){return o&&o.ownerSVGElement&&o.getCTM}var he={exports:{}};he.exports=Yt;he.exports.canAttach=He;function Yt(o,a){var u=He(o);if(!u)throw new Error("panzoom requires DOM element to be attached to the DOM tree");var c=o.parentElement;o.scrollTop=0,a.disableKeyboardInteraction||c.setAttribute("tabindex",0);var h={getBBox:i,getOwner:g,applyTransform:b};return h;function g(){return c}function i(){return{left:0,top:0,width:o.clientWidth,height:o.clientHeight}}function b(x){o.style.transformOrigin="0 0 0",o.style.transform="matrix("+x.scale+", 0, 0, "+x.scale+", "+x.x+", "+x.y+")"}}function He(o){return o&&o.parentElement&&o.style}var Xe=Et.exports,ve=At.exports,Vt=Zt,Xt=zt,Je=Nt,jt=Je(),$t=Je(!0),Kt=It,je=de.exports,$e=he.exports,Wt=1,Gt=1.75,Ke=300,We=200,tr=Qe;function Qe(o,a){a=a||{};var u=a.controller;if(u||(je.canAttach(o)?u=je(o,a):$e.canAttach(o)&&(u=$e(o,a))),!u)throw new Error("Cannot create panzoom for the current type of dom element");var c=u.getOwner(),h={x:0,y:0},g=!1,i=new Kt;u.initTransform&&u.initTransform(i);var b=typeof a.filterKey=="function"?a.filterKey:X,x=typeof a.pinchSpeed=="number"?a.pinchSpeed:1,s=a.bounds,l=typeof a.maxZoom=="number"?a.maxZoom:Number.POSITIVE_INFINITY,d=typeof a.minZoom=="number"?a.minZoom:0,w=typeof a.boundsPadding=="number"?a.boundsPadding:.05,p=typeof a.zoomDoubleClickSpeed=="number"?a.zoomDoubleClickSpeed:Gt,E=a.beforeWheel||X,Z=a.beforeMouseDown||X,A=typeof a.zoomSpeed=="number"?a.zoomSpeed:Wt,T=Ge(a.transformOrigin),j=a.enableTextSelection?$t:jt;_t(s),a.autocenter&&ot();var L,$=0,_=0,O=0,B=null,F=new Date,C,M=!1,N=!1,S,k,oe,ae,ie,D;"smoothScroll"in a&&!a.smoothScroll?D=Ut():D=Xt(dt,xt,a.smoothScroll);var ue,K,U,H=!1;Te();var J={dispose:wt,moveBy:R,moveTo:ce,smoothMoveTo:yt,centerOn:pt,zoomTo:re,zoomAbs:Q,smoothZoom:te,smoothZoomAbs:Bt,showRectangle:nt,pause:et,resume:tt,isPaused:rt,getTransform:at,getMinZoom:it,setMinZoom:ut,getMaxZoom:ct,setMaxZoom:ft,getTransformOrigin:lt,setTransformOrigin:st,getZoomSpeed:vt,setZoomSpeed:mt};Vt(J);var ge=typeof a.initialX=="number"?a.initialX:i.x,pe=typeof a.initialY=="number"?a.initialY:i.y,ye=typeof a.initialZoom=="number"?a.initialZoom:i.scale;return(ge!=i.x||pe!=i.y||ye!=i.scale)&&Q(ge,pe,ye),J;function et(){Se(),H=!0}function tt(){H&&(Te(),H=!1)}function rt(){return H}function nt(e){var t=c.getBoundingClientRect(),r=P(t.width,t.height),n=e.right-e.left,f=e.bottom-e.top;if(!Number.isFinite(n)||!Number.isFinite(f))throw new Error("Invalid rectangle");var v=r.x/n,m=r.y/f,y=Math.min(v,m);i.x=-(e.left+n/2)*y+r.x/2,i.y=-(e.top+f/2)*y+r.y/2,i.scale=y}function P(e,t){if(u.getScreenCTM){var r=u.getScreenCTM(),n=r.a,f=r.d,v=r.e,m=r.f;h.x=e*n-v,h.y=t*f-m}else h.x=e,h.y=t;return h}function ot(){var e,t,r=0,n=0,f=we();if(f)r=f.left,n=f.top,e=f.right-f.left,t=f.bottom-f.top;else{var v=c.getBoundingClientRect();e=v.width,t=v.height}var m=u.getBBox();if(!(m.width===0||m.height===0)){var y=t/m.height,Y=e/m.width,I=Math.min(Y,y);i.x=-(m.left+m.width/2)*I+e/2+r,i.y=-(m.top+m.height/2)*I+t/2+n,i.scale=I}}function at(){return i}function it(){return d}function ut(e){d=e}function ct(){return l}function ft(e){l=e}function lt(){return T}function st(e){T=Ge(e)}function vt(){return A}function mt(e){if(!Number.isFinite(e))throw new Error("Zoom speed should be a number");A=e}function dt(){return{x:i.x,y:i.y}}function ce(e,t){i.x=e,i.y=t,fe(),q("pan"),le()}function xe(e,t){ce(i.x+e,i.y+t)}function fe(){var e=we();if(!!e){var t=!1,r=ht(),n=e.left-r.right;return n>0&&(i.x+=n,t=!0),n=e.right-r.left,n<0&&(i.x+=n,t=!0),n=e.top-r.bottom,n>0&&(i.y+=n,t=!0),n=e.bottom-r.top,n<0&&(i.y+=n,t=!0),t}}function we(){if(!!s){if(typeof s=="boolean"){var e=c.getBoundingClientRect(),t=e.width,r=e.height;return{left:t*w,top:r*w,right:t*(1-w),bottom:r*(1-w)}}return s}}function ht(){var e=u.getBBox(),t=gt(e.left,e.top);return{left:t.x,top:t.y,right:e.width*i.scale+t.x,bottom:e.height*i.scale+t.y}}function gt(e,t){return{x:e*i.scale+i.x,y:t*i.scale+i.y}}function le(){g=!0,L=window.requestAnimationFrame(bt)}function be(e,t,r){if(me(e)||me(t)||me(r))throw new Error("zoom requires valid numbers");var n=i.scale*r;if(n<d){if(i.scale===d)return;r=d/i.scale}if(n>l){if(i.scale===l)return;r=l/i.scale}var f=P(e,t);if(i.x=f.x-r*(f.x-i.x),i.y=f.y-r*(f.y-i.y),s&&w===1&&d===1)i.scale*=r,fe();else{var v=fe();v||(i.scale*=r)}q("zoom"),le()}function Q(e,t,r){var n=r/i.scale;be(e,t,n)}function pt(e){var t=e.ownerSVGElement;if(!t)throw new Error("ui element is required to be within the scene");var r=e.getBoundingClientRect(),n=r.left+r.width/2,f=r.top+r.height/2,v=t.getBoundingClientRect(),m=v.width/2-n,y=v.height/2-f;R(m,y,!0)}function yt(e,t){R(e-i.x,t-i.y,!0)}function R(e,t,r){if(!r)return xe(e,t);ue&&ue.cancel();var n={x:0,y:0},f={x:e,y:t},v=0,m=0;ue=ve(n,f,{step:function(y){xe(y.x-v,y.y-m),v=y.x,m=y.y}})}function xt(e,t){ne(),ce(e,t)}function wt(){Se()}function Te(){c.addEventListener("mousedown",Ze,{passive:!1}),c.addEventListener("dblclick",Ae,{passive:!1}),c.addEventListener("touchstart",Me,{passive:!1}),c.addEventListener("keydown",Ce,{passive:!1}),Xe.addWheelListener(c,Ne,{passive:!1}),le()}function Se(){Xe.removeWheelListener(c,Ne),c.removeEventListener("mousedown",Ze),c.removeEventListener("keydown",Ce),c.removeEventListener("dblclick",Ae),c.removeEventListener("touchstart",Me),L&&(window.cancelAnimationFrame(L),L=0),D.cancel(),Fe(),Le(),j.release(),se()}function bt(){g&&Tt()}function Tt(){g=!1,u.applyTransform(i),q("transform"),L=0}function Ce(e){var t=0,r=0,n=0;if(e.keyCode===38?r=1:e.keyCode===40?r=-1:e.keyCode===37?t=1:e.keyCode===39?t=-1:e.keyCode===189||e.keyCode===109?n=1:(e.keyCode===187||e.keyCode===107)&&(n=-1),!b(e,t,r,n)){if(t||r){e.preventDefault(),e.stopPropagation();var f=c.getBoundingClientRect(),v=Math.min(f.width,f.height),m=.05,y=v*m*t,Y=v*m*r;R(y,Y)}if(n){var I=Pe(n*100),v=T?G():St();re(v.x,v.y,I)}}}function St(){var e=c.getBoundingClientRect();return{x:e.width/2,y:e.height/2}}function Me(e){if(Ct(e),W(),e.touches.length===1)return kt(e,e.touches[0]);e.touches.length===2&&(ie=Ee(e.touches[0],e.touches[1]),U=!0,ke())}function Ct(e){a.onTouch&&!a.onTouch(e)||(e.stopPropagation(),e.preventDefault())}function Mt(e){W(),!(a.onDoubleClick&&!a.onDoubleClick(e))&&(e.preventDefault(),e.stopPropagation())}function kt(e){_=new Date;var t=e.touches[0],r=z(t);C=r;var n=P(r.x,r.y);S=n.x,k=n.y,oe=S,ae=k,D.cancel(),ke()}function ke(){M||(M=!0,document.addEventListener("touchmove",Be),document.addEventListener("touchend",ee),document.addEventListener("touchcancel",ee))}function Be(e){if(e.touches.length===1){e.stopPropagation();var t=e.touches[0],r=z(t),n=P(r.x,r.y),f=n.x-S,v=n.y-k;f!==0&&v!==0&&Ie(),S=n.x,k=n.y,R(f,v)}else if(e.touches.length===2){U=!0;var m=e.touches[0],y=e.touches[1],Y=Ee(m,y),I=1+(Y/ie-1)*x,Re=z(m),qe=z(y);if(S=(Re.x+qe.x)/2,k=(Re.y+qe.y)/2,T){var r=G();S=r.x,k=r.y}re(S,k,I),ie=Y,e.stopPropagation(),e.preventDefault()}}function W(){O&&(clearTimeout(O),O=0)}function De(e){if(!!a.onClick){W();var t=S-oe,r=k-ae,n=Math.sqrt(t*t+r*r);n>5||(O=setTimeout(function(){O=0,a.onClick(e)},Ke))}}function ee(e){if(W(),e.touches.length>0){var t=z(e.touches[0]),r=P(t.x,t.y);S=r.x,k=r.y}else{var n=new Date;if(n-$<Ke)if(T){var t=G();te(t.x,t.y,p)}else te(C.x,C.y,p);else n-_<We&&De(e);$=n,se(),Le()}}function Ee(e,t){var r=e.clientX-t.clientX,n=e.clientY-t.clientY;return Math.sqrt(r*r+n*n)}function Ae(e){Mt(e);var t=z(e);T&&(t=G()),te(t.x,t.y,p)}function Ze(e){if(W(),!Z(e)){if(B=e,F=new Date,M)return e.stopPropagation(),!1;var t=e.button===1&&window.event!==null||e.button===0;if(!!t){D.cancel();var r=z(e),n=P(r.x,r.y);return oe=S=n.x,ae=k=n.y,document.addEventListener("mousemove",ze),document.addEventListener("mouseup",Oe),j.capture(e.target||e.srcElement),!1}}}function ze(e){if(!M){Ie();var t=z(e),r=P(t.x,t.y),n=r.x-S,f=r.y-k;S=r.x,k=r.y,R(n,f)}}function Oe(){var e=new Date;e-F<We&&De(B),j.release(),se(),Fe()}function Fe(){document.removeEventListener("mousemove",ze),document.removeEventListener("mouseup",Oe),N=!1}function Le(){document.removeEventListener("touchmove",Be),document.removeEventListener("touchend",ee),document.removeEventListener("touchcancel",ee),N=!1,U=!1,M=!1}function Ne(e){if(!E(e)){D.cancel();var t=e.deltaY;e.deltaMode>0&&(t*=100);var r=Pe(t);if(r!==1){var n=T?G():z(e);re(n.x,n.y,r),e.preventDefault()}}}function z(e){var t,r,n=c.getBoundingClientRect();return t=e.clientX-n.left,r=e.clientY-n.top,{x:t,y:r}}function te(e,t,r){var n=i.scale,f={scale:n},v={scale:r*n};D.cancel(),ne(),K=ve(f,v,{step:function(m){Q(e,t,m.scale)},done:Dt})}function Bt(e,t,r){var n=i.scale,f={scale:n},v={scale:r};D.cancel(),ne(),K=ve(f,v,{step:function(m){Q(e,t,m.scale)}})}function G(){var e=c.getBoundingClientRect();return{x:e.width*T.x,y:e.height*T.y}}function re(e,t,r){return D.cancel(),ne(),be(e,t,r)}function ne(){K&&(K.cancel(),K=null)}function Pe(e){var t=Math.sign(e),r=Math.min(.25,Math.abs(A*e/128));return 1-t*r}function Ie(){N||(q("panstart"),N=!0,D.start())}function se(){N&&(U||D.stop(),q("panend"))}function Dt(){q("zoomend")}function q(e){J.fire(e,J)}}function Ge(o){if(!!o){if(typeof o=="object")return(!V(o.x)||!V(o.y))&&_e(o),o;_e()}}function _e(o){throw console.error(o),new Error(["Cannot parse transform origin.","Some good examples:",' "center center" can be achieved with {x: 0.5, y: 0.5}',' "top center" can be achieved with {x: 0.5, y: 0}',' "bottom right" can be achieved with {x: 1, y: 1}'].join(`
|
|
`))}function X(){}function _t(o){var a=typeof o;if(!(a==="undefined"||a==="boolean")){var u=V(o.left)&&V(o.top)&&V(o.bottom)&&V(o.right);if(!u)throw new Error("Bounds object is not valid. It can be: undefined, boolean (true|false) or an object {left, top, right, bottom}")}}function V(o){return Number.isFinite(o)}function me(o){return Number.isNaN?Number.isNaN(o):o!==o}function Ut(){return{start:X,stop:X,cancel:X}}function Ht(){if(typeof document=="undefined")return;var o=document.getElementsByTagName("script");if(!o)return;for(var a,u=0;u<o.length;++u){var c=o[u];if(c.src&&c.src.match(/\bpanzoom(\.min)?\.js/)){a=c;break}}if(!a)return;var h=a.getAttribute("query");if(!h)return;var g=a.getAttribute("name")||"pz",i=Date.now();b();function b(){var l=document.querySelector(h);if(!l){var d=Date.now(),w=d-i;if(w<2e3){setTimeout(b,100);return}console.error("Cannot find the panzoom element",g);return}var p=x(a);console.log(p),window[g]=Qe(l,p)}function x(l){for(var d=l.attributes,w={},p=0;p<d.length;++p){var E=d[p],Z=s(E);Z&&(w[Z.name]=Z.value)}return w}function s(l){if(!!l.name){var d=l.name[0]==="p"&&l.name[1]==="z"&&l.name[2]==="-";if(!!d){var w=l.name.substr(3),p=JSON.parse(l.value);return{name:w,value:p}}}}}Ht();export{tr as p};
|