3 lines
13 KiB
JavaScript
3 lines
13 KiB
JavaScript
|
import{w as Et}from"./wheel.f03080ac.js";import{a as At}from"./amator.8216e0d2.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.enableTextSele
|
||
|
`))}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};
|