Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add positioning

  • Loading branch information...
commit e067ce0b4155fa1d1d58e116cc337281150bada0 1 parent bea606e
@p3lim p3lim authored
Showing with 33 additions and 0 deletions.
  1. +17 −0 config/configuration.lua
  2. +16 −0 pMinimap.lua
View
17 config/configuration.lua
@@ -46,6 +46,16 @@ function ns.UpdateFont()
TimeManagerClockTicker:SetFont(font, size, flag)
end
+function ns.UpdatePosition(save)
+ if(save) then
+ local point, _, _, x, y = Minimap:GetPoint()
+ pMinimapDB.minimap.position = string.format('%s\031%d\031%d', point, x, y)
+ else
+ local point, x, y = string.split('\031', pMinimapDB.minimap.position)
+ Minimap:ClearAllPoints()
+ Minimap:SetPoint(point, UIParent, point, x, y)
+ end
+end
local function AddConfig(name, func)
local group = CreateFrame('Frame', nil, InterfaceOptionsFramePanelContainer)
@@ -68,6 +78,13 @@ AddConfig('pMinimap', function(self)
ns.UpdateCore()
end)
+ local unlock = ns.checkbox(self, 'Unlocked', 'TOPLEFT', 30, -80)
+ unlock:SetChecked(ns.UNLOCKED)
+ unlock:SetScript('OnClick', function()
+ ns.UNLOCKED = not ns.UNLOCKED
+ unlock:SetChecked(ns.UNLOCKED)
+ end)
+
local level = ns.slider(self, 'Frame Level', '%d', pMinimapDB.minimap.level, 0, 10, 1, 'TOPRIGHT', -30, -30)
level:HookScript('OnValueChanged', function(frame, value)
pMinimapDB.minimap.level = value
View
16 pMinimap.lua
@@ -11,6 +11,7 @@ local DEFAULTS = {
strata = 'BACKGROUND',
borderSize = 1,
borderColors = {0, 0, 0, 1},
+ position = 'TOPRIGHT\031-15\031-15',
},
objects = {
Zone = {point = 'TOP', shown = false},
@@ -43,7 +44,20 @@ function pMinimap:PLAYER_LOGIN()
end
end)
+ Minimap:SetMovable(true)
+ Minimap:SetClampedToScreen()
+ Minimap:RegisterForDrag('LeftButton')
Minimap:SetMaskTexture([=[Interface\ChatFrame\ChatFrameBackground]=])
+ Minimap:SetScript('OnDragStart', function(self)
+ if(not ns.UNLOCKED) then return end
+ self:StartMoving()
+ end)
+ Minimap:SetScript('OnDragStop', function(self)
+ if(not ns.UNLOCKED) then return end
+ self:StopMovingOrSizing()
+ ns.UpdatePosition(true)
+ end)
+
MinimapCluster:EnableMouse(false)
MinimapBorder:SetTexture(nil)
MinimapBorderTop:Hide()
@@ -79,6 +93,8 @@ function pMinimap:PLAYER_LOGIN()
TimeManagerClockTicker:SetPoint('CENTER', TimeManagerClockButton)
TimeManagerClockTicker:SetShadowOffset(0, 0)
+ ns.UNLOCKED = false
+ ns.UpdatePosition()
ns.UpdateObjects()
ns.UpdateCore()
ns.UpdateFont()
Please sign in to comment.
Something went wrong with that request. Please try again.