mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-28 17:58:11 +08:00
DropdownInput preview support and ColorButton history improvements (#1598)
* DropdownInput support preview * fix typo and rm logs * Add previewable flag * fix cr typos * Improve color button history * rename * update dropdown preview behaviour * Color picker preset color * Another way to handle blend mode preview * Apply suggestions from code review * Use on_commit instead of on_update for some dropdowns * Debugging progress * add debug * active not equal to highlight in some cases * rm logs --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Keavon Chambers
parent
282969df3d
commit
e769f50877
@@ -690,7 +690,6 @@ impl MessageHandler<DocumentMessage, DocumentMessageData<'_>> for DocumentMessag
|
||||
}
|
||||
}
|
||||
DocumentMessage::SetBlendModeForSelectedLayers { blend_mode } => {
|
||||
self.backup(responses);
|
||||
for layer in self.selected_nodes.selected_layers_except_artboards(self.metadata()) {
|
||||
responses.add(GraphOperationMessage::BlendModeSet { layer, blend_mode });
|
||||
}
|
||||
@@ -1183,15 +1182,15 @@ impl DocumentMessageHandler {
|
||||
MenuListEntry::new(format!("{:?}", DocumentMode::SelectMode))
|
||||
.label(DocumentMode::SelectMode.to_string())
|
||||
.icon(DocumentMode::SelectMode.icon_name())
|
||||
.on_update(|_| DialogMessage::RequestComingSoonDialog { issue: Some(330) }.into()),
|
||||
.on_commit(|_| DialogMessage::RequestComingSoonDialog { issue: Some(330) }.into()),
|
||||
MenuListEntry::new(format!("{:?}", DocumentMode::GuideMode))
|
||||
.label(DocumentMode::GuideMode.to_string())
|
||||
.icon(DocumentMode::GuideMode.icon_name())
|
||||
.on_update(|_| DialogMessage::RequestComingSoonDialog { issue: Some(331) }.into()),
|
||||
.on_commit(|_| DialogMessage::RequestComingSoonDialog { issue: Some(331) }.into()),
|
||||
]])
|
||||
.selected_index(Some(self.document_mode as u32))
|
||||
.draw_icon( true)
|
||||
.interactive( false) // TODO: set to true when dialogs are not spawned
|
||||
.draw_icon(true)
|
||||
.interactive(false) // TODO: set to true when dialogs are not spawned
|
||||
.widget_holder(),
|
||||
Separator::new(SeparatorType::Section).widget_holder(),
|
||||
],
|
||||
@@ -1533,6 +1532,7 @@ impl DocumentMessageHandler {
|
||||
MenuListEntry::new(format!("{blend_mode:?}"))
|
||||
.label(blend_mode.to_string())
|
||||
.on_update(move |_| DocumentMessage::SetBlendModeForSelectedLayers { blend_mode }.into())
|
||||
.on_commit(|_| DocumentMessage::StartTransaction.into())
|
||||
})
|
||||
.collect()
|
||||
})
|
||||
|
||||
@@ -373,7 +373,7 @@ fn number_widget(document_node: &DocumentNode, node_id: NodeId, index: usize, na
|
||||
widgets
|
||||
}
|
||||
|
||||
//TODO Generalize this instead of using a separate function per dropdown menu enum
|
||||
// TODO: Generalize this instead of using a separate function per dropdown menu enum
|
||||
fn color_channel(document_node: &DocumentNode, node_id: NodeId, index: usize, name: &str, blank_assist: bool) -> LayoutGroup {
|
||||
let mut widgets = start_widgets(document_node, node_id, index, name, FrontendGraphDataType::General, blank_assist);
|
||||
if let &NodeInput::Value {
|
||||
@@ -428,7 +428,7 @@ fn rgba_channel(document_node: &DocumentNode, node_id: NodeId, index: usize, nam
|
||||
LayoutGroup::Row { widgets }.with_tooltip("Color Channel")
|
||||
}
|
||||
|
||||
// TODO Generalize this instead of using a separate function per dropdown menu enum
|
||||
// TODO: Generalize this instead of using a separate function per dropdown menu enum
|
||||
fn noise_type(document_node: &DocumentNode, node_id: NodeId, index: usize, name: &str, blank_assist: bool) -> LayoutGroup {
|
||||
let mut widgets = start_widgets(document_node, node_id, index, name, FrontendGraphDataType::General, blank_assist);
|
||||
if let &NodeInput::Value {
|
||||
@@ -454,7 +454,7 @@ fn noise_type(document_node: &DocumentNode, node_id: NodeId, index: usize, name:
|
||||
LayoutGroup::Row { widgets }.with_tooltip("Style of noise pattern")
|
||||
}
|
||||
|
||||
// TODO Generalize this instead of using a separate function per dropdown menu enum
|
||||
// TODO: Generalize this instead of using a separate function per dropdown menu enum
|
||||
fn fractal_type(document_node: &DocumentNode, node_id: NodeId, index: usize, name: &str, blank_assist: bool, disabled: bool) -> LayoutGroup {
|
||||
let mut widgets = start_widgets(document_node, node_id, index, name, FrontendGraphDataType::General, blank_assist);
|
||||
if let &NodeInput::Value {
|
||||
@@ -480,7 +480,7 @@ fn fractal_type(document_node: &DocumentNode, node_id: NodeId, index: usize, nam
|
||||
LayoutGroup::Row { widgets }.with_tooltip("Style of layered levels of the noise pattern")
|
||||
}
|
||||
|
||||
// TODO Generalize this instead of using a separate function per dropdown menu enum
|
||||
// TODO: Generalize this instead of using a separate function per dropdown menu enum
|
||||
fn cellular_distance_function(document_node: &DocumentNode, node_id: NodeId, index: usize, name: &str, blank_assist: bool, disabled: bool) -> LayoutGroup {
|
||||
let mut widgets = start_widgets(document_node, node_id, index, name, FrontendGraphDataType::General, blank_assist);
|
||||
if let &NodeInput::Value {
|
||||
@@ -509,7 +509,7 @@ fn cellular_distance_function(document_node: &DocumentNode, node_id: NodeId, ind
|
||||
LayoutGroup::Row { widgets }.with_tooltip("Distance function used by the cellular noise")
|
||||
}
|
||||
|
||||
// TODO Generalize this instead of using a separate function per dropdown menu enum
|
||||
// TODO: Generalize this instead of using a separate function per dropdown menu enum
|
||||
fn cellular_return_type(document_node: &DocumentNode, node_id: NodeId, index: usize, name: &str, blank_assist: bool, disabled: bool) -> LayoutGroup {
|
||||
let mut widgets = start_widgets(document_node, node_id, index, name, FrontendGraphDataType::General, blank_assist);
|
||||
if let &NodeInput::Value {
|
||||
@@ -535,7 +535,7 @@ fn cellular_return_type(document_node: &DocumentNode, node_id: NodeId, index: us
|
||||
LayoutGroup::Row { widgets }.with_tooltip("Return type of the cellular noise")
|
||||
}
|
||||
|
||||
// TODO Generalize this instead of using a separate function per dropdown menu enum
|
||||
// TODO: Generalize this instead of using a separate function per dropdown menu enum
|
||||
fn domain_warp_type(document_node: &DocumentNode, node_id: NodeId, index: usize, name: &str, blank_assist: bool, disabled: bool) -> LayoutGroup {
|
||||
let mut widgets = start_widgets(document_node, node_id, index, name, FrontendGraphDataType::General, blank_assist);
|
||||
if let &NodeInput::Value {
|
||||
|
||||
Reference in New Issue
Block a user