| 37 | } |
| 38 | |
| 39 | void InputRouter::beginMouseButton(const int action, const double x, const double y) { |
| 40 | if (action != ACTION_PRESS) { |
| 41 | return; |
| 42 | } |
| 43 | |
| 44 | ++pressed_mouse_buttons_; |
| 45 | |
| 46 | if (state_.pointer_capture == InputTarget::None) { |
| 47 | state_.pointer_capture = hoverTarget(x, y); |
| 48 | } |
| 49 | |
| 50 | switch (state_.pointer_capture) { |
| 51 | case InputTarget::Gui: |
| 52 | state_.keyboard_focus = InputTarget::Gui; |
| 53 | break; |
| 54 | case InputTarget::Viewport: |
| 55 | state_.keyboard_focus = InputTarget::Viewport; |
| 56 | break; |
| 57 | case InputTarget::None: |
| 58 | if (!isViewportPoint(x, y)) { |
| 59 | state_.keyboard_focus = InputTarget::None; |
| 60 | } |
| 61 | break; |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | void InputRouter::endMouseButton(const int action) { |
| 66 | if (action != ACTION_RELEASE) { |