Fix scroll
This commit is contained in:
@@ -42,6 +42,10 @@ impl RenderTextResult {
|
||||
|
||||
impl RenderScope {
|
||||
pub fn draw_text<P: Into<Point>, T: Display>(&mut self, at: P, text: T) -> u16 {
|
||||
if self.rect.width == 0 || self.rect.height == 0 {
|
||||
return 0;
|
||||
}
|
||||
|
||||
let point: Point = at.into();
|
||||
|
||||
let text = text.to_string();
|
||||
@@ -140,6 +144,10 @@ impl RenderScope {
|
||||
match inst {
|
||||
Instr::DrawText(point, text) => {
|
||||
for (i, line) in text.lines().enumerate() {
|
||||
if i as u16 + point.y >= self.rect.height {
|
||||
continue;
|
||||
}
|
||||
|
||||
print_at(
|
||||
self.rect.x + point.x,
|
||||
self.rect.y + point.y + i as u16,
|
||||
|
||||
Reference in New Issue
Block a user