Skip to content

Commit

Permalink
Code for composite border widget
Browse files Browse the repository at this point in the history
  • Loading branch information
d87 committed May 6, 2022
1 parent 18cf22a commit 4a52ce9
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions frame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -161,28 +161,39 @@ local CompositeBorder_Set = function(self, left, right, top, bottom)
tleft:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", -left, 0)
tleft:SetPoint("TOPRIGHT", frame, "TOPLEFT", 0, top)
end
local CompositeBorder_SetColor = function(self, r,g,b,a)
local ttop = self[1]
ttop:SetVertexColor(r,g,b,a)

local tright = self[2]
tright:SetVertexColor(r,g,b,a)

local tbot = self[3]
tbot:SetVertexColor(r,g,b,a)

local tleft = self[4]
tleft:SetVertexColor(r,g,b,a)
end
local MakeCompositeBorder = function(frame, tex, left, right, top, bottom, drawLayer, level)
local ttop = frame:CreateTexture(nil, drawLayer, nil, level)
ttop:SetTexture(tex)
ttop:SetVertexColor(0,0,0,1)

local tright = frame:CreateTexture(nil, drawLayer, nil, level)
tright:SetTexture(tex)
tright:SetVertexColor(0,0,0,1)

local tbot = frame:CreateTexture(nil, drawLayer, nil, level)
tbot:SetTexture(tex)
tbot:SetVertexColor(0,0,0,1)

local tleft = frame:CreateTexture(nil, drawLayer, nil, level)
tleft:SetTexture(tex)
tleft:SetVertexColor(0,0,0,1)

local border = { ttop, tright, tbot, tleft, frame }
border.parent = frame
border.Set = CompositeBorder_Set
border.SetColor = CompositeBorder_SetColor

border:Set(left, right, top, bottom)
border:SetColor(0,0,0, 1)

return border
end
Expand Down Expand Up @@ -2792,6 +2803,7 @@ local Border_SetJob = function(self, job, state, contentType, ...)
local timerType, cur, max, count, icon, text, r,g,b, texture, texCoords = NormalizeContent(job, state, contentType, ...)

self:SetBackdropBorderColor(r,g,b, 0.5)
-- self.outline:SetColor(r,g,b, 0.5)

if self.currentJob ~= self.previousJob then
if job.pulse then
Expand All @@ -2802,6 +2814,7 @@ end
local Border_StartTrace = MakeStartTraceForBlinkAnimation(function(self, job)
local r,g,b,a = GetColor(job)
self:SetBackdropBorderColor(r,g,b, 0.5)
-- self.outline:SetColor(r,g,b, 0.5)
end)


Expand Down Expand Up @@ -3251,13 +3264,24 @@ AptechkaDefaultConfig.GridSkin = function(self)
local alphaWidget = CreateAlphaWidget(self)
self.frameAlpha = alphaWidget

-- old backdrop border
local p4 = outlineSize + pixelperfect(2)
local border = CreateFrame("Frame", nil, self, BackdropTemplateMixin and "BackdropTemplate" or nil)
border:SetFrameLevel(FRAMELEVEL.BORDER)
border:SetPoint("TOPLEFT", self, "TOPLEFT", -p4, p4)
border:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", p4, -p4)
border:SetBackdrop(border_backdrop)
border:SetBackdropBorderColor(1, 1, 1, 0.5)

-- new composite border
-- local border = CreateFrame("Frame", nil, self)
-- local borderInset = 0
-- border:SetFrameLevel(FRAMELEVEL.BORDER)
-- border:SetPoint("TOPLEFT", self, "TOPLEFT", -outlineSize+borderInset, outlineSize-borderInset)
-- border:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", outlineSize-borderInset, -outlineSize+borderInset)
-- local borderWidth = pixelperfect(2) + pixelperfect(2)*0.1
-- border.outline = MakeCompositeBorder(border, "Interface\\BUTTONS\\WHITE8X8", borderWidth, borderWidth, borderWidth, borderWidth, "ARTWORK", 0)

AddPulseAnimation(border)
border.SetJob = Border_SetJob

Expand Down

0 comments on commit 4a52ce9

Please sign in to comment.