aboutsummaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorM Somerville <matthew-github@dracos.co.uk>2020-08-14 11:44:38 +0100
committerM Somerville <matthew-github@dracos.co.uk>2020-08-14 11:44:38 +0100
commit3dca06dc40f7ac247ba4345da761fc53367b33ea (patch)
treeb569192105c041063f023ee2b00b9e45a14722d3 /web
parent51772b463d007bf92d775536e94eaf42c7490995 (diff)
Zoom in to asset if selected when changing asset.
If you click the change asset button on a report page that was loaded inline from a map list page, you want to see assets around the report and not the centre of the map.
Diffstat (limited to 'web')
-rw-r--r--web/cobrands/fixmystreet/assets.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/web/cobrands/fixmystreet/assets.js b/web/cobrands/fixmystreet/assets.js
index ef345092b..07ccd73d3 100644
--- a/web/cobrands/fixmystreet/assets.js
+++ b/web/cobrands/fixmystreet/assets.js
@@ -107,7 +107,13 @@ OpenLayers.Layer.VectorAsset = OpenLayers.Class(OpenLayers.Layer.Vector, {
if (!this.inRange && this.resolutions) {
var firstVisibleResolution = this.resolutions[0];
var zoomLevel = fixmystreet.map.getZoomForResolution(firstVisibleResolution);
- fixmystreet.map.zoomTo(zoomLevel);
+ if (window.selected_problem_id) {
+ var feature = fixmystreet.maps.get_marker_by_id(window.selected_problem_id);
+ var center = feature.geometry.getBounds().getCenterLonLat();
+ fixmystreet.map.setCenter(center, zoomLevel);
+ } else {
+ fixmystreet.map.zoomTo(zoomLevel);
+ }
}
},