Skip to content

Commit

Permalink
Added a general option in Nameplates Appearance section to increase/a…
Browse files Browse the repository at this point in the history
…djust Nameplates Scale (github issue #7)
  • Loading branch information
michaelnpsp committed Jan 22, 2024
1 parent 3386b82 commit d3940cb
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
21 changes: 12 additions & 9 deletions core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,7 @@ do
for class,color in pairs(cfg.classColor) do
ClassColors[class] = color
end
pixelScale = 768/select(2,GetPhysicalScreenSize())/WorldFrame:GetScale()
pixelScale = 768/select(2,GetPhysicalScreenSize())/WorldFrame:GetScale() * (cfg.scaleAdjust or 1)
if not InCombatLockdown() then
SetCVar("nameplateGlobalScale", 1)
SetCVar("nameplateSelectedScale", 1)
Expand Down Expand Up @@ -1141,6 +1141,17 @@ do
end
end

function addon:UpdateVisibility() -- friend/enemy visibility, only called from options
UpdateVisibility()
end

function addon:UpdateScale() -- scale adjust, only called from options
UpdateGeneral()
for _, UnitFrame in pairs(NamePlates) do
UnitFrame:SetScale(pixelScale)
end
end

function addon:Update()

UpgradeDatabase()
Expand Down Expand Up @@ -1175,14 +1186,6 @@ do
end
end

----------------------------------------------------------------
-- Friend/Enemy visibility, only called from options
----------------------------------------------------------------

function addon:UpdateVisibility()
UpdateVisibility()
end

----------------------------------------------------------------
-- Database profile changed
----------------------------------------------------------------
Expand Down
17 changes: 16 additions & 1 deletion options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -630,9 +630,24 @@ Opt_SetupOption( 'General', 'Nameplate Visibility (Target)', {
} )

Opt_SetupOption( 'General', 'Nameplates Appearance', {
nameplateScaleAdjust = {
type = "range",
order = 1, width = 1,
name = "Nameplates Scale",
desc = "Change this option to adjust the scale of the nameplates.",
softMin = 1, min = 0.1,
softMax = 3, max = 5,
step = 0.001, bigStep = 0.01,
isPercent = true,
get = function () return addon.db.general.scaleAdjust or 1 end,
set = function (_, v)
addon.db.general.scaleAdjust = v~=1 and v or nil
addon:UpdateScale()
end,
},
nameplateClassicBorders = {
type = "toggle",
order = 1, width = "double",
order = 2, width = 1.5,
name = "Blizzard Border Textures",
desc = "Enable Blizzard textures for nameplates & castbars borders. This option is global and will be applied to all profiles and skins.",
get = function()
Expand Down

0 comments on commit d3940cb

Please sign in to comment.