iconColor now supports css color codes besides 'black' & 'white'

This commit is contained in:
Lennard Voogdt
2013-10-26 14:41:44 +02:00
parent e772b62b3c
commit f5fc5255f1
6 changed files with 71 additions and 67 deletions
+31 -31
View File
@@ -31,16 +31,16 @@
"outputAbbreviatedPath" : "No Output Path",
"fileType" : 2048
},
"\/dist\/images\/markers-shadow.png" : {
"\/dist\/leaflet.awesome-markers.min.js" : {
"ignoreWasSetByUser" : 0,
"ignore" : 0,
"ignore" : 1,
"hidden" : 0,
"outputPathIsSetByUser" : 0,
"inputAbbreviatedPath" : "\/dist\/images\/markers-shadow.png",
"processed" : 0,
"outputAbbreviatedPath" : "\/dist\/images\/markers-shadow.png",
"initialSize" : 535,
"fileType" : 8192
"inputAbbreviatedPath" : "\/dist\/leaflet.awesome-markers.min.js",
"outputStyle" : 1,
"syntaxCheckerStyle" : 1,
"outputAbbreviatedPath" : "\/dist\/leaflet.awesome-markers.min.min.js",
"fileType" : 64
},
"\/examples\/css\/font-awesome.min.css" : {
"ignoreWasSetByUser" : 0,
@@ -62,17 +62,6 @@
"initialSize" : 218197,
"fileType" : 8192
},
"\/dist\/images\/markers-soft@2x.png" : {
"ignoreWasSetByUser" : 0,
"ignore" : 0,
"hidden" : 0,
"outputPathIsSetByUser" : 0,
"inputAbbreviatedPath" : "\/dist\/images\/markers-soft@2x.png",
"processed" : 0,
"outputAbbreviatedPath" : "\/dist\/images\/markers-soft@2x.png",
"initialSize" : 23106,
"fileType" : 8192
},
"\/examples\/with-bootstrap.html" : {
"ignoreWasSetByUser" : 0,
"ignore" : 0,
@@ -82,6 +71,17 @@
"outputAbbreviatedPath" : "No Output Path",
"fileType" : 2048
},
"\/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,
@@ -93,16 +93,16 @@
"initialSize" : 31113,
"fileType" : 8192
},
"\/dist\/leaflet.awesome-markers.js" : {
"\/dist\/images\/markers-shadow.png" : {
"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
"inputAbbreviatedPath" : "\/dist\/images\/markers-shadow.png",
"processed" : 0,
"outputAbbreviatedPath" : "\/dist\/images\/markers-shadow.png",
"initialSize" : 535,
"fileType" : 8192
},
"\/dist\/images\/markers-soft.png" : {
"ignoreWasSetByUser" : 0,
@@ -126,16 +126,16 @@
"initialSize" : 7946,
"fileType" : 8192
},
"\/dist\/leaflet.awesome-markers.min.js" : {
"\/dist\/images\/markers-soft@2x.png" : {
"ignoreWasSetByUser" : 0,
"ignore" : 1,
"ignore" : 0,
"hidden" : 0,
"outputPathIsSetByUser" : 0,
"inputAbbreviatedPath" : "\/dist\/leaflet.awesome-markers.min.js",
"outputStyle" : 1,
"syntaxCheckerStyle" : 1,
"outputAbbreviatedPath" : "\/dist\/leaflet.awesome-markers.min.min.js",
"fileType" : 64
"inputAbbreviatedPath" : "\/dist\/images\/markers-soft@2x.png",
"processed" : 0,
"outputAbbreviatedPath" : "\/dist\/images\/markers-soft@2x.png",
"initialSize" : 23106,
"fileType" : 8192
},
"\/examples\/random-markers.html" : {
"ignoreWasSetByUser" : 0,
+15 -3
View File
@@ -55,15 +55,27 @@
},
_createInner: function() {
var iconClass,
options = this.options;
var iconClass, iconSpinClass = "", iconColorClass = "", iconColorStyle = "", options = this.options;
if(options.icon.slice(0,options.prefix.length+1) === options.prefix + "-") {
iconClass = options.icon;
} else {
iconClass = options.prefix + "-" + options.icon;
}
return "<i class='" + iconClass + (options.spin ? " " + options.spinClass : "") + (options.iconColor ? " icon-" + options.iconColor :"") + "'></i>";
if(options.spin && typeof options.spinClass === "string") {
iconSpinClass = options.spinClass;
}
if(options.iconColor) {
if(options.iconColor === 'white' || options.iconColor === 'black') {
iconColorClass = "icon-" + options.iconColor;
} else {
iconColorStyle = "style='color: " + options.iconColor + "' ";
}
}
return "<i " + iconColorStyle + "class='" + options.prefix + " " + iconClass + " " + iconSpinClass + " " + iconColorClass + "'></i>";
},
_setIconStyles: function (img, name) {
+1 -1
View File
@@ -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=this.options;t.icon.slice(0,t.prefix.length+1)===t.prefix+"-"?e=t.icon:e=t.prefix+"-"+t.icon;return"<i class='"+e+(t.spin?" "+t.spinClass:"")+(t.iconColor?" icon-"+t.iconColor:"")+"'></i>"},_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);
*//*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"<i "+r+"class='"+i.prefix+" "+e+" "+t+" "+n+"'></i>"},_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);
+12 -17
View File
@@ -7,22 +7,17 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="http://netdna.bootstrapcdn.com/font-awesome/4.0.0/css/font-awesome.css" rel="stylesheet">
<link rel="stylesheet" href="../dist/leaflet.awesome-markers.css">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" />
<![endif]-->
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
</head>
<body>
<div id="map" style="width: 800px; height: 600px"></div>
<i class="fa fa-camera-retro"></i> fa-camera-retro
<script src="http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.js"></script>
<script src="../dist/leaflet.awesome-markers.js"></script>
<script>
@@ -34,19 +29,19 @@
detectRetina: true
}).addTo(map);
L.marker([51.941196,4.512291], {icon: L.AwesomeMarkers.icon({icon: 'spinner', markerColor: 'red', spin:true}) }).addTo(map);
L.marker([51.927913,4.521303], {icon: L.AwesomeMarkers.icon({icon: 'icon-coffee', markerColor: 'red', markerColor: 'black'}) }).addTo(map);
L.marker([51.936063,4.502077], {icon: L.AwesomeMarkers.icon({icon: 'food', markerColor: 'purple'}) }).addTo(map);
L.marker([51.932835,4.506969], {icon: L.AwesomeMarkers.icon({icon: 'glass', markerColor: 'green'}) }).addTo(map);
L.marker([51.930295,4.515209], {icon: L.AwesomeMarkers.icon({icon: 'shopping-cart', markerColor: 'blue'}) }).addTo(map);
L.marker([51.930083,4.507742], {icon: L.AwesomeMarkers.icon({icon: 'comments', markerColor: 'orange'}) }).addTo(map);
L.marker([51.941196,4.512291], {icon: L.AwesomeMarkers.icon({icon: 'spinner', prefix: 'fa', markerColor: 'red', spin:true}) }).addTo(map);
L.marker([51.927913,4.521303], {icon: L.AwesomeMarkers.icon({icon: 'coffee', prefix: 'fa', markerColor: 'red', iconColor: '#f28f82'}) }).addTo(map);
L.marker([51.936063,4.502077], {icon: L.AwesomeMarkers.icon({icon: 'cog', prefix: 'fa', markerColor: 'purple', iconColor: 'black'}) }).addTo(map);
L.marker([51.932835,4.506969], {icon: L.AwesomeMarkers.icon({icon: 'glass', prefix: 'fa', markerColor: 'green'}) }).addTo(map);
L.marker([51.930295,4.515209], {icon: L.AwesomeMarkers.icon({icon: 'shopping-cart', prefix: 'fa', markerColor: 'blue'}) }).addTo(map);
L.marker([51.930083,4.507742], {icon: L.AwesomeMarkers.icon({icon: 'info', prefix: 'fa', markerColor: 'orange'}) }).addTo(map);
L.marker([51.930454,4.527054], {icon: L.AwesomeMarkers.icon({icon: 'group', markerColor: 'darkred'}) }).addTo(map);
L.marker([51.929607,4.527054], {icon: L.AwesomeMarkers.icon({icon: 'arrow-right', markerColor: 'darkblue'}) }).addTo(map);
L.marker([51.928919,4.528856], {icon: L.AwesomeMarkers.icon({icon: 'twitter', markerColor: 'cadetblue'}) }).addTo(map);
L.marker([51.930295,4.530745], {icon: L.AwesomeMarkers.icon({icon: 'phone', markerColor: 'darkpurple'}) }).addTo(map);
L.marker([51.925055,4.512806], {icon: L.AwesomeMarkers.icon({icon: 'ambulance', markerColor: 'darkgreen'}) }).addTo(map);
L.marker([51.925902,4.505768], {icon: L.AwesomeMarkers.icon({icon: 'medkit', markerColor: 'darkblue'}) }).addTo(map);
L.marker([51.930454,4.527054], {icon: L.AwesomeMarkers.icon({icon: 'group', prefix: 'fa', markerColor: 'darkred'}) }).addTo(map);
L.marker([51.929607,4.527054], {icon: L.AwesomeMarkers.icon({icon: 'arrow-right', prefix: 'fa', markerColor: 'darkblue'}) }).addTo(map);
L.marker([51.928919,4.528856], {icon: L.AwesomeMarkers.icon({icon: 'twitter', prefix: 'fa', markerColor: 'cadetblue'}) }).addTo(map);
L.marker([51.930295,4.530745], {icon: L.AwesomeMarkers.icon({icon: 'phone', prefix: 'fa', markerColor: 'darkpurple'}) }).addTo(map);
L.marker([51.925055,4.512806], {icon: L.AwesomeMarkers.icon({icon: 'ambulance', prefix: 'fa', markerColor: 'darkgreen'}) }).addTo(map);
L.marker([51.925902,4.505768], {icon: L.AwesomeMarkers.icon({icon: 'medkit', prefix: 'fa', markerColor: 'darkblue'}) }).addTo(map);
</script>
</body>
</html>
-2
View File
@@ -7,9 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="http://netdna.bootstrapcdn.com/font-awesome/4.0.0/css/font-awesome.css" rel="stylesheet">
<link rel="stylesheet" href="../dist/leaflet.awesome-markers.css">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" />
+12 -13
View File
@@ -8,7 +8,6 @@
<link href="http://netdna.bootstrapcdn.com/font-awesome/4.0.0/css/font-awesome.css" rel="stylesheet">
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="../dist/leaflet.awesome-markers.css">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
@@ -33,19 +32,19 @@
key: 'BC9A493B41014CAABB98F0471D759707'
}).addTo(map);
L.marker([51.941196,4.512291], {icon: L.AwesomeMarkers.icon({icon: 'fire', markerColor: 'red', spin:true}) }).addTo(map);
L.marker([51.927913,4.521303], {icon: L.AwesomeMarkers.icon({icon: 'icon-briefcase', markerColor: 'red'}) }).addTo(map);
L.marker([51.936063,4.502077], {icon: L.AwesomeMarkers.icon({icon: 'home', markerColor: 'purple'}) }).addTo(map);
L.marker([51.932835,4.506969], {icon: L.AwesomeMarkers.icon({icon: 'glass', markerColor: 'green'}) }).addTo(map);
L.marker([51.930295,4.515209], {icon: L.AwesomeMarkers.icon({icon: 'flag', markerColor: 'blue', markerColor: 'black'}) }).addTo(map);
L.marker([51.930083,4.507742], {icon: L.AwesomeMarkers.icon({icon: 'tags', markerColor: 'orange'}) }).addTo(map);
L.marker([51.941196,4.512291], {icon: L.AwesomeMarkers.icon({icon: 'link', prefix: 'glyphicon', markerColor: 'red', spin:true}) }).addTo(map);
L.marker([51.927913,4.521303], {icon: L.AwesomeMarkers.icon({icon: 'certificate', prefix: 'glyphicon', markerColor: 'red'}) }).addTo(map);
L.marker([51.936063,4.502077], {icon: L.AwesomeMarkers.icon({icon: 'cog', prefix: 'glyphicon', markerColor: 'purple'}) }).addTo(map);
L.marker([51.932835,4.506969], {icon: L.AwesomeMarkers.icon({icon: 'send', prefix: 'glyphicon', markerColor: 'green'}) }).addTo(map);
L.marker([51.930295,4.515209], {icon: L.AwesomeMarkers.icon({icon: 'star', prefix: 'glyphicon', markerColor: 'blue', iconColor: 'black'}) }).addTo(map);
L.marker([51.930083,4.507742], {icon: L.AwesomeMarkers.icon({icon: 'tags', prefix: 'fa', markerColor: 'orange'}) }).addTo(map);
L.marker([51.930454,4.527054], {icon: L.AwesomeMarkers.icon({icon: 'bookmark', markerColor: 'darkred'}) }).addTo(map);
L.marker([51.929607,4.527054], {icon: L.AwesomeMarkers.icon({icon: 'picture', markerColor: 'darkblue'}) }).addTo(map);
L.marker([51.928919,4.528856], {icon: L.AwesomeMarkers.icon({icon: 'move', markerColor: 'cadetblue'}) }).addTo(map);
L.marker([51.930295,4.530745], {icon: L.AwesomeMarkers.icon({icon: 'play', markerColor: 'darkpurple'}) }).addTo(map);
L.marker([51.925055,4.512806], {icon: L.AwesomeMarkers.icon({icon: 'barcode', markerColor: 'darkgreen'}) }).addTo(map);
L.marker([51.925902,4.505768], {icon: L.AwesomeMarkers.icon({icon: 'inbox', markerColor: 'darkblue'}) }).addTo(map);
L.marker([51.930454,4.527054], {icon: L.AwesomeMarkers.icon({icon: 'bookmark', prefix: 'fa', markerColor: 'darkred'}) }).addTo(map);
L.marker([51.929607,4.527054], {icon: L.AwesomeMarkers.icon({icon: 'picture-o', prefix: 'fa', markerColor: 'darkblue'}) }).addTo(map);
L.marker([51.928919,4.528856], {icon: L.AwesomeMarkers.icon({icon: 'move', prefix: 'fa', markerColor: 'cadetblue'}) }).addTo(map);
L.marker([51.930295,4.530745], {icon: L.AwesomeMarkers.icon({icon: 'play', prefix: 'fa', markerColor: 'darkpurple'}) }).addTo(map);
L.marker([51.925055,4.512806], {icon: L.AwesomeMarkers.icon({icon: 'barcode', prefix: 'fa', markerColor: 'darkgreen'}) }).addTo(map);
L.marker([51.925902,4.505768], {icon: L.AwesomeMarkers.icon({icon: 'inbox', prefix: 'fa', markerColor: 'darkblue'}) }).addTo(map);
</script>
</body>
</html>