GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git
feat: expose graph_node_delete style mapping and keybind tag support
src/config.rs | 4 ++--
src/layout.rs | 13 +++++++++++++
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/config.rs b/src/config.rs
index b831e07..7531993 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -738,7 +738,7 @@ pub fn value_to_kdl_with_annotations(
let s_clean = s.trim_start_matches('#');
let ty = if s_clean.len() == 8 { "rgba" } else { "rgb" };
(format!("\"{}\"", s), Some(ty.to_string()))
- } else if prop_name == "key" || prop_name == "keybind" || prop_name == "shortcut" || prop_name == "open_search" || prop_name.ends_with("_key") || prop_name.ends_with(".key") || prop_name.ends_with(".keybind") {
+ } else if prop_name == "key" || prop_name == "keybind" || prop_name == "shortcut" || prop_name == "open_search" || prop_name == "delete" || prop_name.ends_with("_key") || prop_name.ends_with(".key") || prop_name.ends_with(".keybind") {
(format!("\"{}\"", s), Some("keybind".to_string()))
} else {
(format!("\"{}\"", s), None)
@@ -779,7 +779,7 @@ pub fn value_to_kdl_with_annotations(
let s_clean = s.trim_start_matches('#');
let ty = if s_clean.len() == 8 { "rgba" } else { "rgb" };
(format!("\"{}\"", s), Some(ty.to_string()))
- } else if key == "key" || key == "keybind" || key == "shortcut" || key == "open_search" || key.ends_with("_key") || key.ends_with(".key") || key.ends_with(".keybind") {
+ } else if key == "key" || key == "keybind" || key == "shortcut" || key == "open_search" || key == "delete" || key.ends_with("_key") || key.ends_with(".key") || key.ends_with(".keybind") {
(format!("\"{}\"", s), Some("keybind".to_string()))
} else {
(format!("\"{}\"", s), None)
diff --git a/src/layout.rs b/src/layout.rs
index 8be2bb3..0565abe 100644
--- a/src/layout.rs
+++ b/src/layout.rs
@@ -148,6 +148,7 @@ fn flatten_json_to_flat_props(val: &serde_json::Value, prefix: &str, flat_props:
"style.surface.graph.font" => "graph_font",
"style.surface.graph.node.color" => "graph_node_color",
"style.surface.graph.node.font" => "graph_node_font",
+ "style.surface.graph.node.delete" => "graph_node_delete",
"style.surface.graph.node.selected_color" => "graph_node_selected_color",
"style.surface.graph.node.drag_color" => "graph_node_drag_color",
"style.surface.graph.node.corner_radius" => "graph_node_corner_radius",
@@ -2787,6 +2788,18 @@ pub fn set_graph_node_corner_radius(radius: f32) {
}
}
+pub fn graph_node_delete() -> String {
+ lazy_init_style_registry();
+ get_style_registry().read().unwrap().get_string("graph_node_delete").unwrap_or_else(|| "delete".to_string())
+}
+
+pub fn set_graph_node_delete(key: String) {
+ lazy_init_style_registry();
+ if let Ok(mut registry) = get_style_registry().write() {
+ registry.set_string("graph_node_delete", key);
+ }
+}
+
pub fn graph_wire_size() -> f32 {
lazy_init_style_registry();
get_style_registry().read().unwrap().get_float("graph_wire_size").unwrap_or(6.0)