mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-17 20:23:47 -04:00
better one-button trackball
This commit is contained in:
parent
f8864484ca
commit
d7892c5bb2
@ -66,13 +66,12 @@ Trackball(const string &name) :
|
|||||||
watch_button(MouseButton::two());
|
watch_button(MouseButton::two());
|
||||||
watch_button(MouseButton::three());
|
watch_button(MouseButton::three());
|
||||||
|
|
||||||
|
#ifdef IS_OSX
|
||||||
// In OSX mode, we need to use the command and option key in
|
// In OSX mode, we need to use the command and option key in
|
||||||
// conjunction with the (one) mouse button. We can go ahead and
|
// conjunction with the (one) mouse button.
|
||||||
// keep this code live in other platforms too; it doesn't do any
|
|
||||||
// harm.
|
|
||||||
watch_button(KeyboardButton::meta());
|
watch_button(KeyboardButton::meta());
|
||||||
watch_button(KeyboardButton::alt());
|
watch_button(KeyboardButton::alt());
|
||||||
watch_button(KeyboardButton::control());
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -558,30 +557,25 @@ do_transmit_data(DataGraphTraverser *, const DataNodeTransmit &input,
|
|||||||
int this_button = 0;
|
int this_button = 0;
|
||||||
|
|
||||||
if (is_down(MouseButton::one())) {
|
if (is_down(MouseButton::one())) {
|
||||||
if (is_down(KeyboardButton::meta())) {
|
#ifdef IS_OSX
|
||||||
// Wait, the user is holding down the command key in
|
if (is_down(KeyboardButton::alt())) {
|
||||||
// conjunction with mouse button 1. This changes its meaning
|
// B1 + alt (option) = B2.
|
||||||
// to either mouse 2 and/or mouse 3, according to whether the
|
this_button |= B2_MASK;
|
||||||
// alt or control key is also held down.
|
if (is_down(KeyboardButton::meta())) {
|
||||||
|
|
||||||
if (is_down(KeyboardButton::alt())) {
|
|
||||||
// Command + alt: B2 + B3.
|
|
||||||
this_button |= B2_MASK | B3_MASK;
|
|
||||||
|
|
||||||
} else if (is_down(KeyboardButton::control())) {
|
|
||||||
// Command + control: B2.
|
|
||||||
this_button |= B2_MASK;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// Command key by itself: B3.
|
|
||||||
this_button |= B3_MASK;
|
this_button |= B3_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (is_down(KeyboardButton::meta())) {
|
||||||
|
// B1 + meta (command) = B3.
|
||||||
|
this_button |= B3_MASK;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Without the command key, a mouse 1 button is a mouse 1
|
// Without a special key, B1 is B1.
|
||||||
// button.
|
|
||||||
this_button |= B1_MASK;
|
this_button |= B1_MASK;
|
||||||
}
|
}
|
||||||
|
#else // IS_OSX
|
||||||
|
this_button |= B1_MASK;
|
||||||
|
#endif // IS_OSX
|
||||||
}
|
}
|
||||||
if (is_down(MouseButton::two())) {
|
if (is_down(MouseButton::two())) {
|
||||||
this_button |= B2_MASK;
|
this_button |= B2_MASK;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user