added spinClass option

This commit is contained in:
Lennard Voogdt
2013-10-26 14:05:42 +02:00
parent fc412a7aef
commit e772b62b3c
3 changed files with 37 additions and 33 deletions
+25 -25
View File
@@ -31,16 +31,16 @@
"outputAbbreviatedPath" : "No Output Path",
"fileType" : 2048
},
"\/dist\/leaflet.awesome-markers.min.js" : {
"\/dist\/images\/markers-shadow.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-shadow.png",
"processed" : 0,
"outputAbbreviatedPath" : "\/dist\/images\/markers-shadow.png",
"initialSize" : 535,
"fileType" : 8192
},
"\/examples\/css\/font-awesome.min.css" : {
"ignoreWasSetByUser" : 0,
@@ -62,6 +62,17 @@
"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,
@@ -93,17 +104,6 @@
"outputAbbreviatedPath" : "\/dist\/leaflet.awesome-markers.min.js",
"fileType" : 64
},
"\/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-soft.png" : {
"ignoreWasSetByUser" : 0,
"ignore" : 0,
@@ -126,16 +126,16 @@
"initialSize" : 7946,
"fileType" : 8192
},
"\/dist\/images\/markers-soft@2x.png" : {
"\/dist\/leaflet.awesome-markers.min.js" : {
"ignoreWasSetByUser" : 0,
"ignore" : 0,
"ignore" : 1,
"hidden" : 0,
"outputPathIsSetByUser" : 0,
"inputAbbreviatedPath" : "\/dist\/images\/markers-soft@2x.png",
"processed" : 0,
"outputAbbreviatedPath" : "\/dist\/images\/markers-soft@2x.png",
"initialSize" : 23106,
"fileType" : 8192
"inputAbbreviatedPath" : "\/dist\/leaflet.awesome-markers.min.js",
"outputStyle" : 1,
"syntaxCheckerStyle" : 1,
"outputAbbreviatedPath" : "\/dist\/leaflet.awesome-markers.min.min.js",
"fileType" : 64
},
"\/examples\/random-markers.html" : {
"ignoreWasSetByUser" : 0,
+11 -7
View File
@@ -26,6 +26,8 @@
shadowAnchor: [10, 12],
shadowSize: [36, 16],
className: 'awesome-marker',
prefix: 'glyphicon',
spinClass: 'fa-spin',
icon: 'home',
markerColor: 'blue',
iconColor: 'white'
@@ -53,13 +55,15 @@
},
_createInner: function() {
var iconClass;
// if(this.options.icon.slice(0,5)==="icon-"){
iconClass=this.options.icon;
// }else{
// iconClass="icon-"+this.options.icon;
// }
return "<i class='" + iconClass + (this.options.spin ? " icon-spin" :"") + (this.options.iconColor ? " icon-" + this.options.iconColor :"") + "'></i>";
var iconClass,
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>";
},
_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",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;e=this.options.icon;return"<i class='"+e+(this.options.spin?" icon-spin":"")+(this.options.iconColor?" icon-"+this.options.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=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);