beta
This commit is contained in:
@@ -10,6 +10,7 @@ local IsShiftKeyDown, CreateFrame = IsShiftKeyDown, CreateFrame
|
||||
local AceConfigDialog = LibStub("AceConfigDialog-3.0")
|
||||
|
||||
local WeakAuras = WeakAuras
|
||||
local L = WeakAuras.L
|
||||
|
||||
local moversizer
|
||||
local mover
|
||||
@@ -63,9 +64,11 @@ local function ConstructMover(frame)
|
||||
local top = CreateFrame("BUTTON", nil, topAndBottom)
|
||||
top:SetSize(25, 25)
|
||||
top:SetPoint("TOP", topAndBottom)
|
||||
top:SetFrameStrata("BACKGROUND")
|
||||
local bottom = CreateFrame("BUTTON", nil, topAndBottom)
|
||||
bottom:SetSize(25, 25)
|
||||
bottom:SetPoint("BOTTOM", topAndBottom)
|
||||
bottom:SetFrameStrata("BACKGROUND")
|
||||
|
||||
local leftAndRight = CreateFrame("Frame", nil, frame)
|
||||
leftAndRight:SetClampedToScreen(true)
|
||||
@@ -74,9 +77,11 @@ local function ConstructMover(frame)
|
||||
local left = CreateFrame("BUTTON", nil, leftAndRight)
|
||||
left:SetSize(25, 25)
|
||||
left:SetPoint("LEFT", leftAndRight)
|
||||
left:SetFrameStrata("BACKGROUND")
|
||||
local right = CreateFrame("BUTTON", nil, leftAndRight)
|
||||
right:SetSize(25, 25)
|
||||
right:SetPoint("RIGHT", leftAndRight)
|
||||
right:SetFrameStrata("BACKGROUND")
|
||||
|
||||
top:SetNormalTexture("interface\\buttons\\ui-scrollbar-scrollupbutton-up.blp")
|
||||
top:SetHighlightTexture("interface\\buttons\\ui-scrollbar-scrollupbutton-highlight.blp")
|
||||
@@ -107,6 +112,23 @@ local function ConstructMover(frame)
|
||||
right:GetPushedTexture():SetRotation(-math.pi/2)
|
||||
right:SetScript("OnClick", function() moveOnePxl("right") end)
|
||||
|
||||
local arrow = CreateFrame("frame", nil, frame)
|
||||
arrow:SetClampedToScreen(true)
|
||||
arrow:SetSize(196, 196)
|
||||
arrow:SetPoint("CENTER", frame, "CENTER")
|
||||
arrow:SetFrameStrata("HIGH")
|
||||
local arrowTexture = arrow:CreateTexture()
|
||||
arrowTexture:SetTexture("Interface\\Addons\\WeakAuras\\Media\\Textures\\offscreen.tga")
|
||||
arrowTexture:SetSize(128, 128)
|
||||
arrowTexture:SetPoint("CENTER", arrow, "CENTER")
|
||||
arrowTexture:SetVertexColor(0.8, 0.8, 0.2)
|
||||
arrowTexture:Hide()
|
||||
local offscreenText = arrow:CreateFontString(nil, "OVERLAY")
|
||||
offscreenText:SetFont(STANDARD_TEXT_FONT, 14, "THICKOUTLINE");
|
||||
offscreenText:SetText(L["Aura is\nOff Screen"])
|
||||
offscreenText:Hide()
|
||||
offscreenText:SetPoint("CENTER", arrow, "CENTER")
|
||||
|
||||
--local lineX = frame:CreateLine(nil, "OVERLAY", 7)
|
||||
local lineX = frame:CreateTexture(nil, "OVERLAY", 7)
|
||||
lineX:SetSize(2, 2)
|
||||
@@ -123,7 +145,7 @@ local function ConstructMover(frame)
|
||||
lineY:SetPoint("BOTTOMLEFT", UIParent)
|
||||
lineY:Hide()
|
||||
|
||||
return lineX, lineY
|
||||
return lineX, lineY, arrowTexture, offscreenText
|
||||
end
|
||||
|
||||
local function ConstructSizer(frame)
|
||||
@@ -150,6 +172,9 @@ local function ConstructSizer(frame)
|
||||
texTR2:SetPoint("BOTTOMLEFT", topright, "LEFT")
|
||||
|
||||
topright.Highlight = function()
|
||||
if WeakAurasOptionsSaved.lockPositions then
|
||||
return
|
||||
end
|
||||
texTR1:Show()
|
||||
texTR2:Show()
|
||||
end
|
||||
@@ -179,6 +204,9 @@ local function ConstructSizer(frame)
|
||||
texBR2:SetPoint("TOPLEFT", bottomright, "LEFT")
|
||||
|
||||
bottomright.Highlight = function()
|
||||
if WeakAurasOptionsSaved.lockPositions then
|
||||
return
|
||||
end
|
||||
texBR1:Show()
|
||||
texBR2:Show()
|
||||
end
|
||||
@@ -208,6 +236,9 @@ local function ConstructSizer(frame)
|
||||
texBL2:SetPoint("TOPRIGHT", bottomleft, "RIGHT")
|
||||
|
||||
bottomleft.Highlight = function()
|
||||
if WeakAurasOptionsSaved.lockPositions then
|
||||
return
|
||||
end
|
||||
texBL1:Show()
|
||||
texBL2:Show()
|
||||
end
|
||||
@@ -237,6 +268,9 @@ local function ConstructSizer(frame)
|
||||
texTL2:SetPoint("BOTTOMRIGHT", topleft, "RIGHT")
|
||||
|
||||
topleft.Highlight = function()
|
||||
if WeakAurasOptionsSaved.lockPositions then
|
||||
return
|
||||
end
|
||||
texTL1:Show()
|
||||
texTL2:Show()
|
||||
end
|
||||
@@ -260,6 +294,9 @@ local function ConstructSizer(frame)
|
||||
texT:SetPoint("BOTTOMLEFT", topleft, "LEFT", 3, 0)
|
||||
|
||||
top.Highlight = function()
|
||||
if WeakAurasOptionsSaved.lockPositions then
|
||||
return
|
||||
end
|
||||
texT:Show()
|
||||
end
|
||||
top.Clear = function()
|
||||
@@ -279,6 +316,9 @@ local function ConstructSizer(frame)
|
||||
texR:SetPoint("TOPLEFT", topright, "TOP", 0, -3)
|
||||
|
||||
right.Highlight = function()
|
||||
if WeakAurasOptionsSaved.lockPositions then
|
||||
return
|
||||
end
|
||||
texR:Show()
|
||||
end
|
||||
right.Clear = function()
|
||||
@@ -299,6 +339,9 @@ local function ConstructSizer(frame)
|
||||
texB:SetPoint("TOPRIGHT", bottomright, "RIGHT", -3, 0)
|
||||
|
||||
bottom.Highlight = function()
|
||||
if WeakAurasOptionsSaved.lockPositions then
|
||||
return
|
||||
end
|
||||
texB:Show()
|
||||
end
|
||||
bottom.Clear = function()
|
||||
@@ -319,6 +362,9 @@ local function ConstructSizer(frame)
|
||||
texL:SetPoint("TOPRIGHT", topleft, "TOP", 0, -3)
|
||||
|
||||
left.Highlight = function()
|
||||
if WeakAurasOptionsSaved.lockPositions then
|
||||
return
|
||||
end
|
||||
texL:Show()
|
||||
end
|
||||
left.Clear = function()
|
||||
@@ -389,7 +435,7 @@ local function ConstructMoverSizer(parent)
|
||||
frame.top, frame.topright, frame.right, frame.bottomright, frame.bottom, frame.bottomleft, frame.left, frame.topleft
|
||||
= ConstructSizer(frame)
|
||||
|
||||
frame.lineX, frame.lineY = ConstructMover(frame)
|
||||
frame.lineX, frame.lineY, frame.arrowTexture, frame.offscreenText = ConstructMover(frame)
|
||||
|
||||
frame.top.Clear()
|
||||
frame.topright.Clear()
|
||||
@@ -481,7 +527,7 @@ local function ConstructMoverSizer(parent)
|
||||
if data.regionType == "group" then
|
||||
mover:SetWidth((region.trx - region.blx) * scale)
|
||||
mover:SetHeight((region.try - region.bly) * scale)
|
||||
mover:SetPoint(mover.selfPoint or "CENTER", mover.anchor or UIParent, mover.anchorPoint or "CENTER", (xOff + region.blx) * scale, (yOff + region.bly) * scale)
|
||||
mover:SetPoint("BOTTOMLEFT", mover.anchor or UIParent, mover.anchorPoint or "CENTER", (xOff + region.blx) * scale, (yOff + region.bly) * scale)
|
||||
else
|
||||
mover:SetWidth(region:GetWidth() * scale)
|
||||
mover:SetHeight(region:GetHeight() * scale)
|
||||
@@ -499,10 +545,13 @@ local function ConstructMoverSizer(parent)
|
||||
|
||||
local db = OptionsPrivate.savedVars.db
|
||||
mover.startMoving = function()
|
||||
if WeakAurasOptionsSaved.lockPositions then
|
||||
return
|
||||
end
|
||||
OptionsPrivate.Private.CancelAnimation(region, true, true, true, true, true)
|
||||
mover:ClearAllPoints()
|
||||
if data.regionType == "group" then
|
||||
mover:SetPoint(mover.selfPoint, region, mover.anchorPoint, region.blx * scale, region.bly * scale)
|
||||
mover:SetPoint("BOTTOMLEFT", region, mover.anchorPoint, region.blx * scale, region.bly * scale)
|
||||
else
|
||||
mover:SetPoint(mover.selfPoint, region, mover.selfPoint)
|
||||
end
|
||||
@@ -602,7 +651,7 @@ local function ConstructMoverSizer(parent)
|
||||
if data.regionType == "group" then
|
||||
mover:SetWidth((region.trx - region.blx) * scale)
|
||||
mover:SetHeight((region.try - region.bly) * scale)
|
||||
mover:SetPoint(mover.selfPoint, mover.anchor, mover.anchorPoint, (xOff + region.blx) * scale, (yOff + region.bly) * scale)
|
||||
mover:SetPoint("BOTTOMLEFT", mover.anchor, mover.anchorPoint, (xOff + region.blx) * scale, (yOff + region.bly) * scale)
|
||||
else
|
||||
mover:SetWidth(region:GetWidth() * scale)
|
||||
mover:SetHeight(region:GetHeight() * scale)
|
||||
@@ -636,6 +685,9 @@ local function ConstructMoverSizer(parent)
|
||||
|
||||
if region:IsResizable() then
|
||||
frame.startSizing = function(point)
|
||||
if WeakAurasOptionsSaved.lockPositions then
|
||||
return
|
||||
end
|
||||
mover.isMoving = true
|
||||
OptionsPrivate.Private.CancelAnimation(region, true, true, true, true, true)
|
||||
local rSelfPoint, rAnchor, rAnchorPoint, rXOffset, rYOffset = region:GetPoint(1)
|
||||
@@ -726,7 +778,7 @@ local function ConstructMoverSizer(parent)
|
||||
if data.regionType == "group" then
|
||||
mover:SetWidth((region.trx - region.blx) * scale)
|
||||
mover:SetHeight((region.try - region.bly) * scale)
|
||||
mover:SetPoint(mover.selfPoint, mover.anchor, mover.anchorPoint, (xOff + region.blx) * scale, (yOff + region.bly) * scale)
|
||||
mover:SetPoint("BOTTOMLEFT", mover.anchor, mover.anchorPoint, (xOff + region.blx) * scale, (yOff + region.bly) * scale)
|
||||
else
|
||||
mover:SetWidth(region:GetWidth() * scale)
|
||||
mover:SetHeight(region:GetHeight() * scale)
|
||||
@@ -878,6 +930,23 @@ local function ConstructMoverSizer(parent)
|
||||
self.interims[i]:SetPoint("CENTER", self.anchorPointIcon, "CENTER", x, y)
|
||||
self.interims[i]:Show()
|
||||
end
|
||||
|
||||
-- HERE
|
||||
frame.arrowTexture:Hide()
|
||||
frame.offscreenText:Hide()
|
||||
|
||||
-- Check if the center is offscreen
|
||||
local x, y = mover:GetCenter()
|
||||
if x and y then
|
||||
if x < 0 or x > GetScreenWidth() or y < 0 or y > GetScreenHeight() then
|
||||
local arrowX, arrowY = frame.arrowTexture:GetCenter()
|
||||
local arrowAngle = atan2(selfY - arrowY, selfX - arrowX)
|
||||
frame.offscreenText:Show()
|
||||
frame.arrowTexture:Show()
|
||||
frame.arrowTexture:SetRotation( (arrowAngle - 90) / 180 * math.pi)
|
||||
end
|
||||
end
|
||||
|
||||
local regionScale = self.moving.region:GetScale()
|
||||
self.text:SetText(("(%.2f, %.2f)"):format(dX*1/regionScale, dY*1/regionScale))
|
||||
local midX = (distance / 2) * cos(angle)
|
||||
|
||||
Reference in New Issue
Block a user