Map.DragSpec.js (Leaflet-1.8.0) | : | Map.DragSpec.js (Leaflet-1.9.0) | ||
---|---|---|---|---|
skipping to change at line 135 | skipping to change at line 135 | |||
}); | }); | |||
}); | }); | |||
it("does not change the center of the map when mouse is moved les s than the drag threshold", function (done) { | it("does not change the center of the map when mouse is moved les s than the drag threshold", function (done) { | |||
map = L.map(container, { | map = L.map(container, { | |||
dragging: true, | dragging: true, | |||
inertia: false | inertia: false | |||
}); | }); | |||
var originalCenter = L.latLng(0, 0); | var originalCenter = L.latLng(0, 0); | |||
map.setView(originalCenter, 1); | map.setView(originalCenter.clone(), 1); | |||
var spy = sinon.spy(); | var spy = sinon.spy(); | |||
map.on('drag', spy); | map.on('drag', spy); | |||
var hand = new Hand({ | var hand = new Hand({ | |||
timing: 'fastframe', | timing: 'fastframe', | |||
onStop: function () { | onStop: function () { | |||
expect(map.getZoom()).to.be(1); | expect(map.getZoom()).to.be(1); | |||
// Expect center point to be the same as before the click | // Expect center point to be the same as before the click | |||
expect(map.getCenter()).to.be(originalCen ter); | expect(map.getCenter()).to.eql(originalCe nter); | |||
expect(spy.callCount).to.eql(0); // No dr ag event should have been fired. | expect(spy.callCount).to.eql(0); // No dr ag event should have been fired. | |||
done(); | done(); | |||
} | } | |||
}); | }); | |||
var mouse = hand.growFinger('mouse'); | var mouse = hand.growFinger('mouse'); | |||
// We move 2 pixels to stay below the default 3-pixel thr eshold of | // We move 2 pixels to stay below the default 3-pixel thr eshold of | |||
// L.Draggable. This should result in a click and not a d rag. | // L.Draggable. This should result in a click and not a d rag. | |||
mouse.moveTo(200, 200, 0) | mouse.moveTo(200, 200, 0) | |||
skipping to change at line 276 | skipping to change at line 276 | |||
mouse.moveTo(300, 280, 0) | mouse.moveTo(300, 280, 0) | |||
.down().moveBy(5, 0, 20).moveBy(50, 50, 100).up() ; | .down().moveBy(5, 0, 20).moveBy(50, 50, 100).up() ; | |||
}); | }); | |||
it("does not change the center of the map when drag is disabled o n click", function (done) { | it("does not change the center of the map when drag is disabled o n click", function (done) { | |||
map = L.map(container, { | map = L.map(container, { | |||
dragging: true, | dragging: true, | |||
inertia: false | inertia: false | |||
}); | }); | |||
var originalCenter = L.latLng(0, 0); | var originalCenter = L.latLng(0, 0); | |||
map.setView(originalCenter, 1); | map.setView(originalCenter.clone(), 1); | |||
map.on('mousedown', function () { | map.on('mousedown', function () { | |||
map.dragging.disable(); | map.dragging.disable(); | |||
}); | }); | |||
var spy = sinon.spy(); | var spy = sinon.spy(); | |||
map.on('drag', spy); | map.on('drag', spy); | |||
var hand = new Hand({ | var hand = new Hand({ | |||
timing: 'fastframe', | timing: 'fastframe', | |||
onStop: function () { | onStop: function () { | |||
expect(map.getZoom()).to.be(1); | expect(map.getZoom()).to.be(1); | |||
// Expect center point to be the same as before the click | // Expect center point to be the same as before the click | |||
expect(map.getCenter()).to.be(originalCen ter); | expect(map.getCenter()).to.eql(originalCe nter); | |||
expect(spy.callCount).to.eql(0); // No dr ag event should have been fired. | expect(spy.callCount).to.eql(0); // No dr ag event should have been fired. | |||
done(); | done(); | |||
} | } | |||
}); | }); | |||
var mouse = hand.growFinger('mouse'); | var mouse = hand.growFinger('mouse'); | |||
// We move 5 pixels first to overcome the 3-pixel thresho ld of | // We move 5 pixels first to overcome the 3-pixel thresho ld of | |||
// L.Draggable. | // L.Draggable. | |||
mouse.moveTo(200, 200, 0) | mouse.moveTo(200, 200, 0) | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added |