diff options
author | Matthew Somerville <matthew@mysociety.org> | 2016-06-17 11:08:18 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2016-06-17 11:35:14 +0100 |
commit | d06f318eb439e0bf115557f24e906934acb5cafa (patch) | |
tree | 929cd5fd1fc4e6fb8ea1c27c2a97d90c387b92a9 /web/js/map-OpenLayers.js | |
parent | 7495767b86c91a8f8f5d780021c6aea4468e3d71 (diff) |
Don't update the map pins if a new report started.
Diffstat (limited to 'web/js/map-OpenLayers.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 f5f5f2934..1379d0fa5 100644 --- a/web/js/map-OpenLayers.js +++ b/web/js/map-OpenLayers.js @@ -643,6 +643,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 { |