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

@@ -61,13 +61,12 @@ describe('ol.handler.Drag', function() {
});
it('calls the default action on the default control', function() {
var control = new ol.control.DefaultControl();
spyOn(control, 'defaultDrag');
map.setDefaultControl(control);
var control = {handleEvent: jasmine.createSpy()};
map.setDefaultDragControl(control);
var handler = new ol.handler.Drag(map, {});
handler.dragger_.dispatchEvent({type: 'drag'});
expect(control.defaultDrag).toHaveBeenCalled();
expect(control.handleEvent).toHaveBeenCalled();
});
});
});

View File

@@ -32,13 +32,12 @@ describe('ol.handler.MouseWheel', function() {
});
it('calls the default action on the default control', function() {
var control = new ol.control.DefaultControl();
spyOn(control, 'defaultMouseWheel');
map.setDefaultControl(control);
var control = {handleEvent: jasmine.createSpy()};
map.setDefaultMouseWheelControl(control);
var handler = new ol.handler.MouseWheel(map, {});
handler.handleMouseWheel(new goog.events.MouseWheelEvent(1, 'foo', 0, 1));
expect(control.defaultMouseWheel).toHaveBeenCalled();
expect(control.handleEvent).toHaveBeenCalled();
});
});