Files
Graphite/editor/src/viewport_tools/tool_message.rs
asyncth dbc19912ca Set the mouse cursor in the canvas based on the current tool and its state (#480)
* Add FrontendMouseCursor and DisplayMouseCursor

* Add update_cursor method to the Fsm trait and implement it for all tools

* Rename DisplayMouseCursor to UpdateMouseCursor

* Add 'To CSS Cursor Property' transform decorator and change the mouse cursor in the canvas based on the current tool and its state

* Implement update_cursor for Navigate tool properly

* Keep the cursor when dragging outside of the canvas

* Change the mouse cursor to 'zoom-in' when LMB dragging on canvas with Navigate tool

* Rename FrontendMouseCursor to MouseCursorIcon

* Rename 'event' to 'e' and replace v-on with @

* Change the definition of the MouseCursorIcon type in TS

* Replace switch with dictionary look-up

* Move the definition of MouseCursorIcon closer to where it's used
2022-01-15 23:57:03 -08:00

55 lines
951 B
Rust

use super::tool::ToolType;
use super::tool_options::ToolOptions;
use crate::message_prelude::*;
use graphene::color::Color;
use serde::{Deserialize, Serialize};
#[remain::sorted]
#[impl_message(Message, Tool)]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize)]
pub enum ToolMessage {
ActivateTool {
tool_type: ToolType,
},
#[child]
Crop(CropMessage),
DocumentIsDirty,
#[child]
Ellipse(EllipseMessage),
#[child]
Eyedropper(EyedropperMessage),
#[child]
Fill(FillMessage),
#[child]
Line(LineMessage),
#[child]
Navigate(NavigateMessage),
NoOp,
#[child]
Path(PathMessage),
#[child]
Pen(PenMessage),
#[child]
Rectangle(RectangleMessage),
ResetColors,
#[child]
Select(SelectMessage),
SelectPrimaryColor {
color: Color,
},
SelectSecondaryColor {
color: Color,
},
SetToolOptions {
tool_type: ToolType,
tool_options: ToolOptions,
},
#[child]
Shape(ShapeMessage),
SwapColors,
UpdateCursor,
UpdateHints,
}