From e3c1aba97451c4820267a42f1660941a146cb592 Mon Sep 17 00:00:00 2001 From: Crum Date: Wed, 7 Nov 2018 11:17:30 -0600 Subject: [PATCH] update pixelperfect --- ElvUI/Core/core.lua | 1 - ElvUI/Core/pixelperfect.lua | 40 ++++++++++++++++++++----------------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/ElvUI/Core/core.lua b/ElvUI/Core/core.lua index 91a5dc5..8e558ca 100644 --- a/ElvUI/Core/core.lua +++ b/ElvUI/Core/core.lua @@ -26,7 +26,6 @@ local RAID_CLASS_COLORS = RAID_CLASS_COLORS E.LSM = LSM E.noop = function() end E.title = format("|cff175581E|r|cffC4C4C4lvUI|r") -E.myfaction, E.myLocalizedFaction = UnitFactionGroup("player") E.myLocalizedClass, E.myclass = UnitClass("player") E.myLocalizedRace, E.myrace = UnitRace("player") E.myname = UnitName("player") diff --git a/ElvUI/Core/pixelperfect.lua b/ElvUI/Core/pixelperfect.lua index 4bdc10a..2d51d2b 100644 --- a/ElvUI/Core/pixelperfect.lua +++ b/ElvUI/Core/pixelperfect.lua @@ -7,8 +7,12 @@ local match = string.match --WoW API / Variables 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) local width = E.screenwidth local height = E.screenheight @@ -26,24 +30,24 @@ function E:UIScale(event) end if width < 1600 then - E.lowversion = true + E.lowversion = true elseif width >= 3840 and E.global.general.eyefinity then -- because some user enable bezel compensation, we need to find the real width of a single monitor. -- I don't know how it really work, but i'm assuming they add pixel to width to compensate the bezel. :P -- HQ resolution - if width >= 9840 then width = 3280 end -- WQSXGA - if width >= 7680 and width < 9840 then width = 2560 end -- WQXGA - if width >= 5760 and width < 7680 then width = 1920 end -- WUXGA & HDTV - if width >= 5040 and width < 5760 then width = 1680 end -- WSXGA+ + if width >= 9840 then width = 3280 end -- WQSXGA + if width >= 7680 and width < 9840 then width = 2560 end -- WQXGA + if width >= 5760 and width < 7680 then width = 1920 end -- WUXGA & HDTV + if width >= 5040 and width < 5760 then width = 1680 end -- WSXGA+ -- adding height condition here to be sure it work with bezel compensation because WSXGA+ and UXGA/HD+ got approx same width if width >= 4800 and width < 5760 and height == 900 then width = 1600 end -- UXGA & HD+ -- low resolution screen - if width >= 4320 and width < 4800 then width = 1440 end -- WSXGA - if width >= 4080 and width < 4320 then width = 1360 end -- WXGA - if width >= 3840 and width < 4080 then width = 1224 end -- SXGA & SXGA (UVGA) & WXGA & HDTV + if width >= 4320 and width < 4800 then width = 1440 end -- WSXGA + if width >= 4080 and width < 4320 then width = 1360 end -- WXGA + if width >= 3840 and width < 4080 then width = 1224 end -- SXGA & SXGA (UVGA) & WXGA & HDTV -- yep, now set ElvUI to lower resolution if screen #1 width < 1600 if width < 1600 then @@ -55,8 +59,8 @@ function E:UIScale(event) end E.mult = 768/height/scale - E.Spacing = E.PixelMode and 0 or E.mult - E.Border = (E.PixelMode and E.mult or E.mult*2) + E.Spacing = (E.PixelMode and 0) or E.mult + E.Border = (E.PixelMode and E.mult) or E.mult*2 if E.global.general.autoScale then --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 not E.global.general.autoScale or height > 1200 then local h = UIParent:GetHeight() - local ratio = height / h - local w = width / ratio + local ratio = (height / h) + local w = (width / ratio) width = w height = h @@ -88,15 +92,15 @@ function E:UIScale(event) Dragging moveable frames outside the box and reloading the UI ensures that they are saving position correctly. ]] else - width = UIParent:GetWidth() - height = UIParent:GetHeight() + width, height = UIParent:GetWidth(), UIParent:GetHeight() end E.UIParent:SetWidth(width) E.UIParent:SetHeight(height) E.UIParent:ClearAllPoints() E.UIParent:SetAllPoints(UIParent) - + + --Calculate potential coordinate differences E.diffGetLeft = E:Round(abs(UIParent:GetLeft() - E.UIParent:GetLeft())) E.diffGetRight = E:Round(abs(UIParent:GetRight() - E.UIParent:GetRight())) E.diffGetTop = E:Round(abs(UIParent:GetTop() - E.UIParent:GetTop())) @@ -121,5 +125,5 @@ end -- pixel perfect script of custom ui scale. function E:Scale(x) - return E.mult*floor(x/E.mult+.5) -end \ No newline at end of file + return E.mult * floor(x/E.mult+.5) +end