Skip to content
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
8 changes: 7 additions & 1 deletion modules/pins/pinManager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function PinManager:GetPositionStringForPin(pinData)
return string.format("%s:%.4f:%.4f", pinData.mapID, pinData.x, pinData.y)
end

function PinManager:TrackNearestPin()
function PinManager:GetNearestPin()
local nearestPin = nil
local playerX, playerY, playerMap = Blizz:GetPlayerMapPosition()
if not playerMap or not playerX or not playerY then return end
Expand All @@ -42,6 +42,12 @@ function PinManager:TrackNearestPin()
}
end
end

return nearestPin
end

function PinManager:TrackNearestPin()
local nearestPin = self:GetNearestPin()
if nearestPin then
nearestPin.pin:Track()
end
Expand Down
19 changes: 19 additions & 0 deletions modules/providers/global.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,24 @@ end
globalMapPinEnhanced.AddWaypoint = function(_, pinData)
PinManager:AddPin(pinData)
end
globalMapPinEnhanced.TrackNearestPin = function()
PinManager:TrackNearestPin()
end
globalMapPinEnhanced.SetClosestWaypoint = function()
PinManager:TrackNearestPin()
end
globalMapPinEnhanced.GetNearestPin = function()
return PinManager:GetNearestPin()
end
globalMapPinEnhanced.GetClosestWaypoint = function()
return PinManager:GetNearestPin()
end
globalMapPinEnhanced.ClearAllPins = function()
PinManager:ClearPins()
end
globalMapPinEnhanced.ClearAllWaypoints = function()
PinManager:ClearPins()
end

---@type table
_G[MapPinEnhanced.addonName] = globalMapPinEnhanced
13 changes: 13 additions & 0 deletions modules/providers/tomtom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,19 @@ local function AddTomTomShim()
setTracked = true,
})
end

TomTom.SetClosestWaypoint = function(_, ...)
PinManager:TrackNearestPin()
end

TomTom.GetClosestWaypoint = function(_, ...)
return PinManager:GetNearestPin()
end

TomTom.ClearAllWaypoints = function(_, ...)
PinManager:ClearPins()
end

_G.TomTom = TomTom
end

Expand Down