Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

ngTouch - Keep track of touch by identifier #7935

Closed
@pfried

Description

@pfried

I am currently developing a multitouch application and tried to use ngTouch here. I stumbled upon an implementation which can handle only one touch at a time. I am wondering if this is done by purpose as i dont know about the side effects of my idea.

Right now ngTouch alters the ng-click directive, so it will work with touch events, but the implementation works with only one touch at a time.

Any OS, any Browser
Angular and ngTouch Version 1.2.17

I created a plunkr to demonstate, please use a touch device with multiple touches:
http://plnkr.co/edit/s2vkc4neFzha6nsBSGQG

If you hold one button, the other one will not work anymore, altough the touchstart and touchend events are triggered. I think this is due to 3 reasons:

  1. The touchstart event handler on the element takes the first touch in the list of touches instead of the targetTouches. If there is another touch in progress it will take it as the touchstart coordinates which is wrong (at least semantically) since this is not the touch which occured.
  2. The preventGhostClick function can only handle one event too.
  3. The tapping property gets reset if any touch move event happens

In my case i am trying to use a 2D-Joystick which gets dragged around all the time. Additionally i want to trigger some other stuff like a horn. I looked for a solution to get this behavior, but had no success, the only thing left would be to attach the touch handlers manually.

I would be glad to provide a pull request if wished.

Note: Currently there is a problem if jQuery included, the starting coordinates are NaN for the touchstart. See #4583

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions