GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git
Context menu: a control-scale corner, style.surface.menu.corner_radius
The context menu plate took the pane radius (plate_corner_radius, 12
in the shipped config) while its labels sit 8px in from the edge, so
the first row's text ran off the plate through the corner arc — the
more so under a corner_shape that keeps the arc full to the corner.
menu_corner_radius reads style.surface.menu.corner_radius and falls
back to the control rung's radius (8 in the shipped config): a menu is
a popover and its corner belongs to the control scale, like the
dropdown's. The hover row rounds with it. Verified in a scale-2 shadow
on the designer's node context menu.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
src/layout.rs | 14 ++++++++++++++
src/widget/core.rs | 2 +-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/layout.rs b/src/layout.rs
index cbd74f6..3befbcd 100644
--- a/src/layout.rs
+++ b/src/layout.rs
@@ -295,6 +295,9 @@ fn flatten_json_to_flat_props(val: &serde_json::Value, prefix: &str, flat_props:
"style.surface.desktop.grid_cell_width" => "grid_cell_width",
"style.surface.desktop.grid_cell_height" => "grid_cell_height",
"style.surface.plate.padding" => "plate_padding",
+ // The context menu's own radius (`menu_corner_radius`): a
+ // popover's corner is control-scale, not pane-scale.
+ "style.surface.menu.corner_radius" => "menu_corner_radius",
// `style.surface.plate.root.*` is the one spelling of the
// root-plate style (RFC Phase 7a). The slot names keep the
// historical `root_plate_` prefix; the legacy `root plate.*`
@@ -3586,6 +3589,17 @@ pub fn set_font_selector_corner_radius(radius: f32) {
}
}
+/// The context menu's corner radius (`style.surface.menu.corner_radius`),
+/// falling back to the control rung's. It used to take the pane radius
+/// (`plate_corner_radius`, 12 in the shipped config), which is a corner
+/// too wide for a surface whose labels sit 8px in from its edge: the first
+/// row's text ran off the plate through the arc. A menu is a popover, and
+/// its corner belongs to the control scale, like the dropdown's.
+pub fn menu_corner_radius() -> f32 {
+ lazy_init_style_registry();
+ get_style_registry().read().unwrap().get_float("menu_corner_radius").unwrap_or_else(control_corner_radius)
+}
+
pub fn dropdown_corner_radius() -> f32 {
lazy_init_style_registry();
get_style_registry().read().unwrap().get_float("dropdown_corner_radius").unwrap_or_else(control_corner_radius)
diff --git a/src/widget/core.rs b/src/widget/core.rs
index d455ce5..9316235 100644
--- a/src/widget/core.rs
+++ b/src/widget/core.rs
@@ -514,7 +514,7 @@ pub mod context_menu {
width: self.w,
height: self.h,
};
- let r = crate::layout::plate_corner_radius();
+ let r = crate::layout::menu_corner_radius();
let depth = crate::layout::bevel_width().min(self.h * 0.2);
let face = crate::color::page_low_color();
if face[3] > 0.001 {