test uiscale

This commit is contained in:
Bunny67
2018-07-19 18:49:05 +03:00
parent 475509c711
commit fb97c8b35b
2 changed files with 26 additions and 16 deletions
+1 -1
View File
@@ -1124,7 +1124,7 @@ function E:Initialize()
self:UpdateFrameTemplates() self:UpdateFrameTemplates()
--self:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED", "CheckRole") --self:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED", "CheckRole")
-- self:RegisterEvent("CHARACTER_POINTS_CHANGED", "CheckRole") -- self:RegisterEvent("CHARACTER_POINTS_CHANGED", "CheckRole")
self:RegisterEvent("UPDATE_FLOATING_CHAT_WINDOWS", "UIScale") self:RegisterEvent("CVAR_UPDATE", "UIScale")
self:RegisterEvent("PLAYER_ENTERING_WORLD") self:RegisterEvent("PLAYER_ENTERING_WORLD")
if self.db.general.kittys then if self.db.general.kittys then
+25 -15
View File
@@ -25,7 +25,7 @@ function E:UIScale(event)
if self.global.general.autoScale then if self.global.general.autoScale then
scale = max(minScale, min(1.00, 768/self.screenheight)) scale = max(minScale, min(1.00, 768/self.screenheight))
else else
scale = max(minScale, min(1.00, self.global.uiScale or UIParent:GetScale() or 768/self.screenheight)) scale = max(minScale, min(1.00, self.global.uiScale or (self.screenheight > 0 and (768/self.screenheight)) or UIParent:GetScale()))
end end
if self.screenwidth < 1600 then if self.screenwidth < 1600 then
@@ -60,21 +60,30 @@ function E:UIScale(event)
self.eyefinity = width self.eyefinity = width
end end
self.mult = 768/match(GetCVar("gxResolution"), "%d+x(%d+)")/scale self.mult = 768/self.screenheight/scale
self.Spacing = self.PixelMode and 0 or self.mult self.Spacing = self.PixelMode and 0 or self.mult
self.Border = (self.PixelMode and self.mult or self.mult*2) self.Border = (self.PixelMode and self.mult or self.mult*2)
--Set UIScale, NOTE: SetCVar for UIScale can cause taints so only do this when we need to..
if E.Round and E:Round(UIParent:GetScale(), 5) ~= E:Round(scale, 5) and (event == "PLAYER_LOGIN") then if E.global.general.autoScale then
SetCVar("UseUIScale", 1) --Set UIScale, NOTE: SetCVar for UIScale can cause taints so only do this when we need to..
SetCVar("UIScale", scale) if E.Round and event == "PLAYER_LOGIN" and (E:Round(UIParent:GetScale(), 5) ~= E:Round(scale, 5)) then
SetCVar("useUiScale", 1)
SetCVar("uiScale", scale)
end
--SetCVar for UI scale only accepts value as low as 0.64, so scale UIParent if needed
if scale < 0.64 then
UIParent:SetScale(scale)
end
end end
if (event == "PLAYER_LOGIN" or event == "UPDATE_FLOATING_CHAT_WINDOWS") then if event == "PLAYER_LOGIN" or (event == "CVAR_UPDATE" and arg1 == "USE_UISCALE") then
if IsMacClient() then if IsMacClient() then
self.global.screenheight = floor(GetScreenHeight()*100+.5)/100 self.global.screenheight = floor(GetScreenHeight()*100+.5)/100
self.global.screenwidth = floor(GetScreenWidth()*100+.5)/100 self.global.screenwidth = floor(GetScreenWidth()*100+.5)/100
end end
self.UIParent:ClearAllPoints()
--Resize self.UIParent if Eyefinity is on. --Resize self.UIParent if Eyefinity is on.
if self.eyefinity then if self.eyefinity then
local width = self.eyefinity local width = self.eyefinity
@@ -90,6 +99,7 @@ function E:UIScale(event)
height = h height = h
end end
self.UIParent:SetPoint("CENTER", UIParent)
E:Size(self.UIParent, width, height) E:Size(self.UIParent, width, height)
else else
--[[Eyefinity Test mode --[[Eyefinity Test mode
@@ -98,12 +108,10 @@ function E:UIScale(event)
]] ]]
--self.UIParent:SetSize(UIParent:GetWidth() - 250, UIParent:GetHeight() - 250); --self.UIParent:SetSize(UIParent:GetWidth() - 250, UIParent:GetHeight() - 250);
E:Size(self.UIParent, GetScreenWidth(), GetScreenHeight()) --E:Size(self.UIParent, GetScreenWidth(), GetScreenHeight())
self.UIParent:SetAllPoints(UIParent)
end end
self.UIParent:ClearAllPoints()
self.UIParent:SetPoint("CENTER", UIParent)
self.diffGetLeft = E:Round(abs(UIParent:GetLeft() - self.UIParent:GetLeft())) self.diffGetLeft = E:Round(abs(UIParent:GetLeft() - self.UIParent:GetLeft()))
self.diffGetRight = E:Round(abs(UIParent:GetRight() - self.UIParent:GetRight())) self.diffGetRight = E:Round(abs(UIParent:GetRight() - self.UIParent:GetRight()))
self.diffGetTop = E:Round(abs(UIParent:GetTop() - self.UIParent:GetTop())) self.diffGetTop = E:Round(abs(UIParent:GetTop() - self.UIParent:GetTop()))
@@ -114,10 +122,12 @@ function E:UIScale(event)
change = abs((E:Round(UIParent:GetScale(), 5) * 100) - (E:Round(scale, 5) * 100)) change = abs((E:Round(UIParent:GetScale(), 5) * 100) - (E:Round(scale, 5) * 100))
end end
if event == "UPDATE_FLOATING_CHAT_WINDOWS" and change and change > 1 and self.global.general.autoScale then if event == "CVAR_UPDATE" and arg1 == "USE_UISCALE" and change and change > 1 then
E:StaticPopup_Show("FAILED_UISCALE") if E.global.general.autoScale then
elseif event == "UPDATE_FLOATING_CHAT_WINDOWS" and change and change > 1 then E:StaticPopup_Show("FAILED_UISCALE")
E:StaticPopup_Show("CONFIG_RL") else
E:StaticPopup_Show("CONFIG_RL")
end
end end
self:UnregisterEvent("PLAYER_LOGIN") self:UnregisterEvent("PLAYER_LOGIN")