Fix event listeners for multi-input devices

This is a repost of #1139. These changes correct behaviour on multi-input devices (ie. Desktops with mouse and touchscreen) and devices which trigger both mouse and touch events at the same time (ie. iPad/iPhone).