Fix touches being empty in touchEnded() by using changedTouches by suhr25 · Pull Request #8601 · processing/p5.js

@suhr25

During a touchend event the W3C Touch Events spec moves the lifted
finger out of e.touches (active contacts only) and into
e.changedTouches. _updateTouchCoords iterated over e.touches.length,
which is 0 when the last finger lifts, so touches[] was always empty
inside touchEnded().

Fall back to e.changedTouches when e.touches is empty so that the
final touch position is accessible to user code in touchEnded().
getTouchInfo already contained the e.touches[i] || e.changedTouches[i]
fallback for individual lookups; this change fixes the loop bound that
prevented it from being reached.

Fixes: touches[] always being [] inside touchEnded() on single-touch