mirror of
https://github.com/edubart/otclient.git
synced 2025-05-03 19:19: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
|
end
|
||||||
|
|
||||||
if self.currentTab == tab then
|
if self.currentTab == tab then
|
||||||
self:selectPrevTab()
|
|
||||||
if #self.tabs == 1 then
|
if #self.tabs == 1 then
|
||||||
self.currentTab = nil
|
self.currentTab = nil
|
||||||
|
elseif index == #self.tabs then
|
||||||
|
self:selectPrevTab()
|
||||||
|
else
|
||||||
|
self:selectNextTab()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
table.remove(tabTable, index)
|
table.remove(tabTable, index)
|
||||||
|
@ -77,7 +77,13 @@ function UITabBar:removeTab(tab)
|
|||||||
local index = table.find(self.tabs, tab)
|
local index = table.find(self.tabs, tab)
|
||||||
if index == nil then return end
|
if index == nil then return end
|
||||||
if self.currentTab == tab then
|
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
|
end
|
||||||
table.remove(self.tabs, index)
|
table.remove(self.tabs, index)
|
||||||
tab:destroy()
|
tab:destroy()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user