Skip to content

Commit

Permalink
added size option
Browse files Browse the repository at this point in the history
  • Loading branch information
Irame committed Feb 25, 2023
1 parent 9425622 commit 1252dd5
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 11 deletions.
12 changes: 7 additions & 5 deletions Borders.lua
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ local borderOptions = {
set = function(info, v)
local tex = getTextureAndDB(info)
tex.settings.width = v ~= 180 and v or nil
tex:SetWidth(v * (tex.settings.scale or 1))
tex:SetWidth(v * (tex.settings.scale or 1) * sm.core.sizeScale)
end
},
height = {
Expand All @@ -740,7 +740,7 @@ local borderOptions = {
set = function(info, v)
local tex = getTextureAndDB(info)
tex.settings.height = v ~= 180 and v or nil
tex:SetHeight(v * (tex.settings.scale or 1))
tex:SetHeight(v * (tex.settings.scale or 1) * sm.core.sizeScale)
end
},
layer = {
Expand Down Expand Up @@ -968,8 +968,8 @@ do
tex:SetBlendMode(t.blendMode or "ADD")
tex:SetVertexColor(t.r or 1, t.g or 1, t.b or 1, t.a or 1)
tex:SetPoint("CENTER", Minimap, "CENTER", t.hNudge or 0, t.vNudge or 0)
tex:SetWidth((t.width or defaultSize) * (t.scale or 1))
tex:SetHeight((t.height or defaultSize) * (t.scale or 1))
tex:SetWidth((t.width or defaultSize) * (t.scale or 1) * sm.core.sizeScale)
tex:SetHeight((t.height or defaultSize) * (t.scale or 1) * sm.core.sizeScale)
tex:SetDrawLayer(t.drawLayer or "ARTWORK")

tex.rotSpeed = t.rotSpeed or 0
Expand Down Expand Up @@ -1088,13 +1088,15 @@ function mod:UpdateBorder()
MinimapBorder:Show()
else
MinimapBackdrop:Show()
MinimapCompassTexture:SetSize(157, 168) -- We shrink the minimap so we gotta shrink the border also
MinimapCompassTexture:SetSize(157 * sm.core.sizeScale, 168 * sm.core.sizeScale) -- We shrink the minimap so we gotta shrink the border also
end
end
end

function mod:UpdateBackdrop()
if mod.db.backdrop.show then
customBackdrop:SetWidth(Minimap:GetWidth())
customBackdrop:SetHeight(Minimap:GetHeight())
customBackdrop:Show()
customBackdrop:SetScale(mod.db.backdrop.scale or 1)
customBackdrop:SetAlpha(mod.db.backdrop.alpha or 1)
Expand Down
42 changes: 36 additions & 6 deletions SexyMap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,36 @@ mod.options = {
end,
disabled = not MinimapNorthTag,
},
zoom = {
size = {
order = 7,
type = "range",
name = L["Size (diameter)"],
min = 20,
max = 300,
step = 1,
bigStep = 10,
width = 2,
get = function(info)
return mod.db.size
end,
set = function(info, v)
mod.db.size = v
mod.sizeScale = v / 140
Minimap:SetSize(v, v)

-- workaround to update the aktual size of the Minimap
-- without the need to move the character
-- TODO: find better solution
Minimap:SetScale(mod.db.scale+1);
Minimap:SetScale(mod.db.scale);

sm.buttons:UpdateDraggables()
sm.borders:ApplySettings()
end,
},
zoom = {
order = 8,
type = "range",
name = L["Auto Zoom-Out Delay"],
desc = L["If you zoom into the map, this feature will automatically zoom out after the selected period of time (seconds). Using a value of 0 will disable Auto Zoom-Out."],
width = 2,
Expand All @@ -158,18 +185,18 @@ mod.options = {
end,
},
spacer1 = {
order = 8,
order = 9,
type = "description",
width = "full",
name = "\n\n",
},
presetHeader = {
order = 9,
order = 10,
type = "header",
name = L["Preset"],
},
spacer2 = {
order = 10,
order = 11,
type = "description",
width = "full",
name = L["Quickly change the look of your minimap by using a minimap preset."].."\n",
Expand Down Expand Up @@ -378,6 +405,9 @@ function mod:ADDON_LOADED(addon)
end
mod.db = dbToDispatch.core

mod.db.size = mod.db.size or 140
mod.sizeScale = mod.db.size / 140

mod.loadModules = {}
for k,v in pairs(sm) do
if v.OnInitialize then
Expand Down Expand Up @@ -572,8 +602,8 @@ function mod:SetupMap()
end
Minimap:RegisterForDrag("LeftButton")
Minimap:SetClampedToScreen(mod.db.clamp)
Minimap:SetSize(mod.db.size, mod.db.size)
Minimap:SetScale(mod.db.scale or (MinimapNorthTag and 1 or 1.1))
Minimap:SetSize(140, 140)
Minimap:SetMovable(not mod.db.lock)

if mod.db.rotate then
Expand Down Expand Up @@ -627,7 +657,7 @@ function public:Restore()
mod.frame.SetPoint(Minimap, mod.db.point, UIParent, mod.db.relpoint, mod.db.x, mod.db.y)
Minimap:SetClampedToScreen(mod.db.clamp)
Minimap:SetScale(mod.db.scale or (MinimapNorthTag and 1 or 1.1))
Minimap:SetSize(140, 140)
Minimap:SetSize(mod.db.size, mod.db.size)
Minimap:SetMovable(not mod.db.lock)
end

Expand Down
1 change: 1 addition & 0 deletions localization/deDE.lua
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ L["Show North Tag"] = "Zeige Norden-Anzeiger"
L["Show on minimap"] = "Zeige an der Minikarte"
L["Show %s:"] = "Zeige %s:"
L["Show who pinged"] = "Zeige wer gepingt hat"
L["Size (diameter)"] = "Größe (Durchmesser)"
L["Snowflake"] = "Schneeflocke"
L["Spice up your minimap with some sexy options."] = "Peppe deine Minikarte auf, mit ein paar sexy Optionen."
L["Square"] = "Rechteck"
Expand Down
1 change: 1 addition & 0 deletions localization/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ L["Right clicking the map will open the SexyMap options"] = "Right clicking the
L["Auto Zoom-Out Delay"] = "Auto Zoom-Out Delay"
L["If you zoom into the map, this feature will automatically zoom out after the selected period of time (seconds). Using a value of 0 will disable Auto Zoom-Out."] = "If you zoom into the map, this feature will automatically zoom out after the selected period of time (seconds). Using a value of 0 will disable Auto Zoom-Out."
L["Show North Tag"] = "Show North Tag"
L["Size (diameter)"] = "Size (diameter)"
L["Profiles"] = "Profiles"
L["Copy a Profile"] = "Copy a Profile"
L["Copying this profile will reload your UI, are you sure?"] = "Copying this profile will reload your UI, are you sure?"
Expand Down

0 comments on commit 1252dd5

Please sign in to comment.