Merge pull request #4372 from Leaflet/prosthetic-callbacks

Switch prosthetic-hand to 1.3.0 and use onStop callback
This commit is contained in:
Yohan Boniface 2016-04-02 17:59:58 +02:00
commit 714cbb9ec6
3 changed files with 61 additions and 55 deletions

View File

@ -18,7 +18,7 @@
"magic-string": "^0.7.0",
"mocha": "~2.3.0",
"phantomjs-prebuilt": "^2.1.4",
"prosthetic-hand": "^1.2.0",
"prosthetic-hand": "^1.3.0",
"uglify-js": "~2.4.23"
},
"main": "dist/leaflet-src.js",

View File

@ -53,15 +53,9 @@ describe("Map.Drag", function () {
});
map.setView([0, 0], 1);
var hand = new Hand({timing: 'fastframe'});
var mouse = hand.growFinger('mouse');
// We move 5 pixels first to overcome the 3-pixel threshold of
// L.Draggable.
mouse.wait(100).moveTo(200, 200, 0)
.down().moveBy(5, 0, 20).moveBy(256, 32, 200).up();
setTimeout(function () {
var hand = new Hand({
timing: 'fastframe',
onStop: function () {
var center = map.getCenter();
var zoom = map.getZoom();
document.body.removeChild(container);
@ -70,7 +64,14 @@ describe("Map.Drag", function () {
expect(zoom).to.be(1);
done();
}, 100);
}
});
var mouse = hand.growFinger('mouse');
// We move 5 pixels first to overcome the 3-pixel threshold of
// L.Draggable.
mouse.wait(100).moveTo(200, 200, 0)
.down().moveBy(5, 0, 20).moveBy(256, 32, 200).up();
});
});
@ -90,15 +91,9 @@ describe("Map.Drag", function () {
});
map.setView([0, 0], 1);
var hand = new Hand({timing: 'fastframe'});
var toucher = hand.growFinger('touch');
// We move 5 pixels first to overcome the 3-pixel threshold of
// L.Draggable.
toucher.wait(100).moveTo(200, 200, 0)
.down().moveBy(5, 0, 20).moveBy(256, 32, 200).up();
setTimeout(function () {
var hand = new Hand({
timing: 'fastframe',
onStop: function () {
var center = map.getCenter();
var zoom = map.getZoom();
document.body.removeChild(container);
@ -107,7 +102,14 @@ describe("Map.Drag", function () {
expect(zoom).to.be(1);
done();
}, 100);
}
});
var toucher = hand.growFinger('touch');
// We move 5 pixels first to overcome the 3-pixel threshold of
// L.Draggable.
toucher.wait(100).moveTo(200, 200, 0)
.down().moveBy(5, 0, 20).moveBy(256, 32, 200).up();
});
});

View File

@ -13,12 +13,10 @@ describe("Map.TouchZoom", function () {
});
map.setView([0, 0], 1);
var hand = new Hand({timing: 'fastframe'});
var f1 = hand.growFinger('touch');
var f2 = hand.growFinger('touch');
// L.DomEvent.on(document, 'prostheticHandStop', function () {
setTimeout(function () {
var hand = new Hand({
timing: 'fastframe',
onStop: function () {
map.once('zoomend', function () {
var center = map.getCenter();
var zoom = map.getZoom();
document.body.removeChild(container);
@ -29,7 +27,11 @@ describe("Map.TouchZoom", function () {
expect(zoom).to.be(4);
done();
}, 100);
});
}
});
var f1 = hand.growFinger('touch');
var f2 = hand.growFinger('touch');
hand.sync(5);
f1.wait(100).moveTo(275, 300, 0)
@ -53,12 +55,10 @@ describe("Map.TouchZoom", function () {
});
map.setView([0, 0], 4);
var hand = new Hand({timing: 'fastframe'});
var f1 = hand.growFinger('touch');
var f2 = hand.growFinger('touch');
// L.DomEvent.on(document, 'prostheticHandStop', function () {
setTimeout(function () {
var hand = new Hand({
timing: 'fastframe',
onStop: function () {
map.once('zoomend', function () {
var center = map.getCenter();
var zoom = map.getZoom();
document.body.removeChild(container);
@ -69,7 +69,11 @@ describe("Map.TouchZoom", function () {
expect(zoom).to.be(1);
done();
}, 100);
});
}
});
var f1 = hand.growFinger('touch');
var f2 = hand.growFinger('touch');
hand.sync(5);
f1.wait(100).moveTo(75, 300, 0)