From bb9623adec62c1ee07a896d064aa500605f5756d Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Tue, 26 Jul 2011 23:08:52 +0200 Subject: [PATCH] Issue #1230456 by ao2: Add documentDrag behaviour to Navigation control X-Face: z*RaLf`X<@C75u6Ig9}{oW$H;1_\2t5)({*|jhM/Vb;]yA5\I~93>J<_`<4)A{':UrE Add a behavior to set the documentDrag option[1] to OpenLayers.Control.Navigation, without this setting dragging the map stops whenever another element is intercepted with the mouse. [1] http://dev.openlayers.org/docs/files/OpenLayers/Control/Navigation-js.html#OpenLayers.Control.Navigation.documentDrag --- .../behaviors/js/openlayers_behavior_navigation.js | 3 ++- .../behaviors/openlayers_behavior_navigation.inc | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/includes/behaviors/js/openlayers_behavior_navigation.js b/includes/behaviors/js/openlayers_behavior_navigation.js index 305a7d1..daf28c6 100644 --- a/includes/behaviors/js/openlayers_behavior_navigation.js +++ b/includes/behaviors/js/openlayers_behavior_navigation.js @@ -14,7 +14,8 @@ Drupal.behaviors.openlayers_behavior_navigation = { if (data && data.map.behaviors['openlayers_behavior_navigation']) { // Add control var options = { - 'zoomWheelEnabled': data.map.behaviors['openlayers_behavior_navigation'].zoomWheelEnabled + 'zoomWheelEnabled': data.map.behaviors['openlayers_behavior_navigation'].zoomWheelEnabled, + 'documentDrag': Boolean(data.map.behaviors['openlayers_behavior_navigation'].documentDrag), }; var control = new OpenLayers.Control.Navigation(options); data.openlayers.addControl(control); diff --git a/includes/behaviors/openlayers_behavior_navigation.inc b/includes/behaviors/openlayers_behavior_navigation.inc index a32d1c4..20341cb 100644 --- a/includes/behaviors/openlayers_behavior_navigation.inc +++ b/includes/behaviors/openlayers_behavior_navigation.inc @@ -15,7 +15,8 @@ class openlayers_behavior_navigation extends openlayers_behavior { function options_init() { return array( 'navigation' => '', - 'zoomWheelEnabled' => TRUE + 'zoomWheelEnabled' => TRUE, + 'documentDrag' => FALSE, ); } @@ -31,7 +32,13 @@ class openlayers_behavior_navigation extends openlayers_behavior { '#description' => t('Enable zooming via the mouse scroll wheel. This can interfere with page scrolling.'), '#default_value' => isset($defaults['zoomWheelEnabled']) ? $defaults['zoomWheelEnabled'] : TRUE - ) + ), + 'documentDrag' => array( + '#type' => 'checkbox', + '#title' => t('Document Drag'), + '#description' => t('Allow panning of the map by dragging outside map viewport.'), + '#default_value' => isset($defaults['documentDrag']) ? $defaults['documentDrag'] : FALSE + ), ); } -- 1.7.5.4