From 30e9ea5a8203e0f059c533def90c42f7ca7dc7c5 Mon Sep 17 00:00:00 2001 From: eska Date: Wed, 23 Nov 2016 23:53:38 +0100 Subject: Fix some mouse bugs in WebAssembly/asm.js - Emit mouse wheel release events - Set button masks, fixes #5092 --- platform/javascript/javascript_main.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'platform/javascript/javascript_main.cpp') diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp index af12384bc..586ccc9b4 100644 --- a/platform/javascript/javascript_main.cpp +++ b/platform/javascript/javascript_main.cpp @@ -66,11 +66,12 @@ static void _glut_mouse_button(int button, int state, int x, int y) { if (ev.mouse_button.button_index<4) { if (ev.mouse_button.pressed) { - _mouse_button_mask|=1<push_input(ev); + if (ev.mouse_button.button_index==BUTTON_WHEEL_UP || ev.mouse_button.button_index==BUTTON_WHEEL_DOWN) { + // GLUT doesn't send release events for mouse wheel, so send manually + ev.mouse_button.pressed=false; + os->push_input(ev); + } } @@ -162,7 +168,6 @@ int main(int argc, char *argv[]) { glutMouseFunc(_glut_mouse_button); glutMotionFunc(_glut_mouse_motion); - glutMotionFunc(_glut_mouse_motion); glutPassiveMotionFunc(_glut_mouse_motion); -- cgit v1.2.3-70-g09d2