Browse Source

Platform: fix EmscriptenApplication::MouseMoveEvent button numbering.

This all looked obviously correct so I never questioned it, but the spec
itself has the order mixed up for an unexplainable reason so it doesn't
match between MouseEvent and MouseMoveEvent.
pull/638/head
Vladimír Vondruš 2 years ago
parent
commit
5bb96caf9a
  1. 4
      doc/changelog.dox
  2. 20
      src/Magnum/Platform/EmscriptenApplication.h

4
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

20
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 */
};
/**

Loading…
Cancel
Save