Commit 696804f8 authored by Simpy's avatar Simpy 🐹
Browse files

Revert "test with no forced pixel unsnap"

This reverts commit c7a4b15b.
parent 46001384
...@@ -25,6 +25,29 @@ function E:SafeGetPoint(frame) ...@@ -25,6 +25,29 @@ function E:SafeGetPoint(frame)
end end
end end
local function WatchPixelSnap(frame, snap)
if (frame and not frame:IsForbidden()) and frame.PixelSnapDisabled and snap then
frame.PixelSnapDisabled = nil
end
end
local function DisablePixelSnap(frame)
if (frame and not frame:IsForbidden()) and not frame.PixelSnapDisabled then
if frame.SetSnapToPixelGrid then
frame:SetSnapToPixelGrid(false)
frame:SetTexelSnappingBias(0)
elseif frame.GetStatusBarTexture then
local texture = frame:GetStatusBarTexture()
if texture and texture.SetSnapToPixelGrid then
texture:SetSnapToPixelGrid(false)
texture:SetTexelSnappingBias(0)
end
end
frame.PixelSnapDisabled = true
end
end
local function GetTemplate(template, isUnitFrameElement) local function GetTemplate(template, isUnitFrameElement)
backdropa, bordera = 1, 1 backdropa, bordera = 1, 1
...@@ -77,6 +100,7 @@ local function SetOutside(obj, anchor, xOffset, yOffset, anchor2, noScale) ...@@ -77,6 +100,7 @@ local function SetOutside(obj, anchor, xOffset, yOffset, anchor2, noScale)
obj:ClearAllPoints() obj:ClearAllPoints()
end end
DisablePixelSnap(obj)
obj:SetPoint('TOPLEFT', anchor, 'TOPLEFT', -x, y) obj:SetPoint('TOPLEFT', anchor, 'TOPLEFT', -x, y)
obj:SetPoint('BOTTOMRIGHT', anchor2 or anchor, 'BOTTOMRIGHT', x, -y) obj:SetPoint('BOTTOMRIGHT', anchor2 or anchor, 'BOTTOMRIGHT', x, -y)
end end
...@@ -93,6 +117,7 @@ local function SetInside(obj, anchor, xOffset, yOffset, anchor2, noScale) ...@@ -93,6 +117,7 @@ local function SetInside(obj, anchor, xOffset, yOffset, anchor2, noScale)
obj:ClearAllPoints() obj:ClearAllPoints()
end end
DisablePixelSnap(obj)
obj:SetPoint('TOPLEFT', anchor, 'TOPLEFT', x, -y) obj:SetPoint('TOPLEFT', anchor, 'TOPLEFT', x, -y)
obj:SetPoint('BOTTOMRIGHT', anchor2 or anchor, 'BOTTOMRIGHT', -x, y) obj:SetPoint('BOTTOMRIGHT', anchor2 or anchor, 'BOTTOMRIGHT', -x, y)
end end
...@@ -399,6 +424,16 @@ local function addapi(object) ...@@ -399,6 +424,16 @@ local function addapi(object)
if not object.StyleButton then mt.StyleButton = StyleButton end if not object.StyleButton then mt.StyleButton = StyleButton end
if not object.CreateCloseButton then mt.CreateCloseButton = CreateCloseButton end if not object.CreateCloseButton then mt.CreateCloseButton = CreateCloseButton end
if not object.GetNamedChild then mt.GetNamedChild = GetNamedChild end if not object.GetNamedChild then mt.GetNamedChild = GetNamedChild end
if not object.DisabledPixelSnap and (mt.SetSnapToPixelGrid or mt.SetStatusBarTexture or mt.SetColorTexture or mt.SetVertexColor or mt.CreateTexture or mt.SetTexCoord or mt.SetTexture) then
if mt.SetSnapToPixelGrid then hooksecurefunc(mt, 'SetSnapToPixelGrid', WatchPixelSnap) end
if mt.SetStatusBarTexture then hooksecurefunc(mt, 'SetStatusBarTexture', DisablePixelSnap) end
if mt.SetColorTexture then hooksecurefunc(mt, 'SetColorTexture', DisablePixelSnap) end
if mt.SetVertexColor then hooksecurefunc(mt, 'SetVertexColor', DisablePixelSnap) end
if mt.CreateTexture then hooksecurefunc(mt, 'CreateTexture', DisablePixelSnap) end
if mt.SetTexCoord then hooksecurefunc(mt, 'SetTexCoord', DisablePixelSnap) end
if mt.SetTexture then hooksecurefunc(mt, 'SetTexture', DisablePixelSnap) end
mt.DisabledPixelSnap = true
end
end end
local handled = {Frame = true} local handled = {Frame = true}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment