From 88efd2d6415d9d95c0f428ee29da1a637e92bbd1 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Mon, 14 May 2012 17:08:35 +0100 Subject: Have a minimum zoom on mobile version. --- web/js/map-OpenLayers.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'web/js/map-OpenLayers.js') diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js index f11ae3ed9..7ffdc7f34 100644 --- a/web/js/map-OpenLayers.js +++ b/web/js/map-OpenLayers.js @@ -83,7 +83,10 @@ function fixmystreet_onload() { var bounds = area.getDataExtent(); if (bounds) { var center = bounds.getCenterLonLat(); - fixmystreet.map.setCenter(center, fixmystreet.map.getZoomForExtent(bounds), false, true); + var z = fixmystreet.map.getZoomForExtent(bounds); + if ( z >= 13 || !$('html').hasClass('mobile') ) { + fixmystreet.map.setCenter(center, z, false, true); + } } }); } @@ -178,7 +181,12 @@ function fixmystreet_onload() { if ( fixmystreet.zoomToBounds ) { var bounds = fixmystreet.markers.getDataExtent(); - if (bounds) { fixmystreet.map.zoomToExtent( bounds ); } + if (bounds) { + var z = fixmystreet.map.getZoomForExtent(bounds); + if ( z >= 13 || !$('html').hasClass('mobile') ) { + fixmystreet.map.zoomToExtent( bounds ); + } + } } $('#hide_pins_link').click(function(e) { -- cgit v1.2.3