Updated RenderScope with positions
This commit is contained in:
@@ -32,11 +32,15 @@ impl Element for Heading {
|
||||
}
|
||||
}
|
||||
if let Some(t) = self.font.convert(&s) {
|
||||
scope.draw_text(&if self.smooth {
|
||||
format!("{t}").replace("-", "─").replace("|", "│")
|
||||
} else {
|
||||
format!("{t}")
|
||||
});
|
||||
scope.draw_text(
|
||||
0,
|
||||
0,
|
||||
&if self.smooth {
|
||||
format!("{t}").replace("-", "─").replace("|", "│")
|
||||
} else {
|
||||
format!("{t}")
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -1,16 +1,18 @@
|
||||
pub mod div;
|
||||
pub mod flex;
|
||||
pub mod heading;
|
||||
pub mod input;
|
||||
|
||||
pub use div::*;
|
||||
pub use flex::*;
|
||||
pub use heading::*;
|
||||
pub use input::*;
|
||||
|
||||
use crate::Element;
|
||||
|
||||
impl Element for String {
|
||||
fn render(&mut self, scope: &mut crate::render_scope::RenderScope) {
|
||||
scope.draw_text(self);
|
||||
scope.draw_text(0, 0, self);
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn std::any::Any {
|
||||
@@ -24,7 +26,7 @@ impl Element for String {
|
||||
|
||||
impl Element for (String, u32) {
|
||||
fn render(&mut self, scope: &mut crate::render_scope::RenderScope) {
|
||||
scope.draw_text_colored(&self.0, self.1);
|
||||
scope.draw_text_colored(0, 0, &self.0, self.1);
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn std::any::Any {
|
||||
|
||||
Reference in New Issue
Block a user