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

Touch events API Chrome 70 now disabled in default settings.

Explorer ,
Oct 24, 2018 Oct 24, 2018

Copy link to clipboard

Copied

Hi,
the last Chrome update has blocked touch events on canvas, such as moving with objects. You need now manually(!!) enter into chrome://flags and enabled Touch events API. The same problem is with Edge, here is it necessary set in about:flags.
When I display HTML5 canvas scene in a browser, it is not possible to move with the finger on the touch screen with the object "obj".
Is there some way to solve it in Adobe Animate code?

Here is my code:
//
_this=this
var offset;

function setobject(evt)

{
var p1 = _this.globalToLocal(evt.stageX, evt.stageY);
this.offset = {x: evt.currentTarget.x - p1.x,y: evt.currentTarget.y - p1.y};

}

function moveobject(evt)

{
var p = _this.globalToLocal(evt.stageX, evt.stageY);

evt.currentTarget.x = p.x + this.offset.x;
evt.currentTarget.y = p.y + this.offset.y;


}

this.obj.addEventListener("mousedown", setobject)

this.obj.addEventListener("pressmove", moveobject)
//

When I set for example "touch-action: none" in CSS, it seems to help but it does not work with a multi-touch.

Is there any solution?

Thank you!

Views

2.4K

Translate

Translate

Report

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
LEGEND ,
Oct 24, 2018 Oct 24, 2018

Copy link to clipboard

Copied

Apparently they're only disabled on desktop versions of Chrome:

The ontouch* APIs default to disabled on desktop - Chrome Platform Status

Why would you be using touch events on the desktop? You should be using mouse events for desktop interaction.

Supporting both TouchEvent and MouseEvent - Web APIs | MDN

Votes

Translate

Translate

Report

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
Explorer ,
Oct 24, 2018 Oct 24, 2018

Copy link to clipboard

Copied

Because I'm creating a program for kids on the touch screen with Windows. I need to put the figure in the example with a touch and not with mouse.

http://www.hrajeme-si.cz/iskolicka/hrajemesi/ukazka/sample1.html

Votes

Translate

Translate

Report

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
LEGEND ,
Oct 24, 2018 Oct 24, 2018

Copy link to clipboard

Copied

Unless you're doing multi-touch interactions, you should be fine just using the mouse events. All touch screen drivers automatically simulate mouse events.

Votes

Translate

Translate

Report

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
Explorer ,
Oct 24, 2018 Oct 24, 2018

Copy link to clipboard

Copied

But have you tried my code? Or my sample on touch screen? Does not work. What code will work to move objects by touching with the browser's default setting to Touch event API disabled? And yes, I really need multi-touch for more kids...

Votes

Translate

Translate

Report

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
New Here ,
Mar 24, 2021 Mar 24, 2021

Copy link to clipboard

Copied

LATEST

Did you ever find an answer to this as i have the same issue!

Votes

Translate

Translate

Report

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