Add a button to refresh the input (#926)

* Add a button to refresh the input

* Align left of refresh button

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
0HyperCube 2022-12-28 21:02:03 +00:00 committed by Keavon Chambers
parent af7779769a
commit dbd6a032f7
3 changed files with 17 additions and 1 deletions

View file

@ -73,7 +73,7 @@ static DOCUMENT_NODE_TYPES: &[DocumentNodeType] = &[
default: NodeInput::Network,
}],
outputs: &[FrontendGraphDataType::Raster],
properties: |_document_node, _node_id, _context| node_properties::string_properties("The graph's input is the artwork under the frame layer".to_string()),
properties: node_properties::input_properties,
},
DocumentNodeType {
name: "Output",

View file

@ -144,6 +144,18 @@ fn number_widget(document_node: &DocumentNode, node_id: NodeId, index: usize, na
widgets
}
/// Properties for the input node, with information describing how frames work and a refresh button
pub fn input_properties(_document_node: &DocumentNode, _node_id: NodeId, _context: &mut NodePropertiesContext) -> Vec<LayoutGroup> {
let information = WidgetHolder::text_widget("The graph's input is the artwork under the frame layer");
let refresh_button = WidgetHolder::new(Widget::TextButton(TextButton {
label: "Refresh Input".to_string(),
tooltip: "Refresh the artwork under the frame".to_string(),
on_update: WidgetCallback::new(|_| DocumentMessage::NodeGraphFrameGenerate.into()),
..Default::default()
}));
vec![LayoutGroup::Row { widgets: vec![information] }, LayoutGroup::Row { widgets: vec![refresh_button] }]
}
pub fn adjust_hsl_properties(document_node: &DocumentNode, node_id: NodeId, _context: &mut NodePropertiesContext) -> Vec<LayoutGroup> {
let hue_shift = number_widget(document_node, node_id, 1, "Hue Shift", NumberInput::new().min(-180.).max(180.).unit("°"), true);
let saturation_shift = number_widget(document_node, node_id, 2, "Saturation Shift", NumberInput::new().min(-100.).max(100.).unit("%"), true);

View file

@ -95,6 +95,10 @@
margin-bottom: calc(4px - 1px);
}
> .text-button:first-child {
margin-left: 16px;
}
> .text-label:first-of-type {
flex: 0 0 25%;
margin-left: 16px;