aboutsummaryrefslogtreecommitdiffstats
path: root/web/js/map-OpenLayers.js
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2012-02-24 08:02:55 +0000
committerMatthew Somerville <matthew@mysociety.org>2012-02-24 08:02:55 +0000
commit4ce04db99fd13868b5d4fbba279dc35c10c01c6a (patch)
treee783521a45f88246d4cf9b8af46072f5a8c8468d /web/js/map-OpenLayers.js
parent459e6cb9d0c5aa1ccd56269c11c3c14a79c05726 (diff)
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.
Diffstat (limited to 'web/js/map-OpenLayers.js')
-rw-r--r--web/js/map-OpenLayers.js9
1 files changed, 8 insertions, 1 deletions
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';
}