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 Feb 17, 2021
1 parent 6673c8a commit e1654c2
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions core/code/portal_marker.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,28 +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);

this.highlight();

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

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

0 comments on commit e1654c2

Please sign in to comment.