Commit 81e4f5c 1 parent d1f0b1e commit 81e4f5c Copy full SHA for 81e4f5c
File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -855,10 +855,22 @@ impl UIElement for ScrollView {
855
855
fn handle_mouse_scrolled ( & self , _mouse_point : Point , delta_z : isize ) {
856
856
//println!("ScrollView.handle_mouse_scrolled({delta_z})");
857
857
let mut scroll_offset = self . layer . scroll_offset ( ) ;
858
- scroll_offset. y += delta_z * 20 ;
859
858
self . layer . set_scroll_offset ( scroll_offset) ;
860
859
//self.draw()
861
860
Bordered :: draw ( self ) ;
861
+ let content_frame = self . layer . total_content_frame ( ) ;
862
+ // Scale how much the mouse scrolls by based on how large the content view is
863
+ // TODO(PT): Scale by how fast the user is scrolling
864
+ let scroll_step = {
865
+ if content_frame. height ( ) > 10000 {
866
+ 10
867
+ } else if content_frame. height ( ) > 1000 {
868
+ 5
869
+ } else {
870
+ 1
871
+ }
872
+ } ;
873
+ scroll_offset. y += delta_z * scroll_step;
862
874
}
863
875
864
876
fn handle_key_released ( & self , key : KeyCode ) {
You can’t perform that action at this time.
0 commit comments