Skip to content

Instantly share code, notes, and snippets.

@IvanSanchez
Created March 14, 2016 14:13
Show Gist options
  • Save IvanSanchez/d450addb6f4f24881b7e to your computer and use it in GitHub Desktop.
Save IvanSanchez/d450addb6f4f24881b7e to your computer and use it in GitHub Desktop.
describe("mouse events", function () {
it("change the center of the map", function (done) {
var container = document.createElement('div');
container.style.width = '600px';
container.style.height = '400px';
container.style.background = '#808080';
container.style.position = 'absolute';
container.style.top = 0;
container.style.left = 0;
document.body.appendChild(container);
var map = new L.Map(container, {
dragging: true
});
map.setView([0, 0], 1);
var hand = new Hand();
var mouse = hand.growFinger('mouse');
mouse.wait(100).moveTo(200, 200, 0)
.down().moveBy(256, 0, 200).up();
map.on('mousedown mouseup mousemove', function(ev){
// console.log('L: ', performance.now(), JSON.stringify(ev.originalEvent));
console.log('L: ', performance.now(), ev.originalEvent);
});
console.log('L center: ', map.getCenter());
console.log('H: ', hand);
console.log('P: ', performance.now());
setTimeout(function(){
var center = map.getCenter();
// expect(center.lat).to.be(0);
// expect(center.lng).to.be.within(-13.685, -13.686);
console.log('L center: ', center);
console.log('H: ', hand);
console.log('P: ', performance.now());
document.body.removeChild(container);
done();
}, 1000);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment