Added horizontal scrolling for long movie titles, a refresh key, and fixed the network issues so that network requests are sent once every 20 seconds by default to not stress out the server.
This commit is contained in:
+6
-7
@@ -219,9 +219,8 @@ impl HorizontallyScrollableText {
|
||||
}
|
||||
|
||||
pub fn scroll_left_or_reset(&self, width: usize, is_current_selection: bool, can_scroll: bool) {
|
||||
if can_scroll {
|
||||
if is_current_selection && self.text.len() >= width && *self.offset.borrow() < self.text.len()
|
||||
{
|
||||
if can_scroll && is_current_selection && self.text.len() >= width {
|
||||
if *self.offset.borrow() < self.text.len() {
|
||||
self.scroll_left();
|
||||
} else {
|
||||
self.reset_offset();
|
||||
@@ -563,19 +562,19 @@ mod tests {
|
||||
|
||||
horizontally_scrollable_text.scroll_left_or_reset(width, false, true);
|
||||
|
||||
assert_eq!(*horizontally_scrollable_text.offset.borrow(), 0);
|
||||
assert_eq!(*horizontally_scrollable_text.offset.borrow(), 1);
|
||||
|
||||
horizontally_scrollable_text.scroll_left_or_reset(width, true, false);
|
||||
|
||||
assert_eq!(*horizontally_scrollable_text.offset.borrow(), 0);
|
||||
assert_eq!(*horizontally_scrollable_text.offset.borrow(), 1);
|
||||
|
||||
horizontally_scrollable_text.scroll_left_or_reset(width, true, true);
|
||||
|
||||
assert_eq!(*horizontally_scrollable_text.offset.borrow(), 1);
|
||||
assert_eq!(*horizontally_scrollable_text.offset.borrow(), 2);
|
||||
|
||||
horizontally_scrollable_text.scroll_left_or_reset(test_text.len(), false, true);
|
||||
|
||||
assert_eq!(*horizontally_scrollable_text.offset.borrow(), 0);
|
||||
assert_eq!(*horizontally_scrollable_text.offset.borrow(), 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user