Skip to content

Commit

Permalink
set marker style once
Browse files Browse the repository at this point in the history
  • Loading branch information
le-jeu committed Feb 14, 2021
1 parent 4f2ddc2 commit 228aa0e
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions core/code/portal_marker.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ function handler_portal_contextmenu (e) {
}
}

var CompatPortalMarker = L.Class.extend({
initialize: function (portal) {
this.options = portal.options;
this.style = {};
},
setStyle: function (style) {
this.style = style;
},
getStyle: function () {
return this.style;
}
})

var PortalMarker = L.CircleMarker.extend({
options: {},

Expand Down Expand Up @@ -127,20 +140,23 @@ var PortalMarker = L.CircleMarker.extend({
},
reset: function (selected) {
var styleOptions = this._style();
this.setStyle(styleOptions);

this.highlight();
L.Util.extend(styleOptions, this.highlight())

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

if (this._selected)
this.setStyle ({color: COLOR_SELECTED_PORTAL});
L.Util.extend(styleOptions, {color: COLOR_SELECTED_PORTAL});

this.setOptions(styleOptions);
},
highlight: function () {
highlightPortal(this);
var compatPortal = new CompatPortalMarker(this);
var style = highlightPortal(compatPortal);
return style || compatPortal.getStyle();
},
_style: function () {
var dashArray = null;
Expand Down

0 comments on commit 228aa0e

Please sign in to comment.