Add suffix widget non-rounding; add disabled state to many widgets

This commit is contained in:
Keavon Chambers
2022-11-04 15:03:22 -07:00
parent ff75e0eae9
commit a1e061fa14
28 changed files with 218 additions and 63 deletions

View File

@@ -85,6 +85,7 @@ impl PropertyHolder for ExportDialogMessageHandler {
WidgetHolder::new(Widget::RadioInput(RadioInput {
selected_index: self.file_type as u32,
entries,
..Default::default()
})),
];

View File

@@ -9,6 +9,8 @@ use serde::{Deserialize, Serialize};
pub struct PivotAssist {
pub position: PivotPosition,
pub disabled: bool,
// Callbacks
#[serde(skip)]
#[derivative(Debug = "ignore", PartialEq = "ignore")]

View File

@@ -11,6 +11,8 @@ pub struct IconButton {
pub size: u32, // TODO: Convert to an `IconSize` enum
pub disabled: bool,
pub active: bool,
pub tooltip: String,
@@ -29,9 +31,12 @@ pub struct IconButton {
pub struct PopoverButton {
pub icon: Option<String>,
// Body
pub disabled: bool,
// Placeholder popover content heading
pub header: String,
// Placeholder popover content paragraph
pub text: String,
pub tooltip: String,

View File

@@ -238,6 +238,8 @@ pub struct OptionalInput {
pub struct RadioInput {
pub entries: Vec<RadioEntryData>,
pub disabled: bool,
// This uses `u32` instead of `usize` since it will be serialized as a normal JS number (replace this with `usize` after switching to a Rust-based GUI)
#[serde(rename = "selectedIndex")]
pub selected_index: u32,

View File

@@ -5,6 +5,8 @@ use serde::{Deserialize, Serialize};
pub struct IconLabel {
pub icon: String,
pub disabled: bool,
pub tooltip: String,
}
@@ -32,6 +34,8 @@ pub enum SeparatorType {
#[derive(Clone, Serialize, Deserialize, Derivative, Debug, PartialEq, Eq, Default)]
pub struct TextLabel {
pub disabled: bool,
pub bold: bool,
pub italic: bool,

View File

@@ -1564,6 +1564,7 @@ impl DocumentMessageHandler {
..RadioEntryData::default()
},
],
..Default::default()
})),
WidgetHolder::new(Widget::PopoverButton(PopoverButton {
header: "View Mode".into(),

View File

@@ -44,6 +44,7 @@ pub fn register_artboard_layer_properties(layer: &Layer, responses: &mut VecDequ
WidgetHolder::new(Widget::IconLabel(IconLabel {
icon: "NodeArtboard".into(),
tooltip: "Artboard".into(),
..Default::default()
})),
WidgetHolder::new(Widget::Separator(Separator {
separator_type: SeparatorType::Related,
@@ -226,22 +227,27 @@ pub fn register_artwork_layer_properties(layer: &Layer, responses: &mut VecDeque
LayerDataType::Folder(_) => WidgetHolder::new(Widget::IconLabel(IconLabel {
icon: "NodeFolder".into(),
tooltip: "Folder".into(),
..Default::default()
})),
LayerDataType::Shape(_) => WidgetHolder::new(Widget::IconLabel(IconLabel {
icon: "NodeShape".into(),
tooltip: "Shape".into(),
..Default::default()
})),
LayerDataType::Text(_) => WidgetHolder::new(Widget::IconLabel(IconLabel {
icon: "NodeText".into(),
tooltip: "Text".into(),
..Default::default()
})),
LayerDataType::Image(_) => WidgetHolder::new(Widget::IconLabel(IconLabel {
icon: "NodeImage".into(),
tooltip: "Image".into(),
..Default::default()
})),
LayerDataType::Imaginate(_) => WidgetHolder::new(Widget::IconLabel(IconLabel {
icon: "NodeImaginate".into(),
tooltip: "Imaginate".into(),
..Default::default()
})),
},
WidgetHolder::new(Widget::Separator(Separator {
@@ -338,6 +344,7 @@ fn node_section_transform(layer: &Layer, persistent_data: &PersistentData) -> La
WidgetHolder::new(Widget::PivotAssist(PivotAssist {
position: layer.pivot.into(),
on_update: WidgetCallback::new(|pivot_assist: &PivotAssist| PropertiesPanelMessage::SetPivot { new_position: pivot_assist.position }.into()),
..Default::default()
})),
WidgetHolder::new(Widget::Separator(Separator {
separator_type: SeparatorType::Unrelated,
@@ -1152,6 +1159,7 @@ fn node_gradient_type(gradient: &Gradient) -> LayoutGroup {
..RadioEntryData::default()
},
],
..Default::default()
})),
],
}
@@ -1371,6 +1379,7 @@ fn node_section_stroke(stroke: &Stroke) -> LayoutGroup {
..RadioEntryData::default()
},
],
..Default::default()
})),
],
},
@@ -1418,6 +1427,7 @@ fn node_section_stroke(stroke: &Stroke) -> LayoutGroup {
..RadioEntryData::default()
},
],
..Default::default()
})),
],
},

View File

@@ -129,6 +129,7 @@ impl PropertyHolder for GradientTool {
..RadioEntryData::default()
},
],
..Default::default()
}))],
}]))
}

View File

@@ -259,6 +259,7 @@ impl PropertyHolder for SelectTool {
WidgetHolder::new(Widget::PivotAssist(PivotAssist {
position: self.tool_data.pivot.to_pivot_position(),
on_update: WidgetCallback::new(|pivot_assist: &PivotAssist| SelectToolMessage::SetPivot { position: pivot_assist.position }.into()),
..Default::default()
})),
],
}]))

View File

@@ -183,9 +183,10 @@ impl PropertyHolder for ToolData {
WidgetHolder::new(Widget::IconButton(IconButton {
icon: icon_name,
size: 32,
disabled: false,
active: self.active_tool_type == tool_type,
tooltip: tooltip.clone(),
tooltip_shortcut,
active: self.active_tool_type == tool_type,
on_update: WidgetCallback::new(move |_| {
if !tooltip.contains("Coming Soon") {
ToolMessage::ActivateTool { tool_type }.into()