Square outline demo fix #15
This commit is contained in:
+8
-2
@@ -15,13 +15,19 @@ pub fn app() -> Rsx {
|
|||||||
FlexRow {
|
FlexRow {
|
||||||
FlexCol {
|
FlexCol {
|
||||||
@Transform::new().padding(2, 2);
|
@Transform::new().padding(2, 2);
|
||||||
@Style { foreground: None, background: Background::RoundedOutline(0x00ff00) }; // TODO: Outline doesn't work
|
@Style { foreground: None, background: Background::RoundedOutline(0x00ff00) };
|
||||||
Div {
|
Div {
|
||||||
"This is text inside a div"
|
"This is text inside a div"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transform::new().padding(2, 2);
|
||||||
|
@Style { foreground: None, background: Background::Outline(0x00ff00) };
|
||||||
|
Div {
|
||||||
|
"This is text inside a div with square outlines"
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: div with width full
|
// TODO: div with width full
|
||||||
} (2)
|
} (1)
|
||||||
|
|
||||||
FlexCol {
|
FlexCol {
|
||||||
Div {
|
Div {
|
||||||
|
|||||||
+16
-2
@@ -105,8 +105,22 @@ impl RenderScope {
|
|||||||
|
|
||||||
match self.style.background {
|
match self.style.background {
|
||||||
crate::style::Background::NoBackground => {}
|
crate::style::Background::NoBackground => {}
|
||||||
crate::style::Background::Outline(_c) => {
|
crate::style::Background::Outline(c) => {
|
||||||
// TODO: Implement basic outline drawing if needed
|
let width = width + self.transform.px * 2;
|
||||||
|
let height = height + self.transform.py * 2;
|
||||||
|
if width > 1 && height > 1 {
|
||||||
|
let d = "─".repeat(width as usize - 2);
|
||||||
|
utils::print_liner(
|
||||||
|
self.transform.x,
|
||||||
|
self.transform.y,
|
||||||
|
&utils::hex_ansi(c),
|
||||||
|
&format!(
|
||||||
|
"┌{d}┐{}\n└{d}┘",
|
||||||
|
format!("\n│{}│", " ".repeat(width as usize - 2))
|
||||||
|
.repeat(height as usize - 2),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
crate::style::Background::RoundedOutline(c) => {
|
crate::style::Background::RoundedOutline(c) => {
|
||||||
let width = width + self.transform.px * 2;
|
let width = width + self.transform.px * 2;
|
||||||
|
|||||||
Reference in New Issue
Block a user