diff --git a/FlightFinder/FlightFinder.lua b/FlightFinder/FlightFinder.lua index 4733f4e..27a053a 100644 --- a/FlightFinder/FlightFinder.lua +++ b/FlightFinder/FlightFinder.lua @@ -266,7 +266,10 @@ function FlightFinderPinMixin:OnAcquired(id) self.Disc:SetVertexColor(0.06, 0.06, 0.08, 0.9) self.Ring:SetVertexColor(c[1], c[2], c[3], 1) self.Glyph:SetTexture(GLYPH) - self:CheckMouseButtonPassthrough("RightButton") + -- SetPassThroughButtons is protected in combat; a pin reused from the pool keeps its old setting + if not InCombatLockdown() then + self:CheckMouseButtonPassthrough("RightButton") + end end -- where a waypoint for the node goes: its zone map, since continents don't take waypoints diff --git a/ShipRoutes/ShipRoutes.lua b/ShipRoutes/ShipRoutes.lua index c56dd1f..7902877 100644 --- a/ShipRoutes/ShipRoutes.lua +++ b/ShipRoutes/ShipRoutes.lua @@ -554,7 +554,10 @@ function ShipRoutesPinMixin:OnAcquired(kind, a, b) self.Label:Show() end self.Disc:SetVertexColor(0.06, 0.06, 0.08, 0.9) - self:CheckMouseButtonPassthrough("RightButton") + -- SetPassThroughButtons is protected in combat; a pin reused from the pool keeps its old setting + if not InCombatLockdown() then + self:CheckMouseButtonPassthrough("RightButton") + end end function ShipRoutesPinMixin:OnMouseEnter() diff --git a/tests/test_ff.lua b/tests/test_ff.lua index 50f84f0..09eef77 100644 --- a/tests/test_ff.lua +++ b/tests/test_ff.lua @@ -76,6 +76,9 @@ function NumTaxiNodes() return #taxi end function TaxiNodeName(i) return taxi[i][1] end function TaxiNodeGetType(i) return taxi[i][2] end +local inCombat = false +function InCombatLockdown() return inCombat end + local faction = "Alliance" function UnitFactionGroup() return faction end @@ -95,7 +98,7 @@ MapCanvasDataProviderMixin = { MapCanvasPinMixin = { UseFrameLevelType = function() end, SetScalingLimits = function() end, - CheckMouseButtonPassthrough = function() end, + CheckMouseButtonPassthrough = function(self) self.passthrough = true end, GetMap = function() return WorldMapFrame end, } local function texture() @@ -200,6 +203,13 @@ waypoint = nil loch:OnMouseClickAction("LeftButton") check(waypoint and waypoint.m == 1432, "waypoint set on Loch Modan, got " .. tostring(waypoint and waypoint.m)) +-- SetPassThroughButtons is protected in combat: pins drawn in combat skip it +check(show(1432)[8].passthrough, "passthrough set out of combat") +inCombat = true +local fought = show(1432)[8] +check(fought and not fought.passthrough, "no passthrough call in combat") +inCombat = false + -- slash toggles and counts SlashCmdList.FLIGHTFINDER("") check(printed and printed:find("hidden") and printed:find("%d+ / %d+"), "slash prints hidden + count: " .. tostring(printed)) diff --git a/tests/test_sr.lua b/tests/test_sr.lua index da6b2ee..72b2760 100644 --- a/tests/test_sr.lua +++ b/tests/test_sr.lua @@ -28,6 +28,7 @@ local function to947(inst, x, y) return a[1] + (a[8] - y) / (a[8] - a[7]) * (a[2] - a[1]), a[3] + (a[6] - x) / (a[6] - a[5]) * (a[4] - a[3]) end +function InCombatLockdown() return false end Enum = { UIMapType = { Cosmic = 0, World = 1, Continent = 2, Zone = 3 } } function CreateVector2D(x, y) return { x = x, y = y, GetXY = function(self) return self.x, self.y end }