|
1 | 1 | use crate::document::DocumentMessageHandler;
|
| 2 | +use crate::frontend::utility_types::MouseCursorIcon; |
2 | 3 | use crate::input::keyboard::{Key, MouseMotion};
|
3 | 4 | use crate::input::InputPreprocessorMessageHandler;
|
4 | 5 | use crate::message_prelude::*;
|
@@ -34,11 +35,17 @@ impl<'a> MessageHandler<ToolMessage, ToolActionHandlerData<'a>> for Navigate {
|
34 | 35 | return;
|
35 | 36 | }
|
36 | 37 |
|
| 38 | + if action == ToolMessage::UpdateCursor { |
| 39 | + self.fsm_state.update_cursor(responses); |
| 40 | + return; |
| 41 | + } |
| 42 | + |
37 | 43 | let new_state = self.fsm_state.transition(action, data.0, data.1, &mut self.data, data.2, responses);
|
38 | 44 |
|
39 | 45 | if self.fsm_state != new_state {
|
40 | 46 | self.fsm_state = new_state;
|
41 | 47 | self.fsm_state.update_hints(responses);
|
| 48 | + self.fsm_state.update_cursor(responses); |
42 | 49 | }
|
43 | 50 | }
|
44 | 51 |
|
@@ -211,4 +218,15 @@ impl Fsm for NavigateToolFsmState {
|
211 | 218 |
|
212 | 219 | responses.push_back(FrontendMessage::UpdateInputHints { hint_data }.into());
|
213 | 220 | }
|
| 221 | + |
| 222 | + fn update_cursor(&self, responses: &mut VecDeque<Message>) { |
| 223 | + let cursor = match *self { |
| 224 | + NavigateToolFsmState::Ready => MouseCursorIcon::ZoomIn, |
| 225 | + NavigateToolFsmState::Panning => MouseCursorIcon::Grabbing, |
| 226 | + NavigateToolFsmState::Tilting => MouseCursorIcon::Default, |
| 227 | + NavigateToolFsmState::Zooming => MouseCursorIcon::ZoomIn, |
| 228 | + }; |
| 229 | + |
| 230 | + responses.push_back(FrontendMessage::UpdateMouseCursor { cursor }.into()); |
| 231 | + } |
214 | 232 | }
|
0 commit comments