Cleaner scroll handling
This commit is contained in:
@@ -10,9 +10,7 @@ pub struct ScrollText {
|
||||
|
||||
impl Widget for ScrollText {
|
||||
fn render(&self, scope: &mut crate::render::RenderScope) {
|
||||
scope.draw_text(0, &self.title);
|
||||
|
||||
let title_lines = self.title.lines().count();
|
||||
let title_lines = scope.draw_text(0, &self.title);
|
||||
|
||||
let mut y = title_lines as u16;
|
||||
|
||||
@@ -20,7 +18,7 @@ impl Widget for ScrollText {
|
||||
.text
|
||||
.lines()
|
||||
.skip(self.scroll)
|
||||
.take(scope.rect.height as usize - title_lines)
|
||||
.take((scope.rect.height - title_lines) as usize)
|
||||
{
|
||||
y += scope.draw_text((0, y), line);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user