aboutsummaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorM Somerville <matthew-github@dracos.co.uk>2020-08-18 10:30:23 +0100
committerM Somerville <matthew-github@dracos.co.uk>2020-08-24 10:51:49 +0100
commit0bdf5f60b2d6b28aea30a2c9330ebfbe258ece8e (patch)
tree64f525b8f3677d0df82640057cf7424ee49eea08 /web
parent8ecf1e549290077c1ea8677d1f4159afb739d631 (diff)
Fix display of marker pin swapping WFS layers.
If multiple layers are being shown (e.g. Peterborough trees) then the number of visible layers could go 1 -> 2 -> 3 -> 2, and this code would get confused and reshow the marker pin even though an asset had been selected.
Diffstat (limited to 'web')
-rw-r--r--web/cobrands/fixmystreet/assets.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/web/cobrands/fixmystreet/assets.js b/web/cobrands/fixmystreet/assets.js
index 6504dd069..3d147f038 100644
--- a/web/cobrands/fixmystreet/assets.js
+++ b/web/cobrands/fixmystreet/assets.js
@@ -493,6 +493,8 @@ function _update_message(message, c) {
}
}
+var lastVisible = 0;
+
function layer_visibilitychanged() {
if (this.fixmystreet.road) {
if (!this.getVisibility()) {
@@ -527,12 +529,13 @@ function layer_visibilitychanged() {
visible++;
}
}
- if (visible === 2 || visible === 0) {
- // We're either switching WFS layers (so going 1->2->1 or 1->0->1)
- // or switching off WFS layer (so going 1->0). Either way, we want
- // to show the marker again.
+ if (visible === 0 || visible > lastVisible) {
+ // We're either switching WFS layers (so going 1->2->1 or 1->0->1 or
+ // even 1->2->3->2) or switching off WFS layer (so going 1->0).
+ // Whichever way, we want to show the marker again.
fixmystreet.markers.setVisibility(true);
}
+ lastVisible = visible;
if (!this.fixmystreet.non_interactive) {
this.select_nearest_asset();
}