1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0032686: Visualization, Wasm_Window - filter out unexpected pressed buttons state within mouse move / up events

Wasm_Window::ProcessMouseEvent() now ignores not previously pressed mouse buttons within mouse move / up events.
Fixed -Wshorten-64-to-32 compiler warning within cpulimit command on 32-bit Linux.
This commit is contained in:
kgv
2021-11-24 00:08:21 +03:00
committed by smoskvin
parent 87b7b496ec
commit b6b55c3d96
2 changed files with 18 additions and 7 deletions

View File

@@ -276,14 +276,19 @@ bool Wasm_Window::ProcessMouseEvent (Aspect_WindowInputListener& theListener,
if (theEvent->metaKey == EM_TRUE) { aFlags |= Aspect_VKeyFlags_META; }
const bool isEmulated = false;
const Aspect_VKeyMouse aButtons = Wasm_Window::MouseButtonsFromNative (theEvent->buttons);
const Aspect_VKeyMouse aButtonsOld = theListener.PressedMouseButtons();
Aspect_VKeyMouse aButtons = Wasm_Window::MouseButtonsFromNative (theEvent->buttons);
if (theEventType != EMSCRIPTEN_EVENT_MOUSEDOWN)
{
aButtons &= aButtonsOld; // filter out unexpected buttons
}
switch (theEventType)
{
case EMSCRIPTEN_EVENT_MOUSEMOVE:
{
if ((aNewPos2i.x() < 0 || aNewPos2i.x() > mySize.x()
|| aNewPos2i.y() < 0 || aNewPos2i.y() > mySize.y())
&& theListener.PressedMouseButtons() == Aspect_VKeyMouse_NONE)
&& aButtonsOld == Aspect_VKeyMouse_NONE)
{
return false;
}