diff --git a/doc/changelog.dox b/doc/changelog.dox index 7a6652d70..e0f247584 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -1200,6 +1200,10 @@ See also: text. Now it emits both, consistently with @ref Platform::Sdl2Application and @ref Platform::GlfwApplication, and in the same order as in those. See [mosra/magnum#637](https://github.com/mosra/magnum/issues/637). +- Fixed swapped middle and right buttons in + @ref Platform::EmscriptenApplication::MouseMoveEvent, caused by the + JavaScript events themselves having an unexplainable inconsistency in + button numbering @subsection changelog-latest-deprecated Deprecated APIs diff --git a/src/Magnum/Platform/EmscriptenApplication.h b/src/Magnum/Platform/EmscriptenApplication.h index 5bdba0d3a..1624fdd38 100644 --- a/src/Magnum/Platform/EmscriptenApplication.h +++ b/src/Magnum/Platform/EmscriptenApplication.h @@ -1561,9 +1561,10 @@ class EmscriptenApplication::MouseEvent: public EmscriptenApplication::InputEven * @see @ref button() */ enum class Button: std::int32_t { - Left, /**< Left mouse button */ - Middle, /**< Middle mouse button */ - Right /**< Right mouse button */ + /* https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button */ + Left = 0, /**< Left mouse button */ + Middle = 1, /**< Middle mouse button */ + Right = 2 /**< Right mouse button */ }; /** @brief Button */ @@ -1599,14 +1600,13 @@ class EmscriptenApplication::MouseMoveEvent: public EmscriptenApplication::Input * @see @ref buttons() */ enum class Button: Int { - /** Left mouse button */ - Left = 1 << 0, + /* https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons, + note that Middle and Right has order swapped compared to + button / MouseEvent::Button, for some unexplainable reason */ - /** Middle mouse button */ - Middle = 1 << 1, - - /** Right mouse button */ - Right = 1 << 2 + Left = 1 << 0, /** Left mouse button */ + Middle = 1 << 2, /** Middle mouse button */ + Right = 1 << 1 /** Right mouse button */ }; /**