Commit d286f5cc authored by Simpy's avatar Simpy 🐹

fix fade bleeding on overlay portrait and add a "full overlay" option

parent 67daaac8
......@@ -179,12 +179,6 @@ function UF:Configure_HealthBar(frame)
end
end
if not frame.USE_PORTRAIT_OVERLAY then
health.bg:SetParent(health)
else
health.bg:SetParent(frame.Portrait.overlay)
end
if db.health then
if db.health.reverseFill then
health:SetReverseFill(true)
......
......@@ -23,7 +23,6 @@ function UF:Construct_Portrait(frame, type)
portrait.PostUpdate = self.PortraitUpdate
portrait.overlay = CreateFrame("Frame", nil, frame)
portrait.overlay:SetFrameLevel(frame.Health:GetFrameLevel() + 5) --Set to "frame.Health:GetFrameLevel()" if you don't want portrait cut off.
return portrait
end
......@@ -44,30 +43,48 @@ function UF:Configure_Portrait(frame, dontHide)
frame:EnableElement('Portrait')
end
local healthFrameLevel = frame.Health:GetFrameLevel()
portrait.overlay:SetFrameLevel(healthFrameLevel + (db.portrait.fullOverlay and 1 or 5))
portrait:SetFrameLevel(healthFrameLevel)
portrait:ClearAllPoints()
portrait.backdrop:ClearAllPoints()
if frame.USE_PORTRAIT_OVERLAY then
if db.portrait.style == '3D' then
portrait:SetFrameLevel(frame.Health:GetFrameLevel())
else
if db.portrait.style == '2D' then
portrait:SetParent(frame.Health)
end
portrait:SetAllPoints(frame.Health)
portrait:SetAlpha(0.35)
if not dontHide then
portrait:Show()
end
portrait.backdrop:Hide()
portrait:ClearAllPoints()
if db.portrait.fullOverlay then
portrait:SetAllPoints(frame.Health)
else
local healthTex = frame.Health:GetStatusBarTexture()
if db.health.reverseFill then
portrait:Point("TOPLEFT", healthTex, "TOPLEFT")
portrait:Point("BOTTOMLEFT", healthTex, "BOTTOMLEFT")
portrait:Point("BOTTOMRIGHT", frame.Health, "BOTTOMRIGHT")
else
portrait:Point("TOPLEFT", frame.Health, "TOPLEFT")
portrait:Point("BOTTOMRIGHT", healthTex, "BOTTOMRIGHT")
portrait:Point("BOTTOMLEFT", healthTex, "BOTTOMLEFT")
end
end
else
portrait:ClearAllPoints()
portrait:SetAllPoints()
portrait:SetAlpha(1)
if not dontHide then
portrait:Show()
end
portrait.backdrop:Show()
if db.portrait.style == '3D' then
portrait:SetFrameLevel(frame.Health:GetFrameLevel() -4) --Make sure portrait is behind Health and Power
else
if db.portrait.style == '2D' then
portrait:SetParent(frame)
end
......
......@@ -2088,6 +2088,7 @@ P.unitframe = {
enable = false,
width = 45,
overlay = false,
fullOverlay = false,
camDistanceScale = 2,
rotation = 0,
style = '3D',
......
......@@ -1545,50 +1545,57 @@ local function GetOptionsTable_Portrait(updateFunc, groupName, numUnits)
confirmText = L["If you have a lot of 3D Portraits active then it will likely have a big impact on your FPS. Disable some portraits if you experience FPS issues."],
confirm = true,
},
width = {
type = 'range',
order = 3,
name = L["Width"],
min = 15, max = 150, step = 1,
},
overlay = {
order = 3,
type = 'toggle',
name = L["Overlay"],
desc = L["The Portrait will overlay the Healthbar. This will be automatically happen if the Frame Orientation is set to Middle."],
},
fullOverlay = {
order = 4,
type = 'toggle',
name = L["Full Overlay"],
desc = L["This option allows the overlay to span the whole health, including the background."],
disabled = function() return not E.db.unitframe.units[groupName].portrait.overlay end,
},
style = {
order = 5,
type = 'select',
name = L["Style"],
desc = L["Select the display method of the portrait."],
values = {
['2D'] = L["2D"],
['3D'] = L["3D"],
},
},
width = {
order = 6,
type = 'range',
name = L["Width"],
min = 15, max = 150, step = 1,
},
rotation = {
order = 7,
type = 'range',
name = L["Model Rotation"],
order = 4,
min = 0, max = 360, step = 1,
},
camDistanceScale = {
order = 8,
type = 'range',
name = L["Camera Distance Scale"],
desc = L["How far away the portrait is from the camera."],
order = 5,
min = 0.01, max = 4, step = 0.01,
},
style = {
type = 'select',
name = L["Style"],
desc = L["Select the display method of the portrait."],
order = 6,
values = {
['2D'] = L["2D"],
['3D'] = L["3D"],
},
},
xOffset = {
order = 7,
order = 9,
type = "range",
name = L["xOffset"],
desc = L["Position the Model horizontally."],
min = -1, max = 1, step = 0.01,
},
yOffset = {
order = 8,
order = 10,
type = "range",
name = L["yOffset"],
desc = L["Position the Model vertically."],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment