mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-30 20:48:11 +08:00
Show outline for image frames on hover and when selected with frame tools
This commit is contained in:
@@ -3,6 +3,7 @@ use crate::messages::input_mapper::utility_types::input_keyboard::{Key, MouseMot
|
||||
use crate::messages::layout::utility_types::layout_widget::PropertyHolder;
|
||||
use crate::messages::portfolio::document::node_graph;
|
||||
use crate::messages::prelude::*;
|
||||
use crate::messages::tool::common_functionality::path_outline::PathOutline;
|
||||
use crate::messages::tool::common_functionality::resize::Resize;
|
||||
use crate::messages::tool::utility_types::{EventToMessageMap, Fsm, ToolActionHandlerData, ToolMetadata, ToolTransition, ToolType};
|
||||
use crate::messages::tool::utility_types::{HintData, HintGroup, HintInfo};
|
||||
@@ -25,6 +26,10 @@ pub enum FrameToolMessage {
|
||||
// Standard messages
|
||||
#[remain::unsorted]
|
||||
Abort,
|
||||
#[remain::unsorted]
|
||||
DocumentIsDirty,
|
||||
#[remain::unsorted]
|
||||
SelectionChanged,
|
||||
|
||||
// Tool-specific messages
|
||||
DragStart,
|
||||
@@ -73,7 +78,9 @@ impl ToolMetadata for FrameTool {
|
||||
impl ToolTransition for FrameTool {
|
||||
fn event_to_message_map(&self) -> EventToMessageMap {
|
||||
EventToMessageMap {
|
||||
document_dirty: Some(FrameToolMessage::DocumentIsDirty.into()),
|
||||
tool_abort: Some(FrameToolMessage::Abort.into()),
|
||||
selection_changed: Some(FrameToolMessage::SelectionChanged.into()),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
@@ -89,6 +96,7 @@ enum NodeGraphToolFsmState {
|
||||
#[derive(Clone, Debug, Default)]
|
||||
struct NodeGraphToolData {
|
||||
data: Resize,
|
||||
path_outlines: PathOutline,
|
||||
}
|
||||
|
||||
impl Fsm for NodeGraphToolFsmState {
|
||||
@@ -110,7 +118,15 @@ impl Fsm for NodeGraphToolFsmState {
|
||||
|
||||
if let ToolMessage::Frame(event) = event {
|
||||
match (self, event) {
|
||||
(_, DocumentIsDirty | SelectionChanged) => {
|
||||
tool_data.path_outlines.clear_selected(responses);
|
||||
tool_data.path_outlines.update_selected(document.selected_visible_layers(), document, responses, render_data);
|
||||
|
||||
self
|
||||
}
|
||||
(Ready, DragStart) => {
|
||||
tool_data.path_outlines.clear_selected(responses);
|
||||
|
||||
shape_data.start(responses, document, input, render_data);
|
||||
responses.add(DocumentMessage::StartTransaction);
|
||||
shape_data.path = Some(document.get_path_for_new_layer());
|
||||
@@ -147,6 +163,12 @@ impl Fsm for NodeGraphToolFsmState {
|
||||
responses.add(DocumentMessage::AbortTransaction);
|
||||
|
||||
shape_data.cleanup(responses);
|
||||
tool_data.path_outlines.clear_selected(responses);
|
||||
|
||||
Ready
|
||||
}
|
||||
(_, Abort) => {
|
||||
tool_data.path_outlines.clear_selected(responses);
|
||||
|
||||
Ready
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ use crate::messages::input_mapper::utility_types::input_keyboard::{Key, MouseMot
|
||||
use crate::messages::layout::utility_types::layout_widget::PropertyHolder;
|
||||
use crate::messages::portfolio::document::node_graph::{self, IMAGINATE_NODE};
|
||||
use crate::messages::prelude::*;
|
||||
use crate::messages::tool::common_functionality::path_outline::PathOutline;
|
||||
use crate::messages::tool::common_functionality::resize::Resize;
|
||||
use crate::messages::tool::utility_types::{EventToMessageMap, Fsm, ToolActionHandlerData, ToolMetadata, ToolTransition, ToolType};
|
||||
use crate::messages::tool::utility_types::{HintData, HintGroup, HintInfo};
|
||||
@@ -25,6 +26,10 @@ pub enum ImaginateToolMessage {
|
||||
// Standard messages
|
||||
#[remain::unsorted]
|
||||
Abort,
|
||||
#[remain::unsorted]
|
||||
DocumentIsDirty,
|
||||
#[remain::unsorted]
|
||||
SelectionChanged,
|
||||
|
||||
// Tool-specific messages
|
||||
DragStart,
|
||||
@@ -73,7 +78,9 @@ impl ToolMetadata for ImaginateTool {
|
||||
impl ToolTransition for ImaginateTool {
|
||||
fn event_to_message_map(&self) -> EventToMessageMap {
|
||||
EventToMessageMap {
|
||||
document_dirty: Some(ImaginateToolMessage::DocumentIsDirty.into()),
|
||||
tool_abort: Some(ImaginateToolMessage::Abort.into()),
|
||||
selection_changed: Some(ImaginateToolMessage::SelectionChanged.into()),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
@@ -89,6 +96,7 @@ enum ImaginateToolFsmState {
|
||||
#[derive(Clone, Debug, Default)]
|
||||
struct ImaginateToolData {
|
||||
data: Resize,
|
||||
path_outlines: PathOutline,
|
||||
}
|
||||
|
||||
impl Fsm for ImaginateToolFsmState {
|
||||
@@ -110,7 +118,15 @@ impl Fsm for ImaginateToolFsmState {
|
||||
|
||||
if let ToolMessage::Imaginate(event) = event {
|
||||
match (self, event) {
|
||||
(_, DocumentIsDirty | SelectionChanged) => {
|
||||
tool_data.path_outlines.clear_selected(responses);
|
||||
tool_data.path_outlines.update_selected(document.selected_visible_layers(), document, responses, render_data);
|
||||
|
||||
self
|
||||
}
|
||||
(Ready, DragStart) => {
|
||||
tool_data.path_outlines.clear_selected(responses);
|
||||
|
||||
shape_data.start(responses, document, input, render_data);
|
||||
responses.add(DocumentMessage::StartTransaction);
|
||||
shape_data.path = Some(document.get_path_for_new_layer());
|
||||
@@ -178,6 +194,12 @@ impl Fsm for ImaginateToolFsmState {
|
||||
responses.add(DocumentMessage::AbortTransaction);
|
||||
|
||||
shape_data.cleanup(responses);
|
||||
tool_data.path_outlines.clear_selected(responses);
|
||||
|
||||
Ready
|
||||
}
|
||||
(_, Abort) => {
|
||||
tool_data.path_outlines.clear_selected(responses);
|
||||
|
||||
Ready
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user