juijs / jui-chart

SVG-based JUI chart that can be used in the browser and Node.js. Support many types of charts. (Dashboard, Map, Topology, Full 3D, Realtime)
https://codepen.io/collection/nLydod/
57 stars 25 forks source link

Support for touch events #109

Open syarul opened 8 years ago

syarul commented 8 years ago

Can't seem to work with touch events on mobile web when interacting with the canvas ie: zoom, it's good if we can have this. What say you?

seogi1004 commented 8 years ago

Let's review positively.

syarul commented 8 years ago

I believe the basic of this is to add document event listener for touchstart, touchmove, touchend, and touchcancel.

So for example, it could be something similar like this

this.on("axis.touchmove", function(e) {
  if(isMove) return;

  isMove = true;
  touchStartX = e.bgX;
  touchStartY = e.bgY;
  startValueX = axis.x.invert(e.chartX);
  startValueY = axis.y.invert(e.chartY);
  this.chart.emit("dragselect.start");
}, brush.axis);