zingtouch icon indicating copy to clipboard operation
zingtouch copied to clipboard

Expand and pinch fire in alternating order on pinch

Open danielksato opened this issue 5 years ago • 7 comments

In release 1.0.6, when an expand listener and a pinch listener are both bound, the listeners fire in alternating order on a pinch. They do not fire at all on an expand.

Downgrading to 1.0.5 solves this issue, but only when the expand listener is bound before the pinch listener.

danielksato avatar Aug 14 '18 19:08 danielksato

My guess is that this is because of the way Pinch and Expand are structured to extend the same Distance class, which knows about Pinch and Expand (this seems like a bad idea) and demultiplexes on the constructor name.

Why is there even a difference between Pinch and Expand in the first place? There should just be a single Pinch class which reports a "changeSinceLast" or some such piece of data. If it's positive, you've got an expand, if it's negative, you've got a pinch. Simpler, clearer, easier to use, more efficient.

I'm not sure this library is still being maintained actively, so I'm thinking of developing my own fork. I would prefer to just contribute to this project, but the testing pipeline is broken, the devDependencies are deprecated, and the maintainer doesn't seem to be responding to issues or pull requests.

mvanderkamp avatar Aug 19 '18 16:08 mvanderkamp

It's frustrating, because my organization has been looking at adopting zingtouch as a replacement for Hammer.js, which hasn't been updated in a year. I want to avoid forking if I can.

danielksato avatar Aug 19 '18 16:08 danielksato

Hey @mvanderkamp and @danielksato, the Pinch/Expand class were previously different enough to warrant their own classes, but at some point it made more sense to perform the logic in the distance class. While maintaining this project is not a top priority we will look into these issues this week. Feel free to submit a pull request to help out.

mike-schultz avatar Aug 19 '18 23:08 mike-schultz

@mike-schultz Thanks for responding! I'll try to submit a PR this week if I have time, but unfortunately I can't make any guarantees - I've got a deadline looming myself.

danielksato avatar Aug 19 '18 23:08 danielksato

I've submitted a PR that seems to fix things up for me: #48

mvanderkamp avatar Aug 20 '18 16:08 mvanderkamp

Do you mind if I do a bit of general cleanup in the code?

mvanderkamp avatar Aug 20 '18 16:08 mvanderkamp

Is there a release planned soon with this update ?

emri99 avatar Sep 18 '18 11:09 emri99