From 56475078f412254b3838a33db707e32d0772ca68 Mon Sep 17 00:00:00 2001 From: Leo dev Date: Sun, 5 Jan 2025 07:21:41 -0600 Subject: [PATCH] fixed some css Auto bugs --- src/main.rs | 18 +++++++++++------- src/utils.rs | 5 ++++- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/main.rs b/src/main.rs index 5e99f18..51147c5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,13 +7,17 @@ fn main() { #[component] pub fn App() { rsx! { - text { style: style!{ - outline: true, - }, "Hello, World!\nabc" } + @SetStyle(css! { + div { + outline: true, + width: 33%, + x: Auto, + y: 0 px, + } + }) - text { style: style!{ - outline: true, - width: 3 px - }, "Hello, World!\nabc testing" } + div { class: "div" } + div { class: "div" } + div { class: "div" } } } diff --git a/src/utils.rs b/src/utils.rs index ac646d1..056c017 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -81,7 +81,10 @@ impl<'a> Frame<'a> { for i in y..y + height { if let Some(o) = self.used.get_mut(i as usize) { - *o += x + width + 1; + if style_element.x.1 != crate::ui::Number::Auto { + *o += x; + } + *o += width + 1; } } }