diff --git a/README.md b/README.md index b1a766f03..cfe73735b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,12 @@ -# Leaflet.awesome-markers plugin -Colorful iconic & retina-proof markers for Leaflet, based on the Font Awesome/Twitter Bootstrap icons +# Leaflet.awesome-markers plugin v2.0 +Colorful iconic & retina-proof markers for Leaflet, based on the Glyphicons / Font-Awesome icons + +Version 2.0 of Leaflet.awesome-markers is tested with: +- Bootstrap 3 +- Font Awesome 4.0 +- Leaflet 0.5-Latest + +For bootstrap 2.x & Fontawesome 3.x use Leaflet.awesome-markers v1.0 ## Screenshots ![AwesomeMarkers screenshot](https://raw.github.com/lvoogdt/Leaflet.awesome-markers/master/screenshots/screenshot-soft.png "Screenshot of AwesomeMarkers") diff --git a/bower.json b/bower.json new file mode 100644 index 000000000..74c13c84b --- /dev/null +++ b/bower.json @@ -0,0 +1,21 @@ +{ + "name": "Leaflet.awesome-markers", + "version": "2.0.0", + "homepage": "https://github.com/lvoogdt/Leaflet.awesome-markers", + "authors": [ + "Lennard Voogdt " + ], + "description": "Colorful iconic & retina-proof markers for Leaflet, based on the Glyphicons / Font-Awesome icons", + "main": [ + "dist/leaflet.awesome-markers.css", + "dist/leaflet.awesome-markers.js" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/codekit-config.json b/codekit-config.json index 2e7496d4b..692023266 100644 --- a/codekit-config.json +++ b/codekit-config.json @@ -11,6 +11,17 @@ "outputAbbreviatedPath" : "No Output Path", "fileType" : 16 }, + "\/dist\/images\/markers-shadow.png" : { + "ignoreWasSetByUser" : 0, + "ignore" : 0, + "hidden" : 0, + "outputPathIsSetByUser" : 0, + "inputAbbreviatedPath" : "\/dist\/images\/markers-shadow.png", + "processed" : 0, + "outputAbbreviatedPath" : "\/dist\/images\/markers-shadow.png", + "initialSize" : 535, + "fileType" : 8192 + }, "\/dist\/images\/markers-matte.png" : { "ignoreWasSetByUser" : 0, "ignore" : 0, @@ -22,15 +33,6 @@ "initialSize" : 14323, "fileType" : 8192 }, - "\/examples\/basic-example.html" : { - "ignoreWasSetByUser" : 0, - "ignore" : 0, - "hidden" : 0, - "outputPathIsSetByUser" : 0, - "inputAbbreviatedPath" : "\/examples\/basic-example.html", - "outputAbbreviatedPath" : "No Output Path", - "fileType" : 2048 - }, "\/dist\/leaflet.awesome-markers.min.js" : { "ignoreWasSetByUser" : 0, "ignore" : 1, @@ -42,16 +44,14 @@ "outputAbbreviatedPath" : "\/dist\/leaflet.awesome-markers.min.min.js", "fileType" : 64 }, - "\/dist\/images\/markers-shadow.png" : { + "\/examples\/basic-example.html" : { "ignoreWasSetByUser" : 0, "ignore" : 0, "hidden" : 0, "outputPathIsSetByUser" : 0, - "inputAbbreviatedPath" : "\/dist\/images\/markers-shadow.png", - "processed" : 0, - "outputAbbreviatedPath" : "\/dist\/images\/markers-shadow.png", - "initialSize" : 535, - "fileType" : 8192 + "inputAbbreviatedPath" : "\/examples\/basic-example.html", + "outputAbbreviatedPath" : "No Output Path", + "fileType" : 2048 }, "\/examples\/css\/font-awesome.min.css" : { "ignoreWasSetByUser" : 0, @@ -62,15 +62,6 @@ "outputAbbreviatedPath" : "No Output Path", "fileType" : 16 }, - "\/examples\/with-bootstrap.html" : { - "ignoreWasSetByUser" : 0, - "ignore" : 0, - "hidden" : 0, - "outputPathIsSetByUser" : 0, - "inputAbbreviatedPath" : "\/examples\/with-bootstrap.html", - "outputAbbreviatedPath" : "No Output Path", - "fileType" : 2048 - }, "\/dist\/images\/markers-soft@2x.png" : { "ignoreWasSetByUser" : 0, "ignore" : 0, @@ -82,6 +73,17 @@ "initialSize" : 23106, "fileType" : 8192 }, + "\/dist\/leaflet.awesome-markers.js" : { + "ignoreWasSetByUser" : 0, + "ignore" : 0, + "hidden" : 0, + "outputPathIsSetByUser" : 0, + "inputAbbreviatedPath" : "\/dist\/leaflet.awesome-markers.js", + "outputStyle" : 1, + "syntaxCheckerStyle" : 1, + "outputAbbreviatedPath" : "\/dist\/leaflet.awesome-markers.min.js", + "fileType" : 64 + }, "\/dist\/images\/markers-matte@2x.png" : { "ignoreWasSetByUser" : 0, "ignore" : 0, @@ -115,6 +117,15 @@ "initialSize" : 10487, "fileType" : 8192 }, + "\/examples\/with-bootstrap.html" : { + "ignoreWasSetByUser" : 0, + "ignore" : 0, + "hidden" : 0, + "outputPathIsSetByUser" : 0, + "inputAbbreviatedPath" : "\/examples\/with-bootstrap.html", + "outputAbbreviatedPath" : "No Output Path", + "fileType" : 2048 + }, "\/dist\/images\/markers-plain.png" : { "ignoreWasSetByUser" : 0, "ignore" : 0, @@ -126,17 +137,6 @@ "initialSize" : 7946, "fileType" : 8192 }, - "\/dist\/leaflet.awesome-markers.js" : { - "ignoreWasSetByUser" : 0, - "ignore" : 0, - "hidden" : 0, - "outputPathIsSetByUser" : 0, - "inputAbbreviatedPath" : "\/dist\/leaflet.awesome-markers.js", - "outputStyle" : 1, - "syntaxCheckerStyle" : 1, - "outputAbbreviatedPath" : "\/dist\/leaflet.awesome-markers.min.js", - "fileType" : 64 - }, "\/examples\/random-markers.html" : { "ignoreWasSetByUser" : 0, "ignore" : 0, @@ -157,6 +157,15 @@ "initialSize" : 197696, "fileType" : 8192 }, + "\/dist\/leaflet.awesome-markers.css" : { + "ignoreWasSetByUser" : 0, + "ignore" : 0, + "hidden" : 0, + "outputPathIsSetByUser" : 0, + "inputAbbreviatedPath" : "\/dist\/leaflet.awesome-markers.css", + "outputAbbreviatedPath" : "No Output Path", + "fileType" : 16 + }, "\/dist\/images\/markers-shadow@2x.png" : { "ignoreWasSetByUser" : 0, "ignore" : 0, @@ -167,15 +176,6 @@ "outputAbbreviatedPath" : "\/dist\/images\/markers-shadow@2x.png", "initialSize" : 1469, "fileType" : 8192 - }, - "\/dist\/leaflet.awesome-markers.css" : { - "ignoreWasSetByUser" : 0, - "ignore" : 0, - "hidden" : 0, - "outputPathIsSetByUser" : 0, - "inputAbbreviatedPath" : "\/dist\/leaflet.awesome-markers.css", - "outputAbbreviatedPath" : "No Output Path", - "fileType" : 16 } }, "manualImportLinks" : [ diff --git a/dist/leaflet.awesome-markers.js b/dist/leaflet.awesome-markers.js index 06d1f0358..ad46d9e55 100644 --- a/dist/leaflet.awesome-markers.js +++ b/dist/leaflet.awesome-markers.js @@ -34,7 +34,7 @@ }, initialize: function (options) { - options = L.setOptions(this, options); + options = L.Util.setOptions(this, options); }, createIcon: function () { diff --git a/dist/leaflet.awesome-markers.min.js b/dist/leaflet.awesome-markers.min.js index cb0501bf1..248453d69 100644 --- a/dist/leaflet.awesome-markers.min.js +++ b/dist/leaflet.awesome-markers.min.js @@ -4,4 +4,4 @@ http://leafletjs.com https://github.com/lvoogdt -*//*global L*/(function(e,t,n){"use strict";L.AwesomeMarkers={};L.AwesomeMarkers.version="1.0";L.AwesomeMarkers.Icon=L.Icon.extend({options:{iconSize:[35,45],iconAnchor:[17,42],popupAnchor:[1,-32],shadowAnchor:[10,12],shadowSize:[36,16],className:"awesome-marker",prefix:"glyphicon",spinClass:"fa-spin",icon:"home",markerColor:"blue",iconColor:"white"},initialize:function(e){e=L.setOptions(this,e)},createIcon:function(){var e=t.createElement("div"),n=this.options;n.icon&&(e.innerHTML=this._createInner());n.bgPos&&(e.style.backgroundPosition=-n.bgPos.x+"px "+ -n.bgPos.y+"px");this._setIconStyles(e,"icon-"+n.markerColor);return e},_createInner:function(){var e,t="",n="",r="",i=this.options;i.icon.slice(0,i.prefix.length+1)===i.prefix+"-"?e=i.icon:e=i.prefix+"-"+i.icon;i.spin&&typeof i.spinClass=="string"&&(t=i.spinClass);i.iconColor&&(i.iconColor==="white"||i.iconColor==="black"?n="icon-"+i.iconColor:r="style='color: "+i.iconColor+"' ");return""},_setIconStyles:function(e,t){var n=this.options,r=L.point(n[t==="shadow"?"shadowSize":"iconSize"]),i;t==="shadow"?i=L.point(n.shadowAnchor||n.iconAnchor):i=L.point(n.iconAnchor);!i&&r&&(i=r.divideBy(2,!0));e.className="awesome-marker-"+t+" "+n.className;if(i){e.style.marginLeft=-i.x+"px";e.style.marginTop=-i.y+"px"}if(r){e.style.width=r.x+"px";e.style.height=r.y+"px"}},createShadow:function(){var e=t.createElement("div");this._setIconStyles(e,"shadow");return e}});L.AwesomeMarkers.icon=function(e){return new L.AwesomeMarkers.Icon(e)}})(this,document); \ No newline at end of file +*//*global L*/(function(e,t,n){"use strict";L.AwesomeMarkers={};L.AwesomeMarkers.version="1.0";L.AwesomeMarkers.Icon=L.Icon.extend({options:{iconSize:[35,45],iconAnchor:[17,42],popupAnchor:[1,-32],shadowAnchor:[10,12],shadowSize:[36,16],className:"awesome-marker",prefix:"glyphicon",spinClass:"fa-spin",icon:"home",markerColor:"blue",iconColor:"white"},initialize:function(e){e=L.Util.setOptions(this,e)},createIcon:function(){var e=t.createElement("div"),n=this.options;n.icon&&(e.innerHTML=this._createInner());n.bgPos&&(e.style.backgroundPosition=-n.bgPos.x+"px "+ -n.bgPos.y+"px");this._setIconStyles(e,"icon-"+n.markerColor);return e},_createInner:function(){var e,t="",n="",r="",i=this.options;i.icon.slice(0,i.prefix.length+1)===i.prefix+"-"?e=i.icon:e=i.prefix+"-"+i.icon;i.spin&&typeof i.spinClass=="string"&&(t=i.spinClass);i.iconColor&&(i.iconColor==="white"||i.iconColor==="black"?n="icon-"+i.iconColor:r="style='color: "+i.iconColor+"' ");return""},_setIconStyles:function(e,t){var n=this.options,r=L.point(n[t==="shadow"?"shadowSize":"iconSize"]),i;t==="shadow"?i=L.point(n.shadowAnchor||n.iconAnchor):i=L.point(n.iconAnchor);!i&&r&&(i=r.divideBy(2,!0));e.className="awesome-marker-"+t+" "+n.className;if(i){e.style.marginLeft=-i.x+"px";e.style.marginTop=-i.y+"px"}if(r){e.style.width=r.x+"px";e.style.height=r.y+"px"}},createShadow:function(){var e=t.createElement("div");this._setIconStyles(e,"shadow");return e}});L.AwesomeMarkers.icon=function(e){return new L.AwesomeMarkers.Icon(e)}})(this,document); \ No newline at end of file diff --git a/examples/random-markers.html b/examples/random-markers.html index 3c67bbeba..224b6218c 100644 --- a/examples/random-markers.html +++ b/examples/random-markers.html @@ -32,7 +32,7 @@ var colors = ['red', 'blue', 'green', 'purple', 'orange', 'darkred', 'darkblue', 'darkgreen', 'cadetblue', 'darkpurple']; - var awesomeIcons = ['font', 'cloud-download', 'medkit', 'github-alt', 'coffee', 'food', 'bell-alt', 'question-sign', 'star']; + var awesomeIcons = ['font', 'cloud-download', 'medkit', 'github-alt', 'coffee', 'twitter', 'shopping-cart', 'tags', 'star']; var rndCoordinates = function(from, to, fixed) { return (Math.random() * (to - from) + from).toFixed(fixed) * 1; @@ -43,7 +43,7 @@ var awesomeIcon = awesomeIcons[Math.floor(Math.random()*awesomeIcons.length)]; var geo = [rndCoordinates(51.3,51.8, 3), rndCoordinates(0.3,-0.4,3)]; - L.marker(geo, {icon: L.AwesomeMarkers.icon({icon: awesomeIcon, markerColor: color}) }).addTo(map); + L.marker(geo, {icon: L.AwesomeMarkers.icon({icon: awesomeIcon, prefix: 'fa', markerColor: color}) }).addTo(map); }