Skip to content

Commit

Permalink
Fix gl2d camera events
Browse files Browse the repository at this point in the history
  • Loading branch information
dy committed Jan 26, 2018
1 parent 701edca commit fa1db3b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/plots/gl2d/camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var mouseChange = require('mouse-change');
var mouseWheel = require('mouse-wheel');
var mouseOffset = require('mouse-event-offset');
var cartesianConstants = require('../cartesian/constants');
var hasPassive = require('has-passive-events');

module.exports = createCamera;

Expand Down Expand Up @@ -63,15 +64,21 @@ function createCamera(scene) {
var xy = mouseOffset(ev.changedTouches[0], element);
handleInteraction(0, xy[0], xy[1]);
handleInteraction(1, xy[0], xy[1]);
});

ev.preventDefault();
}, hasPassive ? {passive: false} : false);
element.addEventListener('touchmove', function(ev) {
ev.preventDefault();
var xy = mouseOffset(ev.changedTouches[0], element);
handleInteraction(1, xy[0], xy[1]);
});

ev.preventDefault();
}, hasPassive ? {passive: false} : false);
element.addEventListener('touchend', function() {
handleInteraction(0, result.lastPos[0], result.lastPos[1]);
});

ev.preventDefault();
}, hasPassive ? {passive: false} : false);

function handleInteraction(buttons, x, y) {
var dataBox = scene.calcDataBox(),
Expand Down

0 comments on commit fa1db3b

Please sign in to comment.