Skip to content
Snippets Groups Projects
Commit 09c7d0ce authored by Brandon Bergren's avatar Brandon Bergren
Browse files

* Remove my mousewheel zooming code and rely on google's, it's worked properly since 2.102!

* Remove references to mousewheel.js, clean up variable.
* Add support for Continuous Zoom, enabled by default.
* Add behavior flag for disabling Continuous Zoom.
* Remove workaround from may 2007 (rev 1.1.2.15) that was causing zooming problems.
parent 36f9aaa5
No related branches found
Tags 6.x-2.0-beta1
No related merge requests found
......@@ -76,3 +76,12 @@ function gmap_update_5001() {
menu_rebuild();
return $ret;
}
/**
* Mini-update -- mousewheel.js no longer needed.
*/
function gmap_update_5002() {
$ret = array();
variable_del('gmap_load_zoom_plugin');
return $ret;
}
......@@ -122,9 +122,6 @@ function gmap_gmap($op, &$map) {
if (isset($map['behavior']['locpick']) && $map['behavior']['locpick']) {
drupal_add_js($path .'locpick.js');
}
if (variable_get('gmap_load_zoom_plugin', FALSE) && !$map['behavior']['nomousezoom']) {
drupal_add_js(drupal_get_path('module', 'gmap') .'/thirdparty/mousewheel.js');
}
if (!empty($map['markers']) || !empty($map['lines'])) {
drupal_add_js($path .'markerloader_static.js');
}
......@@ -161,6 +158,11 @@ function gmap_gmap($op, &$map) {
'default' => FALSE,
'help' => t('Disable using the scroll wheel to zoom the map.'),
),
'nocontzoom' => array(
'title' => t('Disable Continuous Zoom'),
'default' => FALSE,
'help' => t('Disable dynamically resizing images while waiting for tiles to load when zooming.'),
),
'autozoom' => array(
'title' => t('Use AutoZoom'),
'default' => FALSE,
......
......@@ -35,19 +35,6 @@ function gmap_admin_settings(&$form_state) {
'#value' => t("Managed by <a href='@url'>keys api</a>.", array('@url' => url('admin/settings/keys'))),
);
}
$form['initialization']['gmap_load_zoom_plugin'] = array(
'#type' => 'checkbox',
'#title' => t('Enable mousewheel zooming'),
'#default_value' => variable_get('gmap_load_zoom_plugin', FALSE),
'#description' => t('Enables the mousewheel.js jQuery plugin, which adds the ability to use the mouse wheel to zoom the map.'),
);
if (!file_exists(drupal_get_path('module', 'gmap') .'/thirdparty/mousewheel.js')) {
variable_set('gmap_load_zoom_plugin', FALSE);
$form['initialization']['gmap_load_zoom_plugin']['#default_value'] = FALSE;
$form['initialization']['gmap_load_zoom_plugin']['#value'] = FALSE;
$form['initialization']['gmap_load_zoom_plugin']['#disabled'] = TRUE;
$form['initialization']['gmap_load_zoom_plugin']['#description'] += '<br />'. t('<em>The mousewheel.js file was not found. Please download and place in the <b>thirdparty/</b> folder.</em>');
}
if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) != FILE_DOWNLOADS_PUBLIC) {
$form['initialization']['gmap_private_markerfile'] = array(
......
......@@ -268,37 +268,21 @@ Drupal.gmap.addHandler('gmap',function(elem) {
},0);
}
map.setCenter(new GLatLng(obj.vars.latitude,obj.vars.longitude), obj.vars.zoom);
if ($.fn.mousewheel && !obj.vars.behavior.nomousezoom) {
$(elem).mousewheel(function(event, delta) {
var zoom = map.getZoom();
if (delta > 0) {
zoom++;
}
else if (delta < 0) {
zoom--;
}
map.setZoom(zoom);
// Event handled.
return false;
});
if (!obj.vars.nocontzoom) {
map.enableDoubleClickZoom();
map.enableContinuousZoom();
}
if (!obj.vars.nomousezoom) {
map.enableScrollWheelZoom();
}
// Send out outgoing zooms
GEvent.addListener(obj.map, "zoomend", function(oldzoom,newzoom) {
GEvent.addListener(map, "zoomend", function(oldzoom,newzoom) {
obj.vars.zoom = newzoom;
obj.change("zoom", _ib.zoom);
});
// Sync zoom if different after move.
// Partial workaround for a zoom + move bug.
// Full solution will involve listening to movestart and forbidding zooms
// until complete.
GEvent.addListener(map, "moveend", function() {
if (map.getZoom() != obj.vars.zoom) {
obj.change("zoom");
}
});
// Send out outgoing moves
GEvent.addListener(map,"moveend",function() {
var coord = map.getCenter();
......
......@@ -5,14 +5,6 @@ Place downloaded third party code in this folder if instructed to by GMap.
(todo: document better)
mousewheel.js
-------------
JQuery Mouse Wheel plugin by Brandon Aaron
Website: http://dev.jquery.com/browser/trunk/plugins/mousewheel
Tested with SVN revision 1497.
Tested version at: http://dev.jquery.com/export/1497/trunk/plugins/mousewheel/mousewheel.js
clusterer2.js
------------
Marker clusterer addon by Jef Poskanzer
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment