I'm trying to create a pixel perfect border that is 1px. My method was working perfectly in Legion, but seems broken now in Shadowlands.
Here you can see an example of what works and what doesn't. The buffs and Unitframes are a custom oUF Layout.
And in the screenshot you can see they have 2px of Border on the bottom.
The Panel in the middle (behind the actionbars) uses the same function to create borders and is doing just fine with borders, no 2px thickness anywhere.
Lua Code:
function F.createBorder(self, anchor, extend)
spacing = 0
if extend then
spacing = 1
end
if not anchor then
anchor = parent
end
if self:GetObjectType() == "StatusBar" then
self = CreateFrame("Frame", nil, self)
self:SetPoint("TOPLEFT", anchor, "TOPLEFT", 0, 0)
self:SetPoint("BOTTOMRIGHT", anchor, "BOTTOMRIGHT", 0, 0)
end
if not self.borders then
self.borders = {}
for i=1, 4 do
self.borders[i] = self:CreateLine(nil, "LOW", nil, 0)
local l = self.borders[i]
l:SetThickness(1)
l:SetColorTexture(unpack(G.colors.border))
if i==1 then
l:SetStartPoint("TOPLEFT", -spacing, spacing)
l:SetEndPoint("TOPRIGHT", spacing, spacing)
elseif i==2 then
l:SetStartPoint("TOPRIGHT", spacing, spacing)
l:SetEndPoint("BOTTOMRIGHT", spacing, -spacing)
elseif i==3 then
l:SetStartPoint("BOTTOMRIGHT", spacing, -spacing)
l:SetEndPoint("BOTTOMLEFT", -spacing, -spacing)
else
l:SetStartPoint("BOTTOMLEFT", -spacing, -spacing)
l:SetEndPoint("TOPLEFT", -spacing, spacing)
end
end
end
return self
end
This is the function to create borders for my frames. When hardcoding spacing to like 5 or so to play around with the position, I noticed the border of 2px sometimes being on top. Other UI Elements like my Tooltip have it on 2 sides.
(Although I don't use the same border function for that on the tooltip)
Here is the code for the tooltip (and rest of my code) if it helps giving any context.
https://github.com/gempir/gempUI/blo...es/tooltip.lua
I have read several older threads about this on here, but can't find one that helps me with my problem.
I have played around with UI scaling with stuff like this
Lua Code:
SetCVar('useuiscale', 1)
SetCVar('uiscale', 1)
local _, height = GetPhysicalScreenSize()
UIParent:SetScale(768 / height)
This seems to work but generally just makes everything too big on my 1440p screen. Preffered Solution would be with the UI Scaling option off, that looks best to me.
Setting the UI scale to the minimum possible via the UI seems to make it a bit better, but there are still some vertical borders that are too big.