File tree Expand file tree Collapse file tree 1 file changed +22
-13
lines changed Expand file tree Collapse file tree 1 file changed +22
-13
lines changed Original file line number Diff line number Diff line change @@ -620,19 +620,20 @@ impl Application for App {
620620 // Accumulate delta with a timer
621621 // TODO: Should x scroll be handled too?
622622 // Best time/pixel count?
623+
624+ let previous_scroll = if let Some ( ( scroll, last_scroll_time) ) = self . scroll {
625+ if last_scroll_time. elapsed ( ) > Duration :: from_millis ( 100 ) {
626+ 0.
627+ } else {
628+ scroll
629+ }
630+ } else {
631+ 0.
632+ } ;
633+
623634 let direction = match delta {
624635 ScrollDelta :: Pixels { x : _, mut y } => {
625636 y = -y;
626- let previous_scroll = if let Some ( ( scroll, last_scroll_time) ) = self . scroll
627- {
628- if last_scroll_time. elapsed ( ) > Duration :: from_millis ( 100 ) {
629- 0.
630- } else {
631- scroll
632- }
633- } else {
634- 0.
635- } ;
636637
637638 let scroll = previous_scroll + y;
638639 if scroll <= -4. {
@@ -653,12 +654,20 @@ impl Application for App {
653654 }
654655 ScrollDelta :: Lines { x : _, mut y } => {
655656 y = -y;
656- self . scroll = None ;
657- if y < 0. {
657+
658+ let scroll = previous_scroll + y;
659+ if scroll <= -1. {
660+ self . scroll = None ;
658661 ScrollDirection :: Prev
659- } else if y > 0. {
662+ } else if scroll >= 1. {
663+ self . scroll = None ;
660664 ScrollDirection :: Next
661665 } else {
666+ self . scroll = if y != 0. {
667+ Some ( ( scroll, Instant :: now ( ) ) )
668+ } else {
669+ None
670+ } ;
662671 return Task :: none ( ) ;
663672 }
664673 }
You can’t perform that action at this time.
0 commit comments