diff options
author | M Somerville <matthew-github@dracos.co.uk> | 2020-08-14 11:44:38 +0100 |
---|---|---|
committer | M Somerville <matthew-github@dracos.co.uk> | 2020-08-14 11:44:38 +0100 |
commit | 3dca06dc40f7ac247ba4345da761fc53367b33ea (patch) | |
tree | b569192105c041063f023ee2b00b9e45a14722d3 /web | |
parent | 51772b463d007bf92d775536e94eaf42c7490995 (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.js | 8 |
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); + } } }, |