update pixelperfect

This commit is contained in:
Crum
2018-11-07 11:17:30 -06:00
parent 468150c93a
commit e3c1aba974
2 changed files with 22 additions and 19 deletions
-1
View File
@@ -26,7 +26,6 @@ local RAID_CLASS_COLORS = RAID_CLASS_COLORS
E.LSM = LSM E.LSM = LSM
E.noop = function() end E.noop = function() end
E.title = format("|cff175581E|r|cffC4C4C4lvUI|r") E.title = format("|cff175581E|r|cffC4C4C4lvUI|r")
E.myfaction, E.myLocalizedFaction = UnitFactionGroup("player")
E.myLocalizedClass, E.myclass = UnitClass("player") E.myLocalizedClass, E.myclass = UnitClass("player")
E.myLocalizedRace, E.myrace = UnitRace("player") E.myLocalizedRace, E.myrace = UnitRace("player")
E.myname = UnitName("player") E.myname = UnitName("player")
+12 -8
View File
@@ -7,8 +7,12 @@ local match = string.match
--WoW API / Variables --WoW API / Variables
local GetCVar, SetCVar = GetCVar, SetCVar local GetCVar, SetCVar = GetCVar, SetCVar
local scale --Global variables that we don"t cache, list them here for the mikk"s Find Globals script
-- GLOBALS: UIParent, WorldMapFrame
--Determine if Eyefinity is being used, setup the pixel perfect script.
local scale
function E:UIScale(event) function E:UIScale(event)
local width = E.screenwidth local width = E.screenwidth
local height = E.screenheight local height = E.screenheight
@@ -55,8 +59,8 @@ function E:UIScale(event)
end end
E.mult = 768/height/scale E.mult = 768/height/scale
E.Spacing = E.PixelMode and 0 or E.mult E.Spacing = (E.PixelMode and 0) or E.mult
E.Border = (E.PixelMode and E.mult or E.mult*2) E.Border = (E.PixelMode and E.mult) or E.mult*2
if E.global.general.autoScale then if E.global.general.autoScale then
--Set UIScale, NOTE: SetCVar for UIScale can cause taints so only do this when we need to.. --Set UIScale, NOTE: SetCVar for UIScale can cause taints so only do this when we need to..
@@ -77,8 +81,8 @@ function E:UIScale(event)
-- if autoscale is off, find a new width value of E.UIParent for screen #1. -- if autoscale is off, find a new width value of E.UIParent for screen #1.
if not E.global.general.autoScale or height > 1200 then if not E.global.general.autoScale or height > 1200 then
local h = UIParent:GetHeight() local h = UIParent:GetHeight()
local ratio = height / h local ratio = (height / h)
local w = width / ratio local w = (width / ratio)
width = w width = w
height = h height = h
@@ -88,8 +92,7 @@ function E:UIScale(event)
Dragging moveable frames outside the box and reloading the UI ensures that they are saving position correctly. Dragging moveable frames outside the box and reloading the UI ensures that they are saving position correctly.
]] ]]
else else
width = UIParent:GetWidth() width, height = UIParent:GetWidth(), UIParent:GetHeight()
height = UIParent:GetHeight()
end end
E.UIParent:SetWidth(width) E.UIParent:SetWidth(width)
@@ -97,6 +100,7 @@ function E:UIScale(event)
E.UIParent:ClearAllPoints() E.UIParent:ClearAllPoints()
E.UIParent:SetAllPoints(UIParent) E.UIParent:SetAllPoints(UIParent)
--Calculate potential coordinate differences
E.diffGetLeft = E:Round(abs(UIParent:GetLeft() - E.UIParent:GetLeft())) E.diffGetLeft = E:Round(abs(UIParent:GetLeft() - E.UIParent:GetLeft()))
E.diffGetRight = E:Round(abs(UIParent:GetRight() - E.UIParent:GetRight())) E.diffGetRight = E:Round(abs(UIParent:GetRight() - E.UIParent:GetRight()))
E.diffGetTop = E:Round(abs(UIParent:GetTop() - E.UIParent:GetTop())) E.diffGetTop = E:Round(abs(UIParent:GetTop() - E.UIParent:GetTop()))
@@ -121,5 +125,5 @@ end
-- pixel perfect script of custom ui scale. -- pixel perfect script of custom ui scale.
function E:Scale(x) function E:Scale(x)
return E.mult*floor(x/E.mult+.5) return E.mult * floor(x/E.mult+.5)
end end