Skip to content

Commit

Permalink
Properly handle vehicle button show/hide
Browse files Browse the repository at this point in the history
Early hooking changes prevented the default Blizzard logic from hiding
it in some cases.

Fixes #40
  • Loading branch information
Nevcairiel committed Oct 19, 2020
1 parent 45209cb commit e5a60da
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions VehicleBar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,24 @@ function VehicleBarMod:ApplyConfig()
self.bar:ApplyConfig(self.db.profile)
end

function VehicleBarMod:MainMenuBarVehicleLeaveButton_Update()
local function ShouldVehicleButtonBeShown()
if WoWClassic then
if UnitOnTaxi("player") then
MainMenuBarVehicleLeaveButton:Show()
end
return UnitOnTaxi("player")
else
return CanExitVehicle()
end
end

function VehicleBarMod:MainMenuBarVehicleLeaveButton_Update()
if ShouldVehicleButtonBeShown() then
self.bar:PerformLayout()
MainMenuBarVehicleLeaveButton:Show()
MainMenuBarVehicleLeaveButton:Enable()
else
if CanExitVehicle() then
MainMenuBarVehicleLeaveButton:Show()
end
MainMenuBarVehicleLeaveButton:SetHighlightTexture([[Interface\Buttons\ButtonHilight-Square]], "ADD")
MainMenuBarVehicleLeaveButton:UnlockHighlight()
MainMenuBarVehicleLeaveButton:Hide()
end
self.bar:PerformLayout()
end

function VehicleBar:ApplyConfig(config)
Expand Down

0 comments on commit e5a60da

Please sign in to comment.