aboutsummaryrefslogtreecommitdiffstats
path: root/web/js/map-OpenLayers.js
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-01-08 11:36:23 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-01-10 18:12:40 +0000
commit97e68dfac3658037fe9cef6f5010a55f626d7b6a (patch)
treefe161b818255ef220f018c251d2dbd0b1fac3369 /web/js/map-OpenLayers.js
parentf7f5918e7a9f9eb00e235232df9da43ebdd63944 (diff)
Only work out bounds/resolution on BBOX strategies
The /my page uses a Fixed strategy which cannot do this.
Diffstat (limited to 'web/js/map-OpenLayers.js')
-rw-r--r--web/js/map-OpenLayers.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index 00f3e8e70..1d417f68e 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -236,7 +236,8 @@ $.extend(fixmystreet.utils, {
* we already have the pins when the page loaded */
function zoomToBounds(bounds) {
if (!bounds) { return; }
- fixmystreet.markers.strategies[0].deactivate();
+ var strategy = fixmystreet.markers.strategies[0];
+ strategy.deactivate();
var center = bounds.getCenterLonLat();
var z = fixmystreet.map.getZoomForExtent(bounds);
if ( z < 13 && $('html').hasClass('mobile') ) {
@@ -244,9 +245,11 @@ $.extend(fixmystreet.utils, {
}
fixmystreet.map.setCenter(center, z);
// Reactivate the strategy and make it think it's done an update
- fixmystreet.markers.strategies[0].activate();
- fixmystreet.markers.strategies[0].calculateBounds();
- fixmystreet.markers.strategies[0].resolution = fixmystreet.map.getResolution();
+ strategy.activate();
+ if (strategy instanceof OpenLayers.Strategy.BBOX) {
+ strategy.calculateBounds();
+ strategy.resolution = fixmystreet.map.getResolution();
+ }
}
function sidebar_highlight(problem_id) {