mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-24 11:38:12 +08:00
@@ -24,7 +24,7 @@ pub struct ArtboardTool {
|
||||
|
||||
#[remain::sorted]
|
||||
#[impl_message(Message, ToolMessage, Artboard)]
|
||||
#[derive(PartialEq, Eq, Clone, Debug, Hash, Serialize, Deserialize)]
|
||||
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize)]
|
||||
pub enum ArtboardToolMessage {
|
||||
// Standard messages
|
||||
#[remain::unsorted]
|
||||
@@ -34,6 +34,10 @@ pub enum ArtboardToolMessage {
|
||||
|
||||
// Tool-specific messages
|
||||
DeleteSelected,
|
||||
NudgeSelected {
|
||||
delta_x: f64,
|
||||
delta_y: f64,
|
||||
},
|
||||
PointerDown,
|
||||
PointerMove {
|
||||
constrain_axis_or_aspect: Key,
|
||||
@@ -79,6 +83,7 @@ impl<'a> MessageHandler<ToolMessage, ToolActionHandlerData<'a>> for ArtboardTool
|
||||
PointerUp,
|
||||
PointerMove,
|
||||
DeleteSelected,
|
||||
NudgeSelected,
|
||||
Abort,
|
||||
);
|
||||
}
|
||||
@@ -382,6 +387,20 @@ impl Fsm for ArtboardToolFsmState {
|
||||
}
|
||||
ArtboardToolFsmState::Ready
|
||||
}
|
||||
(_, ArtboardToolMessage::NudgeSelected { delta_x, delta_y }) => {
|
||||
if let Some(bounds) = &mut tool_data.bounding_box_overlays {
|
||||
responses.push_back(
|
||||
ArtboardMessage::ResizeArtboard {
|
||||
artboard: tool_data.selected_board.unwrap(),
|
||||
position: (bounds.bounds[0].x + delta_x, bounds.bounds[0].y + delta_y),
|
||||
size: (bounds.bounds[1] - bounds.bounds[0]).round().into(),
|
||||
}
|
||||
.into(),
|
||||
);
|
||||
}
|
||||
|
||||
ArtboardToolFsmState::Ready
|
||||
}
|
||||
(_, ArtboardToolMessage::Abort) => {
|
||||
if let Some(bounding_box_overlays) = tool_data.bounding_box_overlays.take() {
|
||||
bounding_box_overlays.delete(responses);
|
||||
|
||||
Reference in New Issue
Block a user