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

Improve mousemove/mouseup when dragging outside the game canvas #118

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

jefvel
Copy link
Contributor

@jefvel jefvel commented Jan 26, 2023

Currently, if a player clicks and drags the mouse outside the game window, it'll act as if the mouse was released. It's not consistent with the other non-HTML5 targets.

This PR fixes that. It makes it possible to click, drag, and move the mouse outside the game window. If the user releases the mouse button outside the window it'll trigger as expected.

I've tested this in chrome+firefox and iOS and Android.

An optional feature would be to add the following CSS to the index.html file.

      html,
      body,
      canvas {
        touch-action: none;
        touch-action-delay: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none !important;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
      }

However, it's not really needed. But it helps on mobile targets.

@jefvel jefvel changed the title Made mousemove events work when clicking and then dragging outside the game window Improve mousemove/mouseup when dragging outside the game canvas Jan 26, 2023
@RowanFuture
Copy link
Contributor

+1 this would be great

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.

2 participants