space-truckers
space-truckers copied to clipboard
Check pointer indices against prior state in touch, mouse event handling
The code that reads pointer events was originally written to use pointer down and up events to perform the same tasks as the PointerTap event. This is because there needs to be a way to remove the input entry after it has been read and processed, and for event-based inputs like mouse and keyboard, there needs to be a corresponding OFF- type event to go with an ON- (or DOWN) event:
if (pointerInfo.type === PointerEventTypes.POINTERTAP) {
this.inputMap["PointerTap"] = pointerInfo.event; // no way to remove this when the event is completed
}
// BUG! whether this works or not is entirely determined by the order that events are processed
else if (pointerInfo.type === PointerEventTypes.POINTERUP) {
if (this.inputMap["PointerTap"] != null) {
delete this.inputMap["PointerTap"]; // <-- hack
}
}
});
Might need to expand the touch/mouse input maps to include mouse buttons