diff options
author | Matthew Somerville <matthew@mysociety.org> | 2016-06-17 11:08:18 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2016-07-06 12:58:35 +0100 |
commit | 25adf6e4187085bd48d96c808483a6a4fcfc6ebc (patch) | |
tree | afea7ff45ba24574d7395fdaf6a1d3c7c036d1aa /web/js | |
parent | 49782c333a340a667009eed261d0ef0ceb419f88 (diff) |
Don't update the map pins if a new report started.
Diffstat (limited to 'web/js')
-rw-r--r-- | web/js/map-OpenLayers.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js index 267643898..d1dba631e 100644 --- a/web/js/map-OpenLayers.js +++ b/web/js/map-OpenLayers.js @@ -646,6 +646,17 @@ OpenLayers.Protocol.FixMyStreet = OpenLayers.Class(OpenLayers.Protocol.HTTP, { /* Pan data handler */ OpenLayers.Format.FixMyStreet = OpenLayers.Class(OpenLayers.Format.JSON, { read: function(json, filter) { + // Check we haven't received the data after the map has been clicked. + if (fixmystreet.page == 'new') { + // If we have, we want to do nothing, which means returning an + // array of the back-projected version of the current pin + var pin = fixmystreet.markers.features[0].clone(); + pin.geometry.transform( + fixmystreet.map.getProjectionObject(), + new OpenLayers.Projection("EPSG:4326") + ); + return [ pin ]; + } if (typeof json == 'string') { obj = OpenLayers.Format.JSON.prototype.read.apply(this, [json, filter]); } else { |