mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-30 13:18:12 +08:00
Make the Text tool control bar font family, style, and size sync with the selected layer (#4118)
* Fix contenteditable preview alignment * Make the Text tool control bar font family, style, and size sync with the selected layer * Tidying up
This commit is contained in:
@@ -1728,7 +1728,9 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
|
||||
}
|
||||
NodeGraphMessage::SetInputValue { node_id, input_index, value } => {
|
||||
let is_fill = matches!(value, TaggedValue::Fill(_));
|
||||
let is_text_align = matches!(value, TaggedValue::TextAlign(_));
|
||||
let is_text_node = network_interface
|
||||
.reference(&node_id, selection_network_path)
|
||||
.is_some_and(|reference| reference == DefinitionIdentifier::ProtoNode(graphene_std::text::text::IDENTIFIER));
|
||||
let input = NodeInput::value(value, false);
|
||||
responses.add(NodeGraphMessage::SetInput {
|
||||
input_connector: InputConnector::node(node_id, input_index),
|
||||
@@ -1738,7 +1740,7 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
|
||||
if is_fill {
|
||||
responses.add(OverlaysMessage::Draw);
|
||||
}
|
||||
if is_text_align {
|
||||
if is_text_node {
|
||||
responses.add(TextToolMessage::SelectionChanged);
|
||||
}
|
||||
if network_interface.connected_to_output(&node_id, selection_network_path) {
|
||||
|
||||
@@ -860,6 +860,8 @@ pub fn font_inputs(parameter_widgets_info: ParameterWidgetsInfo) -> (Vec<WidgetI
|
||||
let font_style = family.closest_style(weight, italic).to_named_style();
|
||||
|
||||
move |_| {
|
||||
// Intentionally drop `font_style_to_restore` on commit so the committed style becomes the new basis
|
||||
// for subsequent family switches. Preserving the original style intent is hover-only behavior.
|
||||
let new_font = Font::new(font_family.clone(), font_style.clone());
|
||||
|
||||
DeferMessage::AfterGraphRun {
|
||||
|
||||
Reference in New Issue
Block a user