Replace the navigation control by two controls, namely DragPan and MouseWheelZoom. DragPan is the map default drag control. MouseWheelZoom is the map default mouse wheel control.

This commit is contained in:
Éric Lemoine
2012-07-13 08:57:40 +02:00
parent f4532f1548
commit c2a30f4ac4
9 changed files with 108 additions and 96 deletions

View File

@@ -4,7 +4,8 @@
* Provides a class for listening to drag sequences on a DOM element and
* dispatching dragstart, drag and dragend events to a map object.
*
* The default behavior for the drag event is moving the map.
* Calls handleDragEvent on the map if default is not prevented by
* listeners.
*/
goog.provide('ol.handler.Drag');
@@ -101,10 +102,7 @@ ol.handler.Drag.prototype.handleDrag = function(e) {
this.prevY_ = e.clientY;
var rt = goog.events.dispatchEvent(this.map_, newE);
if (rt) {
var defaultControl = this.map_.getDefaultControl();
if (defaultControl) {
defaultControl.defaultDrag(newE);
}
this.map_.handleDragEvent(newE);
}
};

View File

@@ -4,7 +4,8 @@
* Provides a class for listening to mousewheel events on a DOM element
* and dispatching mousewheel events to a map instance.
*
* The default behavior for the mousewheel event is zooming the map.
* Calls handleMouseWheelEvent on the map if default is not prevented by
* listeners.
*/
goog.provide('ol.handler.MouseWheel');
@@ -47,9 +48,6 @@ ol.handler.MouseWheel.prototype.handleMouseWheel = function(e) {
var newE = new ol.events.MapEvent(ol.events.MapEventType.MOUSEWHEEL, e);
var rt = goog.events.dispatchEvent(this.map_, newE);
if (rt) {
var defaultControl = this.map_.getDefaultControl();
if (defaultControl) {
defaultControl.defaultMouseWheel(newE);
}
this.map_.handleMouseWheelEvent(newE);
}
};
};