* fix #1538 log scrolls automatically adds: - when user scrolls, position is kept no matter how many new entries arrive - when user scrolls up to last entry, autoscroll is enabled again does not add buttons to jump up/down see #1538 * move scroll-test out of on_mouse_wheel * determine diff_index with loop * remove check at move_towards yoffset * use while loop instead of repeat loop * remove meaningless setter * remove stray var
This commit is contained in:
parent
bd53bc3718
commit
b5617a3eef
|
@ -125,9 +125,19 @@ end
|
|||
function LogView:update()
|
||||
local item = core.log_items[#core.log_items]
|
||||
if self.last_item ~= item then
|
||||
local lh = style.font:get_height() + style.padding.y
|
||||
if 0 < self.scroll.to.y then
|
||||
local index = #core.log_items
|
||||
while index > 1 and self.last_item ~= core.log_items[index] do
|
||||
index = index - 1
|
||||
end
|
||||
local diff_index = #core.log_items - index
|
||||
self.scroll.to.y = self.scroll.to.y + diff_index * lh
|
||||
self.scroll.y = self.scroll.to.y
|
||||
else
|
||||
self.yoffset = -lh
|
||||
end
|
||||
self.last_item = item
|
||||
self.scroll.to.y = 0
|
||||
self.yoffset = -(style.font:get_height() + style.padding.y)
|
||||
end
|
||||
|
||||
local expanding = self.expanding[1]
|
||||
|
|
Loading…
Reference in New Issue