-
Notifications
You must be signed in to change notification settings - Fork 0
/
d3.behavior.min.js
1 lines (1 loc) · 1.48 KB
/
d3.behavior.min.js
1
(function(){d3.behavior={},d3.behavior.zoom=function(){function l(e,f){function i(a,b){var c=a.__domain||(a.__domain=a.domain()),d=a.range().map(function(a){return(a-b)/h});a.domain(c).domain(d.map(a.invert))}var g=d3.event,h=Math.pow(2,c);d3.event={scale:h,translate:[a,b],transform:function(c,d){c&&i(c,a),d&&i(d,b)}};try{for(var j=0,k=d.length;j<k;j++)d[j].call(this,e,f)}finally{d3.event=g}}function k(d,e){var g=d3.event;if(!f){var h=d3.svg.mouse(this.nearestViewportElement||this);f={x0:a,y0:b,z0:c,x1:a-h[0],y1:b-h[1]}}if(g.type==="dblclick")c=g.shiftKey?Math.ceil(c-1):Math.floor(c+1);else{var i=g.wheelDelta||-g.detail;if(i){try{j.scrollTop=1e3,j.dispatchEvent(g),i=1e3-j.scrollTop}catch(k){}i*=.005}c+=i}var m=Math.pow(2,c-f.z0)-1;a=f.x0+f.x1*m,b=f.y0+f.y1*m,l.call(this,d,e)}function i(){e&&(h(),e=null)}function h(){f=null,e&&(a=d3.event.clientX+e.x0,b=d3.event.clientY+e.y0,l.call(e.target,e.data,e.index))}function g(c,d){e={x0:a-d3.event.clientX,y0:b-d3.event.clientY,target:this,data:c,index:d},d3.event.preventDefault(),window.focus()}function f(){var a=this.on("mousedown",g).on("mousewheel",k).on("DOMMouseScroll",k).on("dblclick",k);d3.select(window).on("mousemove",h).on("mouseup",i)}var a=0,b=0,c=0,d=[],e,f,j=d3.select("body").append("div").style("visibility","hidden").style("position","absolute").style("top","-3000px").style("height",0).style("overflow-y","scroll").append("div").style("height","2000px").node().parentNode;f.on=function(a,b){a=="zoom"&&d.push(b);return f};return f}})()