Skip to content

Commit

Permalink
Buttons: Add a scale slider, closes #10 and closes #309
Browse files Browse the repository at this point in the history
  • Loading branch information
funkydude committed May 3, 2023
1 parent e09d1b7 commit 619c962
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions Buttons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ local options = {
min = -30,
max = 100,
step = 1,
bigStep = 1,
order = 103,
disabled = function()
return not mod.db.allowDragging
Expand All @@ -117,8 +116,26 @@ local options = {
mod:UpdateDraggables()
end
},
visSpacer = {
scale = {
order = 104,
type = "range",
name = L["Scale"],
min = 0.5,
max = 1,
step = 0.01,
disabled = function()
return not mod.db.allowDragging
end,
get = function(info)
return mod.db.scale
end,
set = function(info, v)
mod.db.scale = v
mod:UpdateDraggables()
end,
},
visSpacer = {
order = 105,
type = "header",
name = L["Visibility"],
},
Expand All @@ -127,7 +144,7 @@ local options = {
name = L["Let SexyMap control button visibility"],
desc = L["Turn this off if you want another mod to handle which buttons are visible on the minimap."],
width = "full",
order = 105,
order = 106,
get = function()
return mod.db.controlVisibility
end,
Expand Down Expand Up @@ -193,6 +210,7 @@ function mod:OnInitialize(profile)
if type(profile.buttons) ~= "table" then
profile.buttons = {
radius = 10,
scale = 1,
dragPositions = {},
visibilitySettings = {
MinimapZoomIn = "never",
Expand All @@ -210,12 +228,17 @@ function mod:OnInitialize(profile)
}
end

self.db = profile.buttons
-- XXX temp 9.0.1
if not profile.buttons.visibilitySettings.SexyMapZoneTextButton then
profile.buttons.visibilitySettings.SexyMapZoneTextButton = "always"
profile.buttons.visibilitySettings.MinimapZoneTextButton = nil
end
-- XXX temp 10.1.0
if not profile.buttons.scale then
profile.buttons.scale = 1
end

self.db = profile.buttons
end

function mod:OnEnable()
Expand Down Expand Up @@ -544,6 +567,7 @@ do
local setPosition = function(frame, angle)
local radius = (Minimap:GetWidth() / 2) + mod.db.radius
local bx, by = sm.shapes:GetPosition(angle, radius)
frame:SetScale(mod.db.scale)

frame:ClearAllPoints()
frame:SetPoint("CENTER", Minimap, "CENTER", bx, by)
Expand Down

0 comments on commit 619c962

Please sign in to comment.