mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 08:24:44 +00:00
E:Point, E:Size, E:Width, E:Height, & cleanup
This commit is contained in:
+52
-66
@@ -114,30 +114,30 @@ function E:Grid_Create()
|
||||
else
|
||||
tx:SetTexture(0, 0, 0)
|
||||
end
|
||||
tx:SetPoint("TOPLEFT", grid, "TOPLEFT", i*wStep - (size/2), 0)
|
||||
tx:SetPoint("BOTTOMRIGHT", grid, "BOTTOMLEFT", i*wStep + (size/2), 0)
|
||||
E:Point(tx, "TOPLEFT", grid, "TOPLEFT", i*wStep - (size/2), 0)
|
||||
E:Point(tx, "BOTTOMRIGHT", grid, "BOTTOMLEFT", i*wStep + (size/2), 0)
|
||||
end
|
||||
height = GetScreenHeight()
|
||||
|
||||
do
|
||||
local tx = grid:CreateTexture(nil, "BACKGROUND")
|
||||
tx:SetTexture(1, 0, 0)
|
||||
tx:SetPoint("TOPLEFT", grid, "TOPLEFT", 0, -(height/2) + (size/2))
|
||||
tx:SetPoint("BOTTOMRIGHT", grid, "TOPRIGHT", 0, -(height/2 + size/2))
|
||||
E:Point(tx, "TOPLEFT", grid, "TOPLEFT", 0, -(height/2) + (size/2))
|
||||
E:Point(tx, "BOTTOMRIGHT", grid, "TOPRIGHT", 0, -(height/2 + size/2))
|
||||
end
|
||||
|
||||
for i = 1, floor((height/2)/hStep) do
|
||||
local tx = grid:CreateTexture(nil, "BACKGROUND")
|
||||
tx:SetTexture(0, 0, 0)
|
||||
|
||||
tx:SetPoint("TOPLEFT", grid, "TOPLEFT", 0, -(height/2+i*hStep) + (size/2))
|
||||
tx:SetPoint("BOTTOMRIGHT", grid, "TOPRIGHT", 0, -(height/2+i*hStep + size/2))
|
||||
E:Point(tx, "TOPLEFT", grid, "TOPLEFT", 0, -(height/2+i*hStep) + (size/2))
|
||||
E:Point(tx, "BOTTOMRIGHT", grid, "TOPRIGHT", 0, -(height/2+i*hStep + size/2))
|
||||
|
||||
tx = grid:CreateTexture(nil, "BACKGROUND")
|
||||
tx:SetTexture(0, 0, 0)
|
||||
|
||||
tx:SetPoint("TOPLEFT", grid, "TOPLEFT", 0, -(height/2-i*hStep) + (size/2))
|
||||
tx:SetPoint("BOTTOMRIGHT", grid, "TOPRIGHT", 0, -(height/2-i*hStep + size/2))
|
||||
E:Point(tx, "TOPLEFT", grid, "TOPLEFT", 0, -(height/2-i*hStep) + (size/2))
|
||||
E:Point(tx, "BOTTOMRIGHT", grid, "TOPRIGHT", 0, -(height/2-i*hStep + size/2))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -166,7 +166,7 @@ function E:NudgeMover(nudgeX, nudgeY)
|
||||
local x, y, point = E:CalculateMoverPoints(mover, nudgeX, nudgeY)
|
||||
|
||||
mover:ClearAllPoints()
|
||||
mover:SetPoint(mover.positionOverride or point, E.UIParent, mover.positionOverride and "BOTTOMLEFT" or point, x, y)
|
||||
E:Point(mover, mover.positionOverride or point, E.UIParent, mover.positionOverride and "BOTTOMLEFT" or point, x, y)
|
||||
E:SaveMoverPosition(mover.name)
|
||||
|
||||
E:UpdateNudgeFrame(mover, x, y)
|
||||
@@ -200,10 +200,9 @@ function E:CreateMoverPopup()
|
||||
f:SetMovable(true)
|
||||
f:SetFrameLevel(99)
|
||||
f:SetClampedToScreen(true)
|
||||
f:SetWidth(360)
|
||||
f:SetHeight(170)
|
||||
E:Size(f, 360, 170)
|
||||
E:SetTemplate(f, "Transparent")
|
||||
f:SetPoint("BOTTOM", UIParent, "CENTER", 0, 100)
|
||||
E:Point(f, "BOTTOM", UIParent, "CENTER", 0, 100)
|
||||
f:SetScript("OnHide", function()
|
||||
if ElvUIMoverPopupWindowDropDown then
|
||||
UIDropDownMenu_SetSelectedValue(ElvUIMoverPopupWindowDropDown, "ALL")
|
||||
@@ -215,8 +214,8 @@ function E:CreateMoverPopup()
|
||||
|
||||
local header = CreateFrame("Button", nil, f)
|
||||
E:SetTemplate(header, "Default", true)
|
||||
header:SetWidth(100) header:SetHeight(25)
|
||||
header:SetPoint("CENTER", f, "TOP")
|
||||
E:Size(header, 100, 25)
|
||||
E:Point(header, "CENTER", f, "TOP")
|
||||
header:SetFrameLevel(header:GetFrameLevel() + 2)
|
||||
header:EnableMouse(true)
|
||||
header:RegisterForClicks("AnyUp", "AnyDown")
|
||||
@@ -225,15 +224,15 @@ function E:CreateMoverPopup()
|
||||
|
||||
local title = header:CreateFontString("OVERLAY")
|
||||
E:FontTemplate(title)
|
||||
title:SetPoint("CENTER", header, "CENTER")
|
||||
E:Point(title, "CENTER", header, "CENTER")
|
||||
title:SetText("ElvUI")
|
||||
|
||||
local desc = f:CreateFontString("ARTWORK")
|
||||
desc:SetFontObject("GameFontHighlight")
|
||||
desc:SetJustifyV("TOP")
|
||||
desc:SetJustifyH("LEFT")
|
||||
desc:SetPoint("TOPLEFT", 18, -32)
|
||||
desc:SetPoint("BOTTOMRIGHT", -18, 48)
|
||||
E:Point(desc, "TOPLEFT", 18, -32)
|
||||
E:Point(desc, "BOTTOMRIGHT", -18, 48)
|
||||
desc:SetText(L["DESC_MOVERCONFIG"])
|
||||
|
||||
local snapping = CreateFrame("CheckButton", f:GetName().."CheckButton", f, "OptionsCheckButtonTemplate")
|
||||
@@ -262,8 +261,7 @@ function E:CreateMoverPopup()
|
||||
end)
|
||||
|
||||
local align = CreateFrame("EditBox", f:GetName().."EditBox", f, "InputBoxTemplate")
|
||||
align:SetWidth(32)
|
||||
align:SetHeight(17)
|
||||
E:Size(align, 32, 17)
|
||||
align:SetAutoFocus(false)
|
||||
align:SetScript("OnEscapePressed", function()
|
||||
this:SetText(E.db.gridSize)
|
||||
@@ -292,13 +290,13 @@ function E:CreateMoverPopup()
|
||||
end)
|
||||
|
||||
align.text = align:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||
align.text:SetPoint("RIGHT", align, "LEFT", -4, 0)
|
||||
E:Point(align.text, "RIGHT", align, "LEFT", -4, 0)
|
||||
align.text:SetText(L["Grid Size:"])
|
||||
|
||||
--position buttons
|
||||
snapping:SetPoint("BOTTOMLEFT", 14, 10)
|
||||
lock:SetPoint("BOTTOMRIGHT", -14, 14)
|
||||
align:SetPoint("TOPRIGHT", lock, "TOPLEFT", -4, -2)
|
||||
E:Point(snapping, "BOTTOMLEFT", 14, 10)
|
||||
E:Point(lock, "BOTTOMRIGHT", -14, 14)
|
||||
E:Point(align, "TOPRIGHT", lock, "TOPLEFT", -4, -2)
|
||||
|
||||
S:HandleCheckBox(snapping)
|
||||
S:HandleButton(lock)
|
||||
@@ -314,20 +312,19 @@ function E:CreateMoverPopup()
|
||||
end)
|
||||
|
||||
local configMode = CreateFrame("Frame", f:GetName().."DropDown", f, "UIDropDownMenuTemplate")
|
||||
configMode:SetPoint("BOTTOMRIGHT", lock, "TOPRIGHT", 8, -5)
|
||||
E:Point(configMode, "BOTTOMRIGHT", lock, "TOPRIGHT", 8, -5)
|
||||
S:HandleDropDownBox(configMode, 148)
|
||||
configMode.text = configMode:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||
configMode.text:SetPoint("RIGHT", configMode.backdrop, "LEFT", -2, 0)
|
||||
E:Point(configMode.text, "RIGHT", configMode.backdrop, "LEFT", -2, 0)
|
||||
configMode.text:SetText(L["Config Mode:"])
|
||||
|
||||
UIDropDownMenu_Initialize(configMode, ConfigMode_Initialize)
|
||||
|
||||
local nudgeFrame = CreateFrame("Frame", "ElvUIMoverNudgeWindow", E.UIParent)
|
||||
nudgeFrame:SetFrameStrata("DIALOG")
|
||||
nudgeFrame:SetWidth(200)
|
||||
nudgeFrame:SetHeight(110)
|
||||
E:Size(nudgeFrame, 200, 110)
|
||||
E:SetTemplate(nudgeFrame, "Transparent")
|
||||
nudgeFrame:SetPoint("TOP", ElvUIMoverPopupWindow, "BOTTOM", 0, -15)
|
||||
E:Point(nudgeFrame, "TOP", ElvUIMoverPopupWindow, "BOTTOM", 0, -15)
|
||||
nudgeFrame:SetFrameLevel(100)
|
||||
nudgeFrame:Hide()
|
||||
nudgeFrame:EnableMouse(true)
|
||||
@@ -336,19 +333,18 @@ function E:CreateMoverPopup()
|
||||
|
||||
header = CreateFrame("Button", "ElvUIMoverNudgeWindowHeader", nudgeFrame)
|
||||
E:SetTemplate(header, "Default", true)
|
||||
header:SetWidth(100) header:SetHeight(25)
|
||||
header:SetPoint("CENTER", nudgeFrame, "TOP")
|
||||
E:Size(header, 100, 25)
|
||||
E:Point(header, "CENTER", nudgeFrame, "TOP")
|
||||
header:SetFrameLevel(header:GetFrameLevel() + 2)
|
||||
|
||||
title = header:CreateFontString("OVERLAY")
|
||||
E:FontTemplate(title)
|
||||
title:SetPoint("CENTER", header, "CENTER")
|
||||
E:Point(title, "CENTER", header, "CENTER")
|
||||
title:SetText(L["Nudge"])
|
||||
header.title = title
|
||||
|
||||
local xOffset = CreateFrame("EditBox", nudgeFrame:GetName().."XEditBox", nudgeFrame, "InputBoxTemplate")
|
||||
xOffset:SetWidth(50)
|
||||
xOffset:SetHeight(17)
|
||||
E:Size(xOffset, 50, 17)
|
||||
xOffset:SetAutoFocus(false)
|
||||
xOffset.currentValue = 0
|
||||
xOffset:SetScript("OnEscapePressed", function()
|
||||
@@ -374,15 +370,14 @@ function E:CreateMoverPopup()
|
||||
end)
|
||||
|
||||
xOffset.text = xOffset:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||
xOffset.text:SetPoint("RIGHT", xOffset, "LEFT", -4, 0)
|
||||
E:Point(xOffset.text, "RIGHT", xOffset, "LEFT", -4, 0)
|
||||
xOffset.text:SetText("X:")
|
||||
xOffset:SetPoint("BOTTOMRIGHT", nudgeFrame, "CENTER", -6, 8)
|
||||
E:Point(xOffset, "BOTTOMRIGHT", nudgeFrame, "CENTER", -6, 8)
|
||||
nudgeFrame.xOffset = xOffset
|
||||
S:HandleEditBox(xOffset)
|
||||
|
||||
local yOffset = CreateFrame("EditBox", nudgeFrame:GetName().."YEditBox", nudgeFrame, "InputBoxTemplate")
|
||||
yOffset:SetWidth(50)
|
||||
yOffset:SetHeight(17)
|
||||
E:Size(yOffset, 50, 17)
|
||||
yOffset:SetAutoFocus(false)
|
||||
yOffset.currentValue = 0
|
||||
yOffset:SetScript("OnEscapePressed", function()
|
||||
@@ -408,17 +403,16 @@ function E:CreateMoverPopup()
|
||||
end)
|
||||
|
||||
yOffset.text = yOffset:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||
yOffset.text:SetPoint("RIGHT", yOffset, "LEFT", -4, 0)
|
||||
E:Point(yOffset.text, "RIGHT", yOffset, "LEFT", -4, 0)
|
||||
yOffset.text:SetText("Y:")
|
||||
yOffset:SetPoint("BOTTOMLEFT", nudgeFrame, "CENTER", 16, 8)
|
||||
E:Point(yOffset, "BOTTOMLEFT", nudgeFrame, "CENTER", 16, 8)
|
||||
nudgeFrame.yOffset = yOffset
|
||||
S:HandleEditBox(yOffset)
|
||||
|
||||
local resetButton = CreateFrame("Button", nudgeFrame:GetName().."ResetButton", nudgeFrame, "UIPanelButtonTemplate")
|
||||
resetButton:SetText(RESET)
|
||||
resetButton:SetPoint("TOP", nudgeFrame, "CENTER", 0, 2)
|
||||
resetButton:SetWidth(100)
|
||||
resetButton:SetHeight(25)
|
||||
E:Point(resetButton, "TOP", nudgeFrame, "CENTER", 0, 2)
|
||||
E:Size(resetButton, 100, 25)
|
||||
resetButton:SetScript("OnClick", function()
|
||||
if(ElvUIMoverNudgeWindow.child.textString) then
|
||||
E:ResetMovers(ElvUIMoverNudgeWindow.child.textString)
|
||||
@@ -428,16 +422,14 @@ function E:CreateMoverPopup()
|
||||
S:HandleButton(resetButton)
|
||||
-- Up Button
|
||||
local upButton = CreateFrame("Button", nudgeFrame:GetName().."PrevButton", nudgeFrame)
|
||||
upButton:SetWidth(26)
|
||||
upButton:SetHeight(26)
|
||||
upButton:SetPoint("BOTTOMRIGHT", nudgeFrame, "BOTTOM", -6, 4)
|
||||
E:Size(upButton, 26)
|
||||
E:Point(upButton, "BOTTOMRIGHT", nudgeFrame, "BOTTOM", -6, 4)
|
||||
upButton:SetScript("OnClick", function()
|
||||
E:NudgeMover(nil, 1)
|
||||
end)
|
||||
upButton.icon = upButton:CreateTexture(nil, "ARTWORK")
|
||||
upButton.icon:SetWidth(13)
|
||||
upButton.icon:SetHeight(13)
|
||||
upButton.icon:SetPoint("CENTER", 0, 0)
|
||||
E:Size(upButton.icon, 13)
|
||||
E:Point(upButton.icon, "CENTER", 0, 0)
|
||||
upButton.icon:SetTexture([[Interface\AddOns\ElvUI\Media\Textures\SquareButtonTextures.blp]])
|
||||
upButton.icon:SetTexCoord(0.01562500, 0.20312500, 0.01562500, 0.20312500)
|
||||
|
||||
@@ -445,16 +437,14 @@ function E:CreateMoverPopup()
|
||||
S:HandleButton(upButton)
|
||||
-- Down Button
|
||||
local downButton = CreateFrame("Button", nudgeFrame:GetName().."DownButton", nudgeFrame)
|
||||
downButton:SetWidth(26)
|
||||
downButton:SetHeight(26)
|
||||
downButton:SetPoint("BOTTOMLEFT", nudgeFrame, "BOTTOM", 6, 4)
|
||||
E:Size(downButton, 26)
|
||||
E:Point(downButton, "BOTTOMLEFT", nudgeFrame, "BOTTOM", 6, 4)
|
||||
downButton:SetScript("OnClick", function()
|
||||
E:NudgeMover(nil, -1)
|
||||
end)
|
||||
downButton.icon = downButton:CreateTexture(nil, "ARTWORK")
|
||||
downButton.icon:SetWidth(13)
|
||||
downButton.icon:SetHeight(13)
|
||||
downButton.icon:SetPoint("CENTER", 0, 0)
|
||||
E:Size(downButton.icon, 13)
|
||||
E:Point(downButton.icon, "CENTER", 0, 0)
|
||||
downButton.icon:SetTexture([[Interface\AddOns\ElvUI\Media\Textures\SquareButtonTextures.blp]])
|
||||
downButton.icon:SetTexCoord(0.01562500, 0.20312500, 0.01562500, 0.20312500)
|
||||
|
||||
@@ -462,16 +452,14 @@ function E:CreateMoverPopup()
|
||||
S:HandleButton(downButton)
|
||||
-- Left Button
|
||||
local leftButton = CreateFrame("Button", nudgeFrame:GetName().."LeftButton", nudgeFrame)
|
||||
leftButton:SetWidth(26)
|
||||
leftButton:SetHeight(26)
|
||||
leftButton:SetPoint("RIGHT", upButton, "LEFT", -6, 0)
|
||||
E:Size(leftButton, 26)
|
||||
E:Point(leftButton, "RIGHT", upButton, "LEFT", -6, 0)
|
||||
leftButton:SetScript("OnClick", function()
|
||||
E:NudgeMover(-1)
|
||||
end)
|
||||
leftButton.icon = leftButton:CreateTexture(nil, "ARTWORK")
|
||||
leftButton.icon:SetWidth(13)
|
||||
leftButton.icon:SetHeight(13)
|
||||
leftButton.icon:SetPoint("CENTER", 0, 0)
|
||||
E:Size(leftButton.icon, 13)
|
||||
E:Point(leftButton.icon, "CENTER", 0, 0)
|
||||
leftButton.icon:SetTexture([[Interface\AddOns\ElvUI\Media\Textures\SquareButtonTextures.blp]])
|
||||
leftButton.icon:SetTexCoord(0.01562500, 0.20312500, 0.01562500, 0.20312500)
|
||||
|
||||
@@ -479,16 +467,14 @@ function E:CreateMoverPopup()
|
||||
S:HandleButton(leftButton)
|
||||
-- Right Button
|
||||
local rightButton = CreateFrame("Button", nudgeFrame:GetName().."RightButton", nudgeFrame)
|
||||
rightButton:SetWidth(26)
|
||||
rightButton:SetHeight(26)
|
||||
rightButton:SetPoint("LEFT", downButton, "RIGHT", 6, 0)
|
||||
E:Size(rightButton, 26)
|
||||
E:Point(rightButton, "LEFT", downButton, "RIGHT", 6, 0)
|
||||
rightButton:SetScript("OnClick", function()
|
||||
E:NudgeMover(1)
|
||||
end)
|
||||
rightButton.icon = rightButton:CreateTexture(nil, "ARTWORK")
|
||||
rightButton.icon:SetWidth(13)
|
||||
rightButton.icon:SetHeight(13)
|
||||
rightButton.icon:SetPoint("CENTER", 0, 0)
|
||||
E:Size(rightButton.icon, 13)
|
||||
E:Point(rightButton.icon, "CENTER", 0, 0)
|
||||
rightButton.icon:SetTexture([[Interface\AddOns\ElvUI\Media\Textures\SquareButtonTextures.blp]])
|
||||
rightButton.icon:SetTexCoord(0.01562500, 0.20312500, 0.01562500, 0.20312500)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user