outline bug fix
This commit is contained in:
+3
-3
@@ -369,11 +369,11 @@ impl Writer {
|
||||
let ol = self.style.write_outline("│");
|
||||
let hl = "─".repeat(width as usize);
|
||||
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, (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() {
|
||||
launch!(App);
|
||||
@@ -6,12 +6,22 @@ fn main() {
|
||||
|
||||
#[component]
|
||||
fn App() {
|
||||
let count = use_state(20);
|
||||
|
||||
rsx! {
|
||||
%text { "Hello" }
|
||||
button { on_click: |_, _, _| @count {
|
||||
count += 1
|
||||
}, "World: {count}" }
|
||||
@SetStyle(css! {
|
||||
example: "hover" {
|
||||
color: Blue,
|
||||
}
|
||||
})
|
||||
|
||||
%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);
|
||||
let (width, height) = writer.get_size_root();
|
||||
{
|
||||
let (mut x, mut y) = (x, y);
|
||||
if style_element.outline.1 {
|
||||
x -= 1;
|
||||
y -= 1;
|
||||
}
|
||||
let height = if style_element.outline.1 {
|
||||
height + 1
|
||||
let (x, y, width, height) = if style_element.outline.1 {
|
||||
(x - 1, y - 1, width + 2, height + 2)
|
||||
} else {
|
||||
height
|
||||
(x, y, width, height)
|
||||
};
|
||||
|
||||
for i in y..y + height {
|
||||
|
||||
Reference in New Issue
Block a user