Reworking click and pinch handling to get better behavior on multi-touch devices. r=ahocevar +testing from others (closes #3133)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@11695 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2011-03-11 01:53:26 +00:00
parent 3ce239208f
commit 5b7d530461
6 changed files with 488 additions and 184 deletions

View File

@@ -102,6 +102,29 @@
}
function test_clickHandlerOptions(t) {
t.plan(3);
var nav = new OpenLayers.Control.TouchNavigation();
t.eq(nav.clickHandlerOptions, null, "clickHandlerOptions null by default");
var map = new OpenLayers.Map({
div: document.body,
controls: [
new OpenLayers.Control.TouchNavigation({
clickHandlerOptions: {foo: "bar"}
})
]
});
nav = map.controls[0];
t.eq(nav.handlers.click.foo, "bar", "foo property is set on the click handler");
t.eq(nav.handlers.click.pixelTolerance, 2, "pixelTolerance is 2 by default");
map.destroy();
}
function test_zoomOut(t) {
t.plan(1);
@@ -114,7 +137,7 @@
var control = new OpenLayers.Control.TouchNavigation();
map.addControl(control);
var handler = control.handlers.click;
handler.touchstart({xy: {x: 1, y: 1}, touches: ["foo", "bar"]});
handler.touchstart({xy: new OpenLayers.Pixel(1 ,1), touches: ["foo", "bar"]});
handler.touchend({});
t.delay_call(1, function() {
t.eq(map.getZoom(), 4, "Did we zoom out?");