Skip to main content
vvk10839047
Participant
November 27, 2016
Question

Canvas drag and drop with touch

  • November 27, 2016
  • 3 replies
  • 2191 views

I created drag and drop but touchstart don't work.

var cl = this.cl;

createjs.Touch.enable(stage);

cl.addEventListener("touchstart", onTouch.bind(cl));

function onTouch(e) {

  thisCl.addChild(activeCl);

  canvas.addEventListener('touchmove', moveTouch);

  canvas.addEventListener("touchend", mUp);

}

function mUp() {

  canvas.removeEventListener('mousemove', move);

  canvas.addEventListener('touchmove', moveTouch);

}

function move() {

  cl.x = stage.mouseX;

  cl.y = stage.mouseY;

}

This topic has been closed for replies.

3 replies

vvk10839047
Participant
November 27, 2016

This is mouse events example test .

In mouse events PC work but in mobile don't work

Legend
November 28, 2016

This is a long shot, but try adding this:

createjs.Touch.enable(stage);

vvk10839047
Participant
November 27, 2016

Mouse Events don't work on mobile

Colin Holgate
Inspiring
November 27, 2016

I think most web sites work on mobile, even if they're only using mouse events.

Colin Holgate
Inspiring
November 27, 2016

I'm not sure if this issue is still the case:

touchstart callback doesn't work · Issue #465 · CreateJS/EaselJS · GitHub

Does it work any better if you use mousedown or pressed? Could be worth reading this article:

EaselJS Tutorial: Mouse Interaction