aboutsummaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorM Somerville <matthew-github@dracos.co.uk>2020-08-13 17:42:21 +0100
committerM Somerville <matthew-github@dracos.co.uk>2020-08-13 19:35:36 +0100
commit82ad3f1db8debc125e8d54a372b26379a54d63db (patch)
tree047bd0be23a229abd75a5fa081703e447b8c1a9a /web
parentfa9604aa0c6461753c0163d1791a61636570c679 (diff)
Only create one admin drag control.
It was previously creating one on each report you looked at. A side effect of which was upping the z-index of the layer by one each time, making adding asset layers bit trickier.
Diffstat (limited to 'web')
-rw-r--r--web/js/map-OpenLayers.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index 553fd6c3a..d94d0706f 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -290,9 +290,12 @@ $.extend(fixmystreet.utils, {
// pin_moved_callback is called with a new EPSG:4326 OpenLayers.LonLat if
// the user drags the pin and confirms its new location.
admin_drag: function(pin_moved_callback, confirm_change) {
+ if (fixmystreet.maps.admin_drag_control) {
+ return;
+ }
confirm_change = confirm_change || false;
var original_lonlat;
- var drag = new OpenLayers.Control.DragFeatureFMS( fixmystreet.markers, {
+ var drag = fixmystreet.maps.admin_drag_control = new OpenLayers.Control.DragFeatureFMS( fixmystreet.markers, {
onStart: function(feature, e) {
// Keep track of where the feature started, so we can put it
// back if the user cancels the operation.