outline bug fix
This commit is contained in:
+3
-3
@@ -369,11 +369,11 @@ impl Writer {
|
|||||||
let ol = self.style.write_outline("│");
|
let ol = self.style.write_outline("│");
|
||||||
let hl = "─".repeat(width as usize);
|
let hl = "─".repeat(width as usize);
|
||||||
self.write_abs_outline(&self.style.write_outline(&format!("╭{}╮", hl)), (0, 0));
|
self.write_abs_outline(&self.style.write_outline(&format!("╭{}╮", hl)), (0, 0));
|
||||||
for i in 1..height {
|
for i in 1..height+1 {
|
||||||
self.write_abs_outline(&ol, (0, i));
|
self.write_abs_outline(&ol, (0, i));
|
||||||
self.write_abs_outline(&ol, (width - 1, i));
|
self.write_abs_outline(&ol, (width + 1, i));
|
||||||
}
|
}
|
||||||
self.write_abs_outline(&self.style.write_outline(&format!("╰{}╯", hl)), (0, height));
|
self.write_abs_outline(&self.style.write_outline(&format!("╰{}╯", hl)), (0, height + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+17
-7
@@ -1,4 +1,4 @@
|
|||||||
use osui::prelude::*;
|
use osui::{examples, prelude::*};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
launch!(App);
|
launch!(App);
|
||||||
@@ -6,12 +6,22 @@ fn main() {
|
|||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
fn App() {
|
fn App() {
|
||||||
let count = use_state(20);
|
|
||||||
|
|
||||||
rsx! {
|
rsx! {
|
||||||
%text { "Hello" }
|
@SetStyle(css! {
|
||||||
button { on_click: |_, _, _| @count {
|
example: "hover" {
|
||||||
count += 1
|
color: Blue,
|
||||||
}, "World: {count}" }
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
%text { "Choose an example to run" }
|
||||||
|
button { class: "example", on_click: |_, _, doc| {
|
||||||
|
doc.draw(examples::counter_example::App::default().create_element());
|
||||||
|
}, "Counter" }
|
||||||
|
button { class: "example", on_click: |_, _, doc| {
|
||||||
|
doc.draw(examples::login_example::App::default().create_element());
|
||||||
|
}, "Login" }
|
||||||
|
button { class: "example", on_click: |_, _, doc| {
|
||||||
|
doc.draw(examples::todo_example::App::default().create_element());
|
||||||
|
}, "Todo" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-8
@@ -68,15 +68,10 @@ impl<'a> Frame<'a> {
|
|||||||
element.render(&mut writer);
|
element.render(&mut writer);
|
||||||
let (width, height) = writer.get_size_root();
|
let (width, height) = writer.get_size_root();
|
||||||
{
|
{
|
||||||
let (mut x, mut y) = (x, y);
|
let (x, y, width, height) = if style_element.outline.1 {
|
||||||
if style_element.outline.1 {
|
(x - 1, y - 1, width + 2, height + 2)
|
||||||
x -= 1;
|
|
||||||
y -= 1;
|
|
||||||
}
|
|
||||||
let height = if style_element.outline.1 {
|
|
||||||
height + 1
|
|
||||||
} else {
|
} else {
|
||||||
height
|
(x, y, width, height)
|
||||||
};
|
};
|
||||||
|
|
||||||
for i in y..y + height {
|
for i in y..y + height {
|
||||||
|
|||||||
Reference in New Issue
Block a user