Skip to content

Commit

Permalink
set marker style once
Browse files Browse the repository at this point in the history
apply/adapt set(Marker)Style PR IITC-CE#251 by johnd0e

commit 6201837
  • Loading branch information
le-jeu committed May 6, 2021
1 parent 8927451 commit 9bf8d61
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions core/code/portal_marker.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,25 +120,35 @@ L.PortalMarker = L.CircleMarker.extend({
hasFullDetails: function () {
return !!this._details.mods
},
setStyle: function (style) { // stub for highlighters
L.Util.setOptions(this, style);
return this;
},
setMarkerStyle: function (style) {
var styleOptions = L.Util.extend(this._style(), style);
L.Util.setOptions(this, styleOptions);

L.Util.setOptions(this, highlightPortal(this));

var selected = L.extend(
{ radius: this.options.radius },
this._selected && { color: COLOR_SELECTED_PORTAL }
);
return L.CircleMarker.prototype.setStyle.call(this, selected);
},
select: function (selected) {
if (selected) {
this.renderDetails();
}
return this.reset(selected);
},
reset: function (selected) {
var styleOptions = this._style();
this.setStyle(styleOptions);

highlightPortal(this);

if (selected === false)
this._selected = false;
else
this._selected = this._selected || selected;

if (this._selected)
this.setStyle ({color: COLOR_SELECTED_PORTAL});
return this.setMarkerStyle();
},
_style: function () {
var dashArray = null;
Expand Down

0 comments on commit 9bf8d61

Please sign in to comment.