ng2-events icon indicating copy to clipboard operation
ng2-events copied to clipboard

touchend is equal to touchstart

Open jftsaraiva opened this issue 8 years ago • 1 comments

Hi,

  • I have multiple controls
  • I start selection hover one control
  • I end selection hover another control

If i'm using mouse events it works fine. In mousedown I get the first control and in mouseup I get the second control.

But if i'm using touch events i'm getting only the first control. In touchstart I get the first control (it's correct) but in touchend I was expecting the second control - but get first control again.

I'm using version 4.1.0 with angular 5.2.2 and the relevant code is:

<ng-template ngFor let-item let-i="index" [ngForOf]="locals.Locals">
      <svg:g (down)="activate($event, item)" (up)="deactivate($event, item)" class="container small"

Thanks.

jftsaraiva avatar Feb 06 '18 23:02 jftsaraiva

Hi @jftsaraiva, I'm really sorry, I must have somehow totally missed this issue.

Apparently this is not a bug but indeed a feature for touch events:

The event's target is the same element that received the touchstart event corresponding to the touch point, even if the touch point has moved outside that element.

Source: https://developer.mozilla.org/de/docs/Web/API/TouchEvent

Did you manage to find a way around your problem?

All this library does for the up/down/move events is mapping them to their mouse, touch, and pointer counterparts. For more sophisticated touch logic, I would suggest something like HammerJS

kryops avatar May 05 '18 13:05 kryops