From 4ce04db99fd13868b5d4fbba279dc35c10c01c6a Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Fri, 24 Feb 2012 08:02:55 +0000 Subject: Pan map when reporting click is where sidebar will be. If the user clicks on the map in a location where the help text sidebar will appear, pan the map to the right the width of the sidebar so that the pin and its location remain visible. --- web/js/map-OpenLayers.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'web/js/map-OpenLayers.js') diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js index 2eb949b76..3d1d725f2 100644 --- a/web/js/map-OpenLayers.js +++ b/web/js/map-OpenLayers.js @@ -372,7 +372,7 @@ OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, { trigger: function(e) { var lonlat = fixmystreet.map.getLonLatFromViewPortPx(e.xy); if (fixmystreet.page == 'new') { - /* Already have a purple pin */ + /* Already have a pin */ fixmystreet.markers.features[0].move(lonlat); } else { var markers = fms_markers_list( [ [ lonlat.lat, lonlat.lon, 'yellow' ] ], false ); @@ -414,6 +414,13 @@ OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, { $('#side').hide(); $('#sub_map_links').hide(); heightFix('#report-a-problem-sidebar:visible', '.content', 26); + var sidebar = $('#report-a-problem-sidebar'); + if (sidebar.css('position') == 'absolute') { + var w = sidebar.width(), h = sidebar.height(), o = sidebar.offset(); + if (e.xy.x >= o.left && e.xy.x <= o.left + w && e.xy.y >= o.top && e.xy.y <= o.top + h) { + fixmystreet.map.pan(-w, 0, { animate: false }); + } + } fixmystreet.page = 'new'; location.hash = 'report'; } -- cgit v1.2.3