GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git
Restrict rounded corner calculation to visual area (excl. label offset) and make Spinbox base background transparent
src/backend/window_runner.rs | 10 ++++++++--
src/main.rs | 5 ++++-
src/widget/input/spinbox.rs | 2 +-
3 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/backend/window_runner.rs b/src/backend/window_runner.rs
index 0b7f2da..8599605 100644
--- a/src/backend/window_runner.rs
+++ b/src/backend/window_runner.rs
@@ -584,7 +584,10 @@ pub fn push_extra_quad_vertices(
return;
}
- let (wx, wy, ww, wh) = w.rect();
+ let (wx, mut wy, ww, mut wh) = w.rect();
+ let top_room = crate::widget::label_offset(w);
+ wy += top_room;
+ wh -= top_room;
let extra_corners = (
corners.0 && qx <= wx + 0.1 && qy <= wy + 0.1,
corners.1 && qx + qw >= wx + ww - 0.1 && qy <= wy + 0.1,
@@ -631,7 +634,10 @@ pub fn push_extra_quad_vertices_clipped(
return;
}
- let (wx, wy, ww, wh) = w.rect();
+ let (wx, mut wy, ww, mut wh) = w.rect();
+ let top_room = crate::widget::label_offset(w);
+ wy += top_room;
+ wh -= top_room;
let extra_corners = (
corners.0 && qx <= wx + 0.1 && qy <= wy + 0.1,
corners.1 && qx + qw >= wx + ww - 0.1 && qy <= wy + 0.1,
diff --git a/src/main.rs b/src/main.rs
index 3c8f9ef..00202c6 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -191,7 +191,10 @@ fn extra_quad_vertices(
return quad_vertices(qx, qy, qw, qh, sw, sh, qc).to_vec();
}
- let (wx, wy, ww, wh) = w.rect();
+ let (wx, mut wy, ww, mut wh) = w.rect();
+ let top_room = clear_ui::widget::label_offset(w);
+ wy += top_room;
+ wh -= top_room;
let extra_corners = (
corners.0 && qx <= wx + 0.1 && qy <= wy + 0.1,
corners.1 && qx + qw >= wx + ww - 0.1 && qy <= wy + 0.1,
diff --git a/src/widget/input/spinbox.rs b/src/widget/input/spinbox.rs
index a1567a0..0781157 100644
--- a/src/widget/input/spinbox.rs
+++ b/src/widget/input/spinbox.rs
@@ -125,7 +125,7 @@ impl Element for Spinbox {
crate::layout::spinbox_corner_radius()
}
- fn color(&self) -> [f32; 4] { colors::SPINBOX_BG }
+ fn color(&self) -> [f32; 4] { [0.0, 0.0, 0.0, 0.0] }
fn value(&self) -> i32 { self.value }
fn widget_font(&self) -> Option<String> { Some("monospace".to_string()) }