diff --git a/build/datamaps-icons.min.js b/build/datamaps-icons.min.js index 6019eed..3d8e295 100644 --- a/build/datamaps-icons.min.js +++ b/build/datamaps-icons.min.js @@ -1,2 +1,2 @@ -/*! datamaps-icons 2015-11-02 */ +/*! datamaps-icons 2016-03-02 */ "use strict";!function(){var a="icons",b=function(a,b,c){var d="http://www.w3.org/2000/svg",e=this,f={cssClass:"datamap-icon",iconFn:function(){var a=document.createElementNS(d,"circle");return a.setAttribute("r",5),a.setAttribute("stroke","#000"),a.setAttribute("stroke-width",1),a.setAttribute("fill","#000"),a},hover:{overFn:null,overClass:"hover-over",outFn:null,outClass:"hover-out"},click:{allowMultiple:!1,onFn:null,onClass:"click-on",offFn:null,offClass:"click-off",awayFromIconFn:null,clickOffOnClickAway:!1}},g=d3.dispatch("hoverOver","hoverOut","clickOn","clickOff","clickAwayFromIcon"),h=function(a,b){for(var c in a)"object"==typeof a[c]&&b[c]?h(a[c],b[c]):null==b[c]&&(b[c]=a[c]);return b},i=function(a){return e.latLngToXY(a.lat,a.lng)[0]},j=function(a){return e.latLngToXY(a.lat,a.lng)[1]},k=function(a){return"circle"===a.tagName},l=function(a,b){var c=i(a),d=j(a);if(!k(this)){var e=this.getBBox();c-=e.width/2,d-=e.height/2}return"translate("+c+","+d+")"},m=function(a,b){if(a.icon)return a.icon;if(c.iconFn)return c.iconFn.call(this,a,b);throw new Error("An icon must be specified as DOM element in the data point's icon field or a function that returns icon DOM elements must be provided in options.iconFn.")},n=function(a,b){var c=a.getAttribute("class"),d=d3.select(a);return b&&!d.classed(b)&&(c+=" "+b),c},o=function(a,b){return n(this,a.cssClass)},p=function(a,b){var d=c.hover.overClass;return b.hover&&(d=b.hover.overClass?b.hover.overClass:d),d},q=function(a,b){var d=c.hover.outClass;return b.hover&&(d=b.hover.outClass?b.hover.outClass:d),d},r=function(a,b,c){var d=d3.select(a);d.classed(p(a,b),c),d.classed(q(a,b),!c)},s=function(){return a.selectAll("."+c.cssClass)},t=function(){var a=s();g.on("hoverOver.icon",c.hover.overFn),g.on("hoverOut.icon",c.hover.outFn),a.on("mouseover",function(a,b){r(this,a,!0),g.hoverOver.apply(this,[a,b])}),a.on("mouseout",function(a,b){r(this,a,!1),g.hoverOut.apply(this,[a,b])})},u=function(a){var b=c.click.onClass;return a.click&&(b=a.click.onClass?a.click.onClass:b),b},v=function(a){var b=c.click.offClass;return a.click&&(b=a.click.offClass?a.click.offClass:b),b},w=function(){var a=[];return s().each(function(b,c){var d=u(b);d3.select(this).classed(d)&&a.push(this)}),a},x=function(){return w()[0]},y=function(a){return-1!==w().indexOf(a)},z=function(a,b){var c=d3.select(a),d=c.data()[0],e=u(d),f=v(d);return c.classed(e,b),c.classed(f,!b),c},A=function(a){var b=z(a,!0);g.clickOn.apply(a,b.data())},B=function(a){if(a){var b=z(a,!1);g.clickOff.apply(a,b.data())}},C=function(){w().forEach(B)},D=function(){var a=s();g.on("clickOn.icon",c.click.onFn),g.on("clickOff.icon",c.click.offFn),a.on("click",function(a,b){d3.event.stopPropagation();var d=y(this);c.click.allowMultiple?d?B(this):A(this):(B(x()),d||A(this))})},E=function(){g.on("clickAwayFromIcon.svg",c.click.awayFromIconFn),e.svg.on("click",function(a,b){g.clickAwayFromIcon.apply(e),c.click.clickOffOnClickAway&&C()})},F=function(){D(),E()};c=h(f,c);var G=s().data(b);G.enter().append(m).classed(c.cssClass,!0),G.attr("transform",l).attr("class",o),G.exit().remove(),t(),F()};if(void 0!==Datamap){var c=new Datamap({element:document.createElement("div")});c.addPlugin(a,b)}return b}(); \ No newline at end of file diff --git a/package.js b/package.js index 6df5640..e011ad3 100644 --- a/package.js +++ b/package.js @@ -4,7 +4,7 @@ Package.describe({ summary: "A plugin to the Datamaps library that provides support for overlaying svg icons.", - version: "0.2.5", + version: "0.2.6", name: "jdlubrano:datamaps-icons", git: "https://github.com/jdlubrano/datamaps-icons.git" }); diff --git a/package.json b/package.json index eea9c2c..86bb330 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "datamaps-icons", - "version": "0.2.5", + "version": "0.2.6", "description": "A Datamaps plugin to display a layer of icons on a Datamap svg", "main": "build/datamaps-icons.js", "scripts": {