Skip to content

Commit

Permalink
now it works :D
Browse files Browse the repository at this point in the history
  • Loading branch information
mBlinkii committed Sep 28, 2023
1 parent 80b957b commit eb83225
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions Addon/ElvUI_mMediaTag/modules/unitframes/portrait.lua
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ local textures = {
QA = false,
},
offset = {
SQ = 16,
RO = 16,
CI = 16,
SQ = 5.5,
RO = 5.5,
CI = 5.5,
PI = 0,
RA = 20,
QA = 8,
RA = 6,
QA = 20,
}
}

Expand Down Expand Up @@ -195,6 +195,14 @@ local function CreatePortraitTexture(frame, name, layer, texture, color, mirror)
return tmpTexture
end

local function GetOffset(size, offset)
if offset == 0 then
return 0
else
return ((size / offset) * E.perfect)
end
end

local function CreatePortrait(parent, conf, unit)
local texture = nil

Expand All @@ -209,7 +217,7 @@ local function CreatePortrait(parent, conf, unit)
frame.texture = CreatePortraitTexture(frame, "mMT_Texture", 4, texture, getColor(frame, unit), conf.mirror)

-- Unit Portrait
local offset = textures.offset[conf.texture] * E.perfect --~= 0 and ((conf.size / textures.offset[conf.texture]) * E.perfect) or 0
local offset = GetOffset(conf.size, textures.offset[conf.texture])
frame.portrait = frame:CreateTexture("mMT_Portrait", "OVERLAY", nil, 1)
frame.portrait:SetAllPoints(frame)
frame.portrait:SetPoint("TOPLEFT", 0 + offset, 0 - offset)
Expand Down Expand Up @@ -327,7 +335,7 @@ local function UpdatePortrait(frame, conf, unit, parent)
UpdatePortraitTexture(frame.texture, texture, getColor(frame, unit), conf.mirror)

-- Unit Portrait
local offset = textures.offset[conf.texture] * E.perfect -- ~= 0 and ((conf.size / textures.offset[conf.texture]) * E.perfect) or 0
local offset = GetOffset(conf.size, textures.offset[conf.texture])
frame.portrait:SetPoint("TOPLEFT", 0 + offset, 0 - offset)
frame.portrait:SetPoint("BOTTOMRIGHT", 0 - offset, 0 + offset)
mirrorTexture(frame.portrait, conf.mirror)
Expand Down

0 comments on commit eb83225

Please sign in to comment.