From e329408a700bf768a3ab064fff78e2de82220a3e Mon Sep 17 00:00:00 2001 From: LeJeu <64744459+le-jeu@users.noreply.github.com> Date: Sun, 14 Feb 2021 19:30:57 +0100 Subject: [PATCH] set marker style once apply/adapt set(Marker)Style PR #251 by johnd0e commit 6201837d94c87345d80086503b3623127276adca --- core/code/portal_marker.js | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/core/code/portal_marker.js b/core/code/portal_marker.js index 987d6628c..5a09947db 100644 --- a/core/code/portal_marker.js +++ b/core/code/portal_marker.js @@ -120,6 +120,22 @@ 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(); @@ -127,18 +143,12 @@ L.PortalMarker = L.CircleMarker.extend({ 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;