Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gamelab: patch p5 to ignore out-of-bounds in _ontouchstart, _onmousedown #22389

Merged
merged 1 commit into from May 15, 2018

Conversation

cpirich
Copy link
Contributor

@cpirich cpirich commented May 14, 2018

  • We previously patched p5's _updateNextTouchCoords() and _updateNextMouseCoords() to verify that the mouse/touch locations are within the canvas bounds (play space). We now do the same for _ontouchstart() and _onmousedown(). Taps/clicks that begin outside the playspace will not result in state changes or events within p5 or p5play.
  • NOTE: we haven't changed how _onmouseup() and _ontouchend() are handled, so taps that begin in the canvas are considered "down" until released, even if the the location is dragged outside of the play space. The coordinates will never exceed the play space limits.

@cpirich cpirich requested a review from islemaster May 14, 2018 15:59
if (executeDefault === false) {
e.preventDefault();
}
//this._setMouseButton(e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason this line is commented out?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the way it is in the original p5 source. I wanted to leave it that way to ease our future diffs.

Copy link
Contributor

@islemaster islemaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fix!

@cpirich cpirich merged commit 2586dad into staging May 15, 2018
@cpirich cpirich deleted the gamelab_ignore_mouse_touch_out_of_bounds branch May 15, 2018 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants