Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use custom pin template and mixin to work around taints #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions WorldFlightMap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ function WorldFlightMapProvider:AddFlightNode(taxiNodeData)
if drawPin then
-- Duplicating all of this from frameXML because we need to raise the frame level of the pins
local playAnim = taxiNodeData.state ~= Enum.FlightPathState.Unreachable;
local pin = self:GetMap():AcquirePin("FlightMap_FlightPointPinTemplate", playAnim);
local pin = self:GetMap():AcquirePin("WorldFlightPinTemplate", playAnim);

-- For the sake of having other addons treat our buttons like normal taxi map buttons
_G['TaxiButton' .. taxiNodeData.slotIndex] = pin
Expand Down Expand Up @@ -295,7 +295,7 @@ function WorldFlightMapProvider:AddFlightNode(taxiNodeData)

pin:SetShown(taxiNodeData.state ~= Enum.FlightPathState.Unreachable); -- Only show if part of a route, handled in the route building functions

for poiPin in self:GetMap():EnumeratePinsByTemplate("FlightPointPinTemplate") do
for poiPin in self:GetMap():EnumeratePinsByTemplate("WorldFlightPinTemplate") do
if poiPin.name == taxiNodeData.name and playAnim then
poiPin:Hide()
else
Expand All @@ -308,6 +308,18 @@ function WorldFlightMapProvider:AddFlightNode(taxiNodeData)
end
end

function WorldFlightMapProvider:RemoveAllData()
self:GetMap():RemoveAllPinsByTemplate("WorldFlightPinTemplate")
self:GetMap():ResetTitleAndPortraitIcon()

if self.highlightLinePool then
self.highlightLinePool:ReleaseAll()
end
if self.backgroundLinePool then
self.backgroundLinePool:ReleaseAll()
end
end

function WorldFlightMapProvider:HighlightRouteToPin(pin)
if self.playerContinent == 905 then return end -- don't draw lines on argus maps (we could if they're on the same zone map)

Expand Down Expand Up @@ -378,3 +390,8 @@ function WorldMapFrame:UpdateTitleAndPortraitIcon()
end

WorldMapFrame:AddDataProvider(WorldFlightMapProvider)

-- use modified pin mixin and template to prevent taint
-- https://github.com/Stanzilla/WoWUIBugs/issues/453
WorldFlightPinMixin = CreateFromMixins(FlightMap_FlightPointPinMixin)
WorldFlightPinMixin.SetPassThroughButtons = function() end
1 change: 1 addition & 0 deletions WorldFlightMap.toc
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
## Dependencies: Blizzard_FlightMap

LinePool.lua
WorldFlightPin.xml
WorldFlightMap.lua
3 changes: 3 additions & 0 deletions WorldFlightPin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd">
<Frame name="WorldFlightPinTemplate" inherits="FlightMap_FlightPointPinTemplate" mixin="WorldFlightPinMixin" virtual="true"/>
</Ui>