8000
  • Fix lost MouseButtonUp events when cursor leaves canvas (Web/WASM) by TheRedDeveloper · Pull Request #602 · not-fl3/miniquad · GitHub
    [go: up one dir, main page]

    Skip to content

    Fix lost MouseButtonUp events when cursor leaves canvas (Web/WASM) - #602

    Open
    TheRedDeveloper wants to merge 1 commit into
    not-fl3:masterfrom
    TheRedDeveloper:releaseoutsidecanvasfix
    Open

    TheRedDeveloper wants to merge 1 commit into
    not-fl3:masterfrom
    TheRedDeveloper:releaseoutsidecanvasfix

    Conversation

    @TheRedDeveloper
    Copy link
    Copy Markdown

    Problem:

    In the WASM target, the mouse event listener for mouseup was attached directly to the canvas element (canvas.onmouseup).

    If a user clicks inside the canvas, drags the mouse outside the canvas boundaries, and then releases the button, the canvas element does not receive the event. This causes the application to miss the MouseButtonUp event and think the mouse is still held down.

    Solution:

    Changed the event binding in gl.js to listen for mouseup on the global window object instead of the canvas. This ensures the release event is caught regardless of where the cursor is (on and off the page).

    Yes, this is the same issue as the one in the PR on macroquad, except this one is a web issue.

    Hope this can get merged soon.

    Tigon32 added a commit to Tigon32/miniquad that referenced this pull request Nov 10, 2026
    Tigon32 added a commit to Tigon32/miniquad that referenced this pull request Nov 10, 2026
    …ot-fl3#698, not-fl3#602 (#1)
    
    * Integrate upstream PRs not-fl3#701, not-fl3#698, not-fl3#602: js/gl.js
    
    * ci: add targeted Rust WebAssembly and JS build checks
    
    * ci: allow generating Cargo.lock for library builds
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Labels

    None yet

    Projects

    None yet
    3D3E

    Development

    Successfully merging this pull request may close these issues.

    1 participant

    0