mirror of
https://github.com/godotengine/godot
synced 2024-09-05 15:59:35 +00:00
Merge pull request #26707 from bruvzg/fix_macos_mscroll
Fix macOS accumulated mouse scroll events.
This commit is contained in:
commit
e60465dd75
|
@ -1096,6 +1096,7 @@ static int remapKey(unsigned int key) {
|
|||
inline void sendScrollEvent(int button, double factor, int modifierFlags) {
|
||||
|
||||
unsigned int mask = 1 << (button - 1);
|
||||
Vector2 mouse_pos = Vector2(mouse_x, mouse_y);
|
||||
|
||||
Ref<InputEventMouseButton> sc;
|
||||
sc.instance();
|
||||
|
@ -1104,14 +1105,18 @@ inline void sendScrollEvent(int button, double factor, int modifierFlags) {
|
|||
sc->set_button_index(button);
|
||||
sc->set_factor(factor);
|
||||
sc->set_pressed(true);
|
||||
Vector2 mouse_pos = Vector2(mouse_x, mouse_y);
|
||||
sc->set_position(mouse_pos);
|
||||
sc->set_global_position(mouse_pos);
|
||||
button_mask |= mask;
|
||||
sc->set_button_mask(button_mask);
|
||||
OS_OSX::singleton->push_input(sc);
|
||||
|
||||
sc.instance();
|
||||
sc->set_button_index(button);
|
||||
sc->set_factor(factor);
|
||||
sc->set_pressed(false);
|
||||
sc->set_position(mouse_pos);
|
||||
sc->set_global_position(mouse_pos);
|
||||
button_mask &= ~mask;
|
||||
sc->set_button_mask(button_mask);
|
||||
OS_OSX::singleton->push_input(sc);
|
||||
|
|
Loading…
Reference in a new issue