mirror of
https://github.com/edubart/otclient.git
synced 2025-05-02 18:49:21 +02:00
Fix UITabBar and UIMoveableTabBar bricking when removing first tabs in (#1101) collapsed view
Co-authored-by: Xagul <eixim@hotmail.com>
This commit is contained in:
parent
b3aaa10646
commit
88d0ea34bf
@ -334,9 +334,12 @@ function UIMoveableTabBar:removeTab(tab)
|
||||
end
|
||||
|
||||
if self.currentTab == tab then
|
||||
self:selectPrevTab()
|
||||
if #self.tabs == 1 then
|
||||
self.currentTab = nil
|
||||
elseif index == #self.tabs then
|
||||
self:selectPrevTab()
|
||||
else
|
||||
self:selectNextTab()
|
||||
end
|
||||
end
|
||||
table.remove(tabTable, index)
|
||||
|
@ -77,7 +77,13 @@ function UITabBar:removeTab(tab)
|
||||
local index = table.find(self.tabs, tab)
|
||||
if index == nil then return end
|
||||
if self.currentTab == tab then
|
||||
self:selectPrevTab()
|
||||
if #self.tabs == 1 then
|
||||
self.currentTab = nil
|
||||
elseif index == #self.tabs then
|
||||
self:selectPrevTab()
|
||||
else
|
||||
self:selectNextTab()
|
||||
end
|
||||
end
|
||||
table.remove(self.tabs, index)
|
||||
tab:destroy()
|
||||
|
Loading…
x
Reference in New Issue
Block a user