-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathelemEditor.lua
More file actions
51 lines (46 loc) · 1.27 KB
/
elemEditor.lua
File metadata and controls
51 lines (46 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
local AddonName, Addon = ...
local frameName = nil
function Addon:ToggleElemEditor(frame)
local show = false
if frameName ~= frame then
show = true
end
Addon:CloseElemEditor()
if show then
Addon:ShowElemEditor(frame)
end
end
function Addon:ShowElemEditor(frame)
if Addon.fElemEditor == nil then
Addon:RenderElemEditor()
end
frameName = frame
Addon.fElemEditor:Show()
local elemInfo
if type(frame) == "number" then
elemInfo = IPMTTheme[IPMTOptions.theme].decors[frameName]
else
elemInfo = IPMTTheme[IPMTOptions.theme].elements[frameName]
end
local point = elemInfo.position.point
if point == nil then
point = 'LEFT'
end
Addon.fElemEditor.point:SelectItem(point, true)
local rPoint = elemInfo.position.rPoint
if rPoint == nil then
rPoint = 'TOPLEFT'
end
Addon.fElemEditor.rPoint:SelectItem(rPoint, true)
Addon.fElemEditor.posX:SetText(elemInfo.position.x)
Addon.fElemEditor.posY:SetText(elemInfo.position.y)
end
function Addon:CloseElemEditor()
frameName = nil
if Addon.fElemEditor ~= nil then
Addon.fElemEditor:Hide()
end
end
function Addon:SetElemPosition(param, value)
Addon:MoveElement(frameName, {[param] = value})
end