core/menusystem: put the view update in its own function

This commit is contained in:
Kazhnuz 2019-02-13 18:04:27 +01:00
parent 0a4d57e46b
commit ded24ede27
2 changed files with 8 additions and 0 deletions

View file

@ -25,6 +25,10 @@ function FlowBox:updateWidgetSize()
end end
function FlowBox:update(dt) function FlowBox:update(dt)
self:updateView()
end
function FlowBox:updateView()
local col, line = self:getCoord(self.widget.selected) local col, line = self:getCoord(self.widget.selected)
local begincol, beginline = self:getCoord(self.view.firstSlot) local begincol, beginline = self:getCoord(self.view.firstSlot)

View file

@ -20,6 +20,10 @@ function ListBox:updateWidgetSize()
end end
function ListBox:update(dt) function ListBox:update(dt)
self:updateView()
end
function ListBox:updateView()
if self.widget.selected < self.view.firstSlot then if self.widget.selected < self.view.firstSlot then
self.view.firstSlot = self.widget.selected self.view.firstSlot = self.widget.selected
end end