Copy link to clipboard
Copied
I have this code that uses the events mousedown , pressmove and pressup ,it runs fine on Android ,IOS ,and windows . but on windows using the touchscreen I receive mousedown and pressup but the event pressmove not triged.
container.addEventListener("pressup", onpressup);
container.addEventListener("pressmove", onpressmove);
container.addEventListener("mousedown", onmousedown);
I dont change the target after the mousedown event
Hi.
My best guess is that you'll have to rely on JavaScript's native touch events rather than CreateJS's events for this specific situation.
https://www.w3schools.com/jsref/obj_touchevent.asp
CreateJS is no longer updated, so I don't know if this suit of libraries will ever get any updates for that. Maybe you could try contacting Grant Skinner or someone else on the team.
Regards,
JC
Copy link to clipboard
Copied
Hi.
My best guess is that you'll have to rely on JavaScript's native touch events rather than CreateJS's events for this specific situation.
https://www.w3schools.com/jsref/obj_touchevent.asp
CreateJS is no longer updated, so I don't know if this suit of libraries will ever get any updates for that. Maybe you could try contacting Grant Skinner or someone else on the team.
Regards,
JC
Copy link to clipboard
Copied
Alternatively, you can replace pressmove by a tick event and use boolean flags to detect if an instance is being dragged, for example.
Copy link to clipboard
Copied
Thank you very much for your clarification. I am using animate to create an interactive application, is there a solution for the container object to receive a native event or do I need to change the libraries?
Copy link to clipboard
Copied
Hi.
Maybe you won't need native events if you replace the pressmove event by a tick event. Like this:
var container = this.yourContainer;
var getMouse = function(){ return container.globalToLocal(stage.mouseX, stage.mouseY); };
var target = null;
createjs.Touch.enable(stage);
stage.mouseMoveOutside = true;
container.children.forEach(function(child){ child.mouseChildren = false; });
container.on("mousedown", function(e)
{
var point = getMouse();
e.target.offset = { x: point.x - e.target.x, y: point.y - e.target.y };
target = e.target;
});
createjs.Ticker.on("tick", function(e)
{
if (target)
{
var point = getMouse();
target.x = point.x - target.offset.x;
target.y = point.y - target.offset.y;
}
});
container.on("pressup", function(e)
{
target = null;
});
I hope this helps.
Regards,
JC
Copy link to clipboard
Copied
On my laptop touchsceen ,the touch finger on Windows only triggers mousedown and mouseup if I "click", otherwise mousedown + move + mouseup doesn't trigger any of these events.!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more