Skip to content

Commit 6c0d03a

Browse files
committed
Fix markers init when icon is not set
1 parent f9bc345 commit 6c0d03a

1 file changed

Lines changed: 17 additions & 11 deletions

File tree

lib/setmap.js

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -360,20 +360,26 @@
360360
_this.options.markerOptions.position.lat,
361361
_this.options.markerOptions.position.lng
362362
),
363-
title: value.title || _this.options.markerOptions.title,
364-
icon: value.icon || _this.options.markerOptions.icon
363+
title: value.title || _this.options.markerOptions.title
365364
},
366-
markerObj = new gmaps.Marker(markerOptions),
365+
icon = value.icon || _this.options.markerOptions.icon,
367366
dropCallback = value.drop || _this.options.markerOptions.drop,
368367
clickCallback = value.click || _this.options.markerOptions.click,
369-
marker = {
370-
id: index,
371-
obj: markerObj,
372-
dropListener: false,
373-
clickListener: false,
374-
data: value.data,
375-
map: _this.element[0]
376-
};
368+
markerObj, marker;
369+
370+
if (icon) {
371+
markerOptions.icon = icon;
372+
}
373+
374+
markerObj = new gmaps.Marker(markerOptions);
375+
marker = {
376+
id: index,
377+
obj: markerObj,
378+
dropListener: false,
379+
clickListener: false,
380+
data: value.data,
381+
map: _this.element[0]
382+
};
377383

378384
if ( $.isFunction(dropCallback) &&
379385
markerOptions.draggable === true ) {

0 commit comments

Comments
 (0)