diff --git a/build/d3-geo-scale-bar.js b/build/d3-geo-scale-bar.js index 4a9fa02..00ec5e7 100644 --- a/build/d3-geo-scale-bar.js +++ b/build/d3-geo-scale-bar.js @@ -1,4 +1,4 @@ -// https://github.com/HarryStevens/d3-geo-scale-bar Version 1.0.2. Copyright 2020 Harry Stevens. +// https://github.com/HarryStevens/d3-geo-scale-bar Version 1.1.0. Copyright 2020 Harry Stevens. (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : diff --git a/build/d3-geo-scale-bar.min.js b/build/d3-geo-scale-bar.min.js new file mode 100644 index 0000000..755937b --- /dev/null +++ b/build/d3-geo-scale-bar.min.js @@ -0,0 +1 @@ +!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.d3=t.d3||{})}(this,function(t){"use strict";function n(){this.reset()}function e(t,n,e){var r=t.s=n+e,o=r-n,i=r-o;t.t=n-i+(e-o)}function r(t,n){t&&x.hasOwnProperty(t.type)&&x[t.type](t,n)}function o(t,n,e){var r,o=-1,i=t.length-e;for(n.lineStart();++o=w));)P=4*b,C=P/(h(k,n.invert([S+1,x]))*l),b*=10,z++;var E=P/(v?y:1),L=null===r?[]:r||[0,E/4,E/2,E],A=function(t){return t*C/(P/y)},F=t.selection?t.selection():t,I=F.selectAll(".label").data([o]),O=F.selectAll(".domain").data([null]),j=F.selectAll(".tick").data(L,A).order(),B=j.exit(),_=j.enter().append("g").attr("class","tick"),q=j.select("line"),G=j.select("text"),K=j.select("rect");F.attr("font-family","sans-serif").attr("transform","translate(".concat([S,x],")")),O=O.merge(O.enter().insert("path",".tick").attr("class","domain").attr("fill","none").attr("stroke","currentColor")),j=j.merge(_),q=q.merge(_.append("line").attr("stroke","currentColor").attr("y2",p*u)),G=G.merge(_.append("text").attr("fill","currentColor").attr("y",p*u+g*u).attr("font-size",10).attr("text-anchor","middle").attr("dy","".concat(1===u?.71:0,"em"))),K=K.merge(_.append("rect").attr("fill",function(t,n){return n%2==0?"currentColor":"#fff"}).attr("stroke","currentColor").attr("stroke-width",.5).attr("width",function(t,n,e){return n===e.length-1?0:A(L[n+1]-t)}).attr("y",1===u?0:-p).attr("height",p)),t!==F&&(j=j.transition(t),O=O.transition(t),K=K.transition(t),B=B.transition(t).attr("opacity",1e-6).attr("transform",function(t){return"translate(".concat(A(t),")")}),_.attr("opacity",1e-6).attr("transform",function(t){return"translate(".concat(A(t),")")})),B.remove(),O.attr("d","M".concat(A(0),",").concat(p*u," L").concat(A(0),",0 L").concat(A(E),",0 L").concat(A(E),",").concat(p*u)),j.attr("transform",function(t){return"translate(".concat(A(t),")")}).attr("opacity",1),q.attr("y2",p*u),G.attr("y",p*u+g*u).text(f),K.attr("fill",function(t,n){return n%2==0?"currentColor":"#fff"}).attr("width",function(t,n,e){return n===e.length-1?0:A(L[n+1]-t)}).attr("y",1===u?0:-p).attr("height",p),null===I?I.remove():I.enter().append("text").attr("class","label").attr("fill","currentColor").attr("font-size",12).attr("dy","-0.32em").merge(I).attr("x","start"===m?0:A("middle"===m?E/2:E)).attr("y",1===u?0:"1.3em").attr("text-anchor",m).text(function(t){return t})}var n,e,r,o,i=null,a=0,c=0,u=d(),l=w.radius,s=w.units,f=function(t){return Math.round(t)},g=2,p=4,m="start",y=1,v=!0;return t.distance=function(n){return arguments.length?(e=+n,t):e},t.extent=function(n){return arguments.length?(i=n,t):i},t.label=function(n){return arguments.length?(o=n,t):o},t.labelAnchor=function(n){return arguments.length?(m=n,t):m},t.left=function(n){return arguments.length?(a=+n>1?1:+n<0?0:+n,t):a},t.orient=function(n){return arguments.length?(u=n(),t):1===u?"bottom":"top"},t.projection=function(e){return arguments.length?(n=e,t):n},t.radius=function(n){return arguments.length?(l=+n,t):l},t.size=function(n){return arguments.length?(i=[[0,0],n],t):i[1]},t.top=function(n){return arguments.length?(c=+n>1?1:+n<0?0:+n,t):c},t.tickFormat=function(n){return arguments.length?(f=n,t):f},t.tickPadding=function(n){return arguments.length?(g=+n,t):g},t.tickSize=function(n){return arguments.length?(p=+n,t):p},t.tickValues=function(n){return arguments.length?(r=n,t):r},t.units=function(n){var e;return arguments.length?(e=n,s=e.units,l=e.radius,t):s},t.zoomClamp=function(n){return arguments.length?(v=!!n,t):v},t.zoomFactor=function(n){return arguments.length?(y=+n,t):y},t}function p(){return-1}n.prototype={constructor:n,reset:function(){this.s=this.t=0},add:function(t){e(M,t,this.t),e(this,M.s,this.s),this.s?this.t+=M.t:this.s=M.t},valueOf:function(){return this.s}};var m,y,v,M=new n,S={Feature:function(t,n){r(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,o=-1,i=e.length;++o