mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
add option to defer draw updates
this is helpful for composited UIs
This commit is contained in:
parent
27e5f0b72f
commit
765a36bd3a
1 changed files with 7 additions and 1 deletions
|
|
@ -60,6 +60,7 @@ pub struct ScrollableList {
|
|||
/// for some global shared state to lock the UI for a given model which I haven't
|
||||
/// figured out how to handle any other way.
|
||||
pub gfx: Gfx,
|
||||
autoflush: bool,
|
||||
}
|
||||
|
||||
impl Clone for ScrollableList {
|
||||
|
|
@ -104,9 +105,12 @@ impl ScrollableList {
|
|||
text_alignment: TextAlignment::Left,
|
||||
pane: RefCell::new(pane),
|
||||
gfx,
|
||||
autoflush: true,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_autoflush(&mut self, autoflush: bool) { self.autoflush = autoflush; }
|
||||
|
||||
pub fn get_alignment(&self) -> TextAlignment { self.text_alignment }
|
||||
|
||||
pub fn set_alignment<'a>(&'a mut self, alignment: TextAlignment) -> &'a mut Self {
|
||||
|
|
@ -507,7 +511,9 @@ impl ScrollableList {
|
|||
self.gfx.draw_object_list(ol).unwrap();
|
||||
}
|
||||
}
|
||||
self.gfx.flush().unwrap();
|
||||
if self.autoflush {
|
||||
self.gfx.flush().unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
/// Update the scrollable list state based on a key action. Passes on
|
||||
|
|
|
|||
Loading…
Reference in a new issue