Skip to content

Commit

Permalink
Abbreviate distance text
Browse files Browse the repository at this point in the history
  • Loading branch information
ntowle committed Nov 22, 2024
1 parent deb50dc commit 8d1fdc8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 1 addition & 2 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
td = "lua51"
max_line_length = false
codes = true
exclude_files = {
}
ignore = {
"212/self"
}
globals = {
"AbbreviateNumbers",
"C_Map",
"C_Navigation",
"C_SuperTrack",
Expand Down
9 changes: 8 additions & 1 deletion MapPinTimers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ end

-- replaces UpdateDistanceText from Blizzard_QuestNavigation/SuperTrackedFrame.lua
do
local function GetDistanceString(distance)
if distance < 1000 then
return tostring(distance)
else
return AbbreviateNumbers(distance)
end
end
local throttle = 0
local lastDistance = nil
local function UpdateDistanceTextWithTimer(self, elapsed)
Expand All @@ -57,7 +64,7 @@ do
end
throttle = 0
end
self.DistanceText:SetText(IN_GAME_NAVIGATION_RANGE:format(Round(distance)))
self.DistanceText:SetText(IN_GAME_NAVIGATION_RANGE:format(GetDistanceString(Round(distance))))
else
self.TimeText:SetShown(false)
lastDistance = nil
Expand Down

0 comments on commit 8d1fdc8

Please sign in to comment.