Don't animate scrolling by dragging the scroll bar (#940)

Also added the `config.animate_drag_scroll` option to re-enable the 
behavior.
This commit is contained in:
Guldoman 2022-04-26 15:54:11 +02:00 committed by GitHub
parent 0c456eb664
commit 444b3e3c66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -4,6 +4,7 @@ config.fps = 60
config.max_log_items = 80
config.message_timeout = 5
config.mouse_wheel_scroll = 50 * SCALE
config.animate_drag_scroll = false
config.scroll_past_end = true
config.file_size_limit = 10
config.ignore_files = { "^%." }

View File

@ -134,6 +134,9 @@ function View:on_mouse_moved(x, y, dx, dy)
if self.dragging_scrollbar then
local delta = self:get_scrollable_size() / self.size.y * dy
self.scroll.to.y = self.scroll.to.y + delta
if not config.animate_drag_scroll then
self.scroll.y = self.scroll.to.y
end
end
self.hovered_scrollbar = self:scrollbar_overlaps_point(x, y)
self.hovered_scrollbar_track = self.hovered_scrollbar or self:scrollbar_track_overlaps_point(x, y)