rand256 / valetudo

Valetudo RE - experimental vacuum software, cloud free
Apache License 2.0
666 stars 73 forks source link

IOS map pinch zoom bugfix #383

Closed bensweet86 closed 3 years ago

bensweet86 commented 3 years ago

Bugfix to address https://github.com/rand256/valetudo/issues/90

PointerUp event seems to work find on Android devices but breaks with IOS when both fingers lifted within the same event. Original code only handled [0]th element and didn't correctly remove both finger lifts from this same event.

rand256 commented 3 years ago

Are you definitely sure that the this.ongoingGesture (a single variable) should be overwritten for each changedTouches (i.e. twice) and their order doesn't matter in this case?

bensweet86 commented 3 years ago

Resonably sure. Each removePointer function returns the this object and each performs a match that the incoming pointer id matches up with either the 1st or 2nd pointerId. Have tested this modification on Edge / Chrome, Safari (IOS14) and Chrome (Android). Interestingly the original code works fine for an Android, it looked like an IOS thing where it simultaneous finger lift from a pinch zoom resulted in 2x elements in the changedTouches object passed to the pointerUp function. Bug is in RE and the original Valetudo, been meaning to look into for a while. When this.ongoingGesture exists as type OngoingPan, there is a pointerId and pointer2Id which is what the 2x pointerUp touches align with.

rand256 commented 3 years ago

Okay, thank you!