mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 00:06:44 -04:00
pgui: allow keyboard keys to be added as PGButton click buttons
These will respond as clicks not when the mouse cursor is hovering over them, but when they have keyboard focus. Fixes #600
This commit is contained in:
parent
db00baa230
commit
54c6eaeb96
@ -115,7 +115,11 @@ release(const MouseWatcherParameter ¶m, bool background) {
|
||||
if (has_click_button(param.get_button())) {
|
||||
_button_down = false;
|
||||
if (get_active()) {
|
||||
if (param.is_outside()) {
|
||||
// Note that a "click" may come from a keyboard button press. In that
|
||||
// case, instead of checking that the mouse cursor is still over the
|
||||
// button, we check whether the item has keyboard focus.
|
||||
if (param.is_outside() &&
|
||||
(MouseButton::is_mouse_button(param.get_button()) || !get_focus())) {
|
||||
set_state(S_ready);
|
||||
} else {
|
||||
set_state(S_rollover);
|
||||
|
Loading…
x
Reference in New Issue
Block a user