aboutsummaryrefslogtreecommitdiffstats
path: root/web/js
diff options
context:
space:
mode:
Diffstat (limited to 'web/js')
-rw-r--r--web/js/map-OpenLayers.js10
-rw-r--r--web/js/map-google.js6
2 files changed, 3 insertions, 13 deletions
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index 7b7bee7e8..63ef7324d 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -59,14 +59,6 @@ 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();
@@ -659,7 +651,7 @@ OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
fixmystreet.map.getProjectionObject()
);
var p = fixmystreet.map.getViewPortPxFromLonLat(lonlat);
- p.x -= ( o.left - bo.left + w ) / 2;
+ p.x -= midpoint_box_excluding_column(o, w, bo, $map_boxx.width());
lonlat = fixmystreet.map.getLonLatFromViewPortPx(p);
fixmystreet.map.panTo(lonlat);
}
diff --git a/web/js/map-google.js b/web/js/map-google.js
index 8364b40df..0e7cd824e 100644
--- a/web/js/map-google.js
+++ b/web/js/map-google.js
@@ -192,10 +192,8 @@ function fms_map_initialize() {
if (fixmystreet.state_map && fixmystreet.state_map == 'full') {
// TODO Work better with window resizing, this is pretty 'set up' only at present
- var $content = $('.content'), mb = $('#map_box'),
- q = ( $content.offset().left - mb.offset().left + $content.width() ) / 2;
- if (q < 0) { q = 0; }
- // Need to try and fake the 'centre' being 75% from the left
+ var q = fixmystreet_midpoint();
+ // Need to try and fake the 'centre' being 75% from the edge
fixmystreet.map.panBy(-q, -25);
}