system settings
git clone https://git.lucas.co/cce-system-interface.git
fix: the focused button's ring reaches this app's own faces
This app draws button faces itself (ControlCarve::Plate) from the Button's
face query; ask for the ControlPlate instead so the focus tint rides along,
and paint a tinted plate through PaintCtx::inset_plate_tinted.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
src/app.rs | 8 ++++----
src/main.rs | 21 +++++++++++++++------
src/renderer.rs | 17 +++++++++--------
3 files changed, 28 insertions(+), 18 deletions(-)
diff --git a/src/app.rs b/src/app.rs
index 7a13f3b..083f9dd 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -133,7 +133,7 @@ pub enum ControlCarve {
/// `PaintCtx::inset_plate` — a flush inset face over a boundary seam
/// (Dropdown, Button). `color` fills the face; transparent leaves the
/// plate below.
- Plate { x: f32, y: f32, w: f32, h: f32, radius: f32, depth: f32, color: [f32; 4] },
+ Plate { x: f32, y: f32, w: f32, h: f32, radius: f32, depth: f32, color: [f32; 4], tint: Option<[f32; 3]> },
/// A step carve straight from the toolkit (TextBox well, Toggle rocker
/// halves and glider) — it already carries its own rect, per-corner radii,
/// depth and wall mask, so nothing here re-derives them.
@@ -145,8 +145,8 @@ impl ControlCarve {
/// collector applies when it lifts page carves to the popover layer.
pub fn shifted_y(self, dy: f32) -> Self {
match self {
- Self::Plate { x, y, w, h, radius, depth, color } => {
- Self::Plate { x, y: y + dy, w, h, radius, depth, color }
+ Self::Plate { x, y, w, h, radius, depth, color, tint } => {
+ Self::Plate { x, y: y + dy, w, h, radius, depth, color, tint }
}
Self::Step(c) => Self::Step(c.shifted_y(dy)),
}
@@ -375,7 +375,7 @@ impl RenderTarget for PageContent {
return;
}
self.control_relief_marks.push(self.rects.len());
- self.control_reliefs.push(ControlCarve::Plate { x, y, w, h, radius, depth, color });
+ self.control_reliefs.push(ControlCarve::Plate { x, y, w, h, radius, depth, color, tint: None });
}
/// The same bridge for the step carves — a DIFFERENT shape, not an inset
diff --git a/src/main.rs b/src/main.rs
index 2e41ef1..ec27101 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -145,12 +145,21 @@ struct SystemInterface {
fn emit_control_carve(pc: &mut cce_ui::scene::paint::PaintCtx, carve: ControlCarve) {
use cce_ui::scene::layout::Rect;
match carve {
- ControlCarve::Plate { x, y, w, h, radius, depth, color } => pc.inset_plate(
- Rect { x, y, width: w, height: h },
- (radius, radius, radius, radius),
- color,
- depth,
- ),
+ ControlCarve::Plate { x, y, w, h, radius, depth, color, tint } => match tint {
+ Some(t) => pc.inset_plate_tinted(
+ Rect { x, y, width: w, height: h },
+ (radius, radius, radius, radius),
+ color,
+ depth,
+ t,
+ ),
+ None => pc.inset_plate(
+ Rect { x, y, width: w, height: h },
+ (radius, radius, radius, radius),
+ color,
+ depth,
+ ),
+ },
ControlCarve::Step(c) => pc.carve(&c),
}
}
diff --git a/src/renderer.rs b/src/renderer.rs
index bab4e4e..bbaf759 100644
--- a/src/renderer.rs
+++ b/src/renderer.rs
@@ -504,15 +504,16 @@ impl SystemInterface {
// coords, pre-scroll, like everything else in this list.
if cce_ui::layout::control_relief() {
let rect = cce_ui::scene::layout::Rect { x: base.x, y: base.y, width: base.w, height: base.h };
- if let Some((face, radius, depth, color)) = btn.inset_face(rect) {
+ if let Some(plate) = btn.plate(rect) {
self.page_control_reliefs.push(ControlCarve::Plate {
- x: face.x,
- y: face.y,
- w: face.width,
- h: face.height,
- radius,
- depth,
- color,
+ x: plate.rect.x,
+ y: plate.rect.y,
+ w: plate.rect.width,
+ h: plate.rect.height,
+ radius: plate.radii.0,
+ depth: plate.depth,
+ color: plate.face,
+ tint: plate.tint,
});
self.page_control_relief_marks.push(widgets.len());
}