diff options
Diffstat (limited to 'web/js/map-OpenLayers.js')
-rw-r--r-- | web/js/map-OpenLayers.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js index 35020e1f7..d98994d84 100644 --- a/web/js/map-OpenLayers.js +++ b/web/js/map-OpenLayers.js @@ -23,9 +23,10 @@ function fixmystreet_update_pin(lonlat) { $('#side-form, #site-logo').show(); $('#councils_text').html(data.councils_text); $('#form_category_row').html(data.category); - if ( data.extra_name_info ) { + if ( data.extra_name_info && !$('#form_fms_extra_title').length ) { // there might be a first name field on some cobrands - var lb = $('#form_first_name').prev() || $('#form_name').prev(); + var lb = $('#form_first_name').prev(); + if ( lb.length == 0 ) { lb = $('#form_name').prev(); } lb.before(data.extra_name_info); } }); @@ -275,15 +276,16 @@ $(function(){ 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'), - q = ( $content.offset().left + $content.width() ) / 2; + 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 fixmystreet.map.pan(-q, -25, { animate: false }); fixmystreet.map.events.register("movestart", null, function(e){ fixmystreet.map.moveStart = { zoom: this.getZoom(), center: this.getCenter() }; }); fixmystreet.map.events.register("zoomend", null, function(e){ - if ( fixmystreet.map.moveStart && !fixmystreet.map.moveStart.zoom ) { + if ( fixmystreet.map.moveStart && !fixmystreet.map.moveStart.zoom && fixmystreet.map.moveStart.zoom !== 0 ) { return true; // getZoom() on Firefox appears to return null at first? } if ( !fixmystreet.map.moveStart || !this.getCenter().equals(fixmystreet.map.moveStart.center) ) { @@ -458,6 +460,7 @@ OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, { fixmystreet.markers.addFeatures( markers ); fixmystreet_activate_drag(); } + // check to see if markers are visible. We click the // link so that it updates the text in case they go // back @@ -506,7 +509,7 @@ OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, { fixmystreet.map.getProjectionObject() ); var p = fixmystreet.map.getViewPortPxFromLonLat(lonlat); - p.x -= ( o.left + w ) / 2; + p.x -= ( o.left - bo.left + w ) / 2; lonlat = fixmystreet.map.getLonLatFromViewPortPx(p); fixmystreet.map.panTo(lonlat); } |