Added documentDrag option to the DragPan control and Drag handler.
When set to true, this allow pan-dragging while outside the map. Thanks vmx for the initial patches. r=vmx, bartvde (closes #39) git-svn-id: http://svn.openlayers.org/trunk/openlayers@9791 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -36,6 +36,28 @@
|
||||
t.eq(map.getCenter().lat, res * 5, "Lat is " + (res * 5) + " after drag");
|
||||
t.eq(map.getCenter().lon, res * -5, "Lon is " + (res * -5) + " after drag");
|
||||
}
|
||||
function test_Control_DragPan_drag_documentDrag (t) {
|
||||
t.plan(4);
|
||||
control = new OpenLayers.Control.DragPan({documentDrag: true});
|
||||
map = new OpenLayers.Map("map", {controls:[control]});
|
||||
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||
"http://labs.metacarta.com/wms/vmap0",
|
||||
{layers: 'basic'} );
|
||||
map.addLayer(layer);
|
||||
map.zoomToMaxExtent();
|
||||
map.zoomIn();
|
||||
control.activate();
|
||||
|
||||
res = map.baseLayer.resolutions[map.getZoom()];
|
||||
t.eq(map.center.lat, 0, "Lat is 0 before drag");
|
||||
t.eq(map.center.lon, 0, "Lon is 0 before drag");
|
||||
map.events.triggerEvent('mousedown', {'type':'mousedown', 'xy':new OpenLayers.Pixel(0,0), 'which':1});
|
||||
map.events.triggerEvent('mousemove', {'type':'mousemove', 'xy':new OpenLayers.Pixel(5,5), 'which':1});
|
||||
map.events.triggerEvent('mouseup', {'type':'mouseup', 'xy':new OpenLayers.Pixel(5,5), 'which':1});
|
||||
|
||||
t.eq(map.getCenter().lat, res * 5, "Lat is " + (res * 5) + " after drag");
|
||||
t.eq(map.getCenter().lon, res * -5, "Lon is " + (res * -5) + " after drag");
|
||||
}
|
||||
function test_Control_DragPan_click(t) {
|
||||
t.plan(1);
|
||||
var control = new OpenLayers.Control.DragPan();
|
||||
|
||||
Reference in New Issue
Block a user