From 0407e599b3dff6ac04f89acb12a4727ee3d481bc Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Fri, 11 Oct 2013 16:51:09 +0100 Subject: Upgrade main OpenLayers to 2.13.1. --- web/js/map-OpenLayers.js | 110 ++++++++++++++++++++--------------------------- 1 file changed, 46 insertions(+), 64 deletions(-) (limited to 'web/js/map-OpenLayers.js') diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js index 62e94ed29..e5ebeba32 100644 --- a/web/js/map-OpenLayers.js +++ b/web/js/map-OpenLayers.js @@ -46,6 +46,27 @@ function fixmystreet_activate_drag() { fixmystreet.drag.activate(); } +// Need to try and fake the 'centre' being 75% from the left +function fixmystreet_midpoint() { + var $content = $('.content'), mb = $('#map_box'), + q = ( $content.offset().left - mb.offset().left + $content.width() ) / 2, + mid_point = q < 0 ? 0 : q; + return mid_point; +} + +function fixmystreet_zoomToBounds(bounds) { + if (!bounds) { return; } + var center = bounds.getCenterLonLat(); + var z = fixmystreet.map.getZoomForExtent(bounds); + if ( z < 13 && $('html').hasClass('mobile') ) { + z = 13; + } + fixmystreet.map.setCenter(center, z); + if (fixmystreet.state_map && fixmystreet.state_map == 'full') { + fixmystreet.map.pan(-fixmystreet_midpoint(), -25, { animate: false }); + } +} + function fms_markers_list(pins, transform) { var markers = []; for (var i=0; i