mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 07:48:37 -04:00
cocoadisplay: Invert direction of horizontal scroll
Now behaves consistent with other applications (tested with Logitech MX Master 3 for Mac on macOS 10.13 in unnatural scrolling configuration). Set `cocoa-invert-wheel-x true` to revert to old behaviour.
This commit is contained in:
parent
eaa182f310
commit
692221cacb
@ -2021,8 +2021,10 @@ handle_mouse_moved_event(bool in_window, double x, double y, bool absolute) {
|
|||||||
*/
|
*/
|
||||||
void CocoaGraphicsWindow::
|
void CocoaGraphicsWindow::
|
||||||
handle_wheel_event(double x, double y) {
|
handle_wheel_event(double x, double y) {
|
||||||
|
if (cocoadisplay_cat.is_spam()) {
|
||||||
cocoadisplay_cat.spam()
|
cocoadisplay_cat.spam()
|
||||||
<< "Wheel delta " << x << ", " << y << "\n";
|
<< "Wheel delta " << x << ", " << y << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
if (y > 0.0) {
|
if (y > 0.0) {
|
||||||
_input->button_down(MouseButton::wheel_up());
|
_input->button_down(MouseButton::wheel_up());
|
||||||
@ -2032,11 +2034,14 @@ handle_wheel_event(double x, double y) {
|
|||||||
_input->button_up(MouseButton::wheel_down());
|
_input->button_up(MouseButton::wheel_down());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: check if this is correct, I don't own a MacBook
|
if (x != 0 && cocoa_invert_wheel_x) {
|
||||||
if (x > 0.0) {
|
x = -x;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x < 0.0) {
|
||||||
_input->button_down(MouseButton::wheel_right());
|
_input->button_down(MouseButton::wheel_right());
|
||||||
_input->button_up(MouseButton::wheel_right());
|
_input->button_up(MouseButton::wheel_right());
|
||||||
} else if (x < 0.0) {
|
} else if (x > 0.0) {
|
||||||
_input->button_down(MouseButton::wheel_left());
|
_input->button_down(MouseButton::wheel_left());
|
||||||
_input->button_up(MouseButton::wheel_left());
|
_input->button_up(MouseButton::wheel_left());
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
NotifyCategoryDecl(cocoadisplay, EXPCL_PANDA_COCOADISPLAY, EXPTP_PANDA_COCOADISPLAY);
|
NotifyCategoryDecl(cocoadisplay, EXPCL_PANDA_COCOADISPLAY, EXPTP_PANDA_COCOADISPLAY);
|
||||||
|
|
||||||
|
extern ConfigVariableBool cocoa_invert_wheel_x;
|
||||||
|
|
||||||
extern EXPCL_PANDA_COCOADISPLAY void init_libcocoadisplay();
|
extern EXPCL_PANDA_COCOADISPLAY void init_libcocoadisplay();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -31,6 +31,11 @@ ConfigureFn(config_cocoadisplay) {
|
|||||||
init_libcocoadisplay();
|
init_libcocoadisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConfigVariableBool cocoa_invert_wheel_x
|
||||||
|
("cocoa-invert-wheel-x", false,
|
||||||
|
PRC_DESC("Set this to true to swap the wheel_left and wheel_right mouse "
|
||||||
|
"button events, to restore to the pre-1.10.12 behavior."));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the library. This must be called at least once before any of
|
* Initializes the library. This must be called at least once before any of
|
||||||
* the functions or classes in this library can be used. Normally it will be
|
* the functions or classes in this library can be used. Normally it will be
|
||||||
|
Loading…
x
Reference in New Issue
Block a user