Ok found something that might illustrate the issue and possible solution. From MiniMap.lua function AddLocation:
Lua Code:
local pinTooltipInfo = ZO_MapPin.TOOLTIP_CREATORS[MAP_PIN_TYPE_LOCATION]
locationPin:SetHandler("OnMouseEnter", function(pin)
FyrMM.SetTargetScale(pin, 1.3)
if not FyrMM.SV.PinTooltips then return end
if pinTooltipInfo.tooltip then
InitializeTooltip(ZO_MapLocationTooltip, Fyr_MM, TOPLEFT, 0, 0)
pinTooltipInfo.creator(pin.m_Pin)
IsCurrentLocation(pin)
end
end)
The anonymous function uses pinTooltipInfo from outer scope, thus each time this runs, a new closure holding that local variable must be created.
Possible solution: define the handler function outside AddLocation, and change it to obtain pinTooltipInfo in a different way -- either make it a member of an argument it gets, like this:
Lua Code:
locationPin.pinTooltipInfo = ZO_MapPin.TOOLTIP_CREATORS[MAP_PIN_TYPE_LOCATION]
locationPin:SetHandler("OnMouseEnter", locationPin_OnMouseEnter)
or in this case it can easily be obtained from ZO_MapPin in the handler itself:
Lua Code:
local function locationPin_OnMouseEnter(pin)
FyrMM.SetTargetScale(pin, 1.3)
if not FyrMM.SV.PinTooltips then return end
local pinTooltipInfo = ZO_MapPin.TOOLTIP_CREATORS[pin.m_PinType]
if pinTooltipInfo.tooltip then
InitializeTooltip(ZO_MapLocationTooltip, Fyr_MM, TOPLEFT, 0, 0)
pinTooltipInfo.creator(pin.m_Pin)
IsCurrentLocation(pin)
end
end)