aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-05-17 18:01:31 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-06-04 09:57:38 +0100
commit5b66cc7fc8f48a09cb6ca6ab6988f8a1d8e5c8ba (patch)
treec8faa254202b7fe88c780721268f5cd56fe8eae0
parent2e9ec23409e1c17223678dd11a3b6c49eccaa810 (diff)
Allow lookup of whether asset selected.
-rw-r--r--web/cobrands/fixmystreet/assets.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/web/cobrands/fixmystreet/assets.js b/web/cobrands/fixmystreet/assets.js
index 321f09284..a4e0b3f6a 100644
--- a/web/cobrands/fixmystreet/assets.js
+++ b/web/cobrands/fixmystreet/assets.js
@@ -238,6 +238,12 @@ function asset_selected(e) {
return;
}
+ var layer = e.feature.layer;
+ var feature = e.feature;
+
+ // Keep track of selection in case layer is reloaded or hidden etc.
+ selected_feature = feature.clone();
+
// Pick up the USRN for the location of this asset. NB we do this *before*
// handling the attributes on the selected feature in case the feature has
// its own USRN which should take precedence.
@@ -264,13 +270,8 @@ function asset_selected(e) {
fixmystreet.maps.update_pin(lonlat);
// Make sure the marker that was clicked is drawn on top of its neighbours
- var layer = e.feature.layer;
- var feature = e.feature;
layer.eraseFeatures([feature]);
layer.drawFeature(feature);
-
- // Keep track of selection in case layer is reloaded or hidden etc.
- selected_feature = feature.clone();
}
function asset_unselected(e) {
@@ -462,6 +463,10 @@ fixmystreet.assets = {
layers: [],
controls: [],
+ selectedFeature: function() {
+ return selected_feature;
+ },
+
add: function(options) {
var asset_fault_layer = null;