Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

The Event pressmove doesn't work on desktop browsers (windows touchscreen)

Community Beginner ,
Dec 23, 2021 Dec 23, 2021

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

830
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 27, 2021 Dec 27, 2021

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

Translate
Community Expert ,
Dec 27, 2021 Dec 27, 2021

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 27, 2021 Dec 27, 2021

Alternatively, you can replace pressmove by a tick event and use boolean flags to detect if an instance is being dragged, for example.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 28, 2021 Dec 28, 2021

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 28, 2021 Dec 28, 2021

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 28, 2021 Dec 28, 2021
LATEST

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.!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines