Skip to content

Commit

Permalink
Moved delete only if it exists (#4883)
Browse files Browse the repository at this point in the history
Co-authored-by: Steven Yau <[email protected]>
  • Loading branch information
yaustar and steveny-sc committed Nov 23, 2022
1 parent d72a749 commit 2bab034
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/framework/input/element-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -745,9 +745,10 @@ class ElementInput {
const lastTouchUp = this._clickedEntities[guid] || 0;
const dt = Date.now() - lastTouchUp;
fireClick = dt > 300;

// We do not check another time, so the worst thing that can happen is one ignored click in 300ms.
delete this._clickedEntities[guid];
}
// We do not check another time, so the worst thing that can happen is one ignored click in 300ms.
delete this._clickedEntities[guid];
if (fireClick) {
this._fireEvent('click', new ElementMouseEvent(event, this._hoveredElement, camera, targetX, targetY, this._lastX, this._lastY));
}
Expand Down

0 comments on commit 2bab034

Please sign in to comment.