fix: reset view on page change
This commit is contained in:
parent
f8910aefa4
commit
8f1c326e6a
6 changed files with 24 additions and 0 deletions
|
@ -45,6 +45,10 @@ function FlowBox:setRealSize()
|
|||
self.h = self.view.lineNumber * self.widgetSize.h
|
||||
end
|
||||
|
||||
function FlowBox:resetView()
|
||||
self.view:reset()
|
||||
end
|
||||
|
||||
-- UPDATE FUNCTIONS
|
||||
-- Update the menu and its view
|
||||
|
||||
|
|
|
@ -137,6 +137,11 @@ function GridBox:update(dt)
|
|||
self.view.firstSlot = 1
|
||||
end
|
||||
|
||||
function GridBox:resetView()
|
||||
self.view:reset()
|
||||
end
|
||||
|
||||
|
||||
-- KEYS FUNCTIONS
|
||||
-- Handle the keyboard/manette functions
|
||||
|
||||
|
|
|
@ -50,6 +50,10 @@ function HListBox:update(dt)
|
|||
self.view:updateFirstSlot(self.widget:getSelected())
|
||||
end
|
||||
|
||||
function HListBox:resetView()
|
||||
self.view:reset()
|
||||
end
|
||||
|
||||
-- KEYBOARD FUNCTIONS
|
||||
-- Handle key check.
|
||||
|
||||
|
|
|
@ -50,6 +50,10 @@ function ListBox:update(dt)
|
|||
self.view:updateFirstSlot(self.widget:getSelected())
|
||||
end
|
||||
|
||||
function ListBox:resetView()
|
||||
self.view:reset()
|
||||
end
|
||||
|
||||
-- KEYBOARD FUNCTIONS
|
||||
-- Handle input from keyboard/controllers.
|
||||
|
||||
|
|
|
@ -109,10 +109,12 @@ end
|
|||
|
||||
function Menu:switch(pageName)
|
||||
self.widget:switch(pageName)
|
||||
self:resetView()
|
||||
end
|
||||
|
||||
function Menu:back()
|
||||
self.widget:back()
|
||||
self:resetView()
|
||||
end
|
||||
|
||||
-- ACTION FUNCTIONS
|
||||
|
|
|
@ -29,6 +29,11 @@ function View1D:new(slotNumber)
|
|||
self.firstSlot = 1
|
||||
end
|
||||
|
||||
function View1D:reset()
|
||||
self.firstSlot = 1
|
||||
print("reset")
|
||||
end
|
||||
|
||||
function View1D:updateFirstSlot(widgetID)
|
||||
self.firstSlot = math.max(1, widgetID - (self.slotNumber - 1), math.min(widgetID, self.firstSlot))
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue