mirror of
https://codeberg.org/Duvelcorp/MetaHunt.git
synced 2026-10-26 09:00:49 +00:00
Fix Hunter's Book animation SetPoint errors
The window's first anchor is relative to a child, so SlideIn/SlideOut's position tween threw '<child> is dependent on this' every tick. Switch the open/close/tab/search animations to alpha-only fades (matches the option labels).
This commit is contained in:
+9
-19
@@ -12,12 +12,9 @@ local function MTH_BOOK_FadeInWindow(frame)
|
|||||||
-- book renders fully opaque for one frame before the tween's onStart snaps it
|
-- book renders fully opaque for one frame before the tween's onStart snaps it
|
||||||
-- to 0 -- a flash that makes the fade look like it never happened.
|
-- to 0 -- a flash that makes the fade look like it never happened.
|
||||||
if type(frame.SetAlpha) == "function" then frame:SetAlpha(0) end
|
if type(frame.SetAlpha) == "function" then frame:SetAlpha(0) end
|
||||||
-- Slide the whole window up into place while fading in. Position and alpha are
|
-- Fade only: the window's first anchor is relative to a child, so a position
|
||||||
-- the only safe properties on a complex frame: the built-in "scale" tween
|
-- tween's per-frame SetPoint throws "<child> is dependent on this". Alpha is safe.
|
||||||
-- resizes width/height, which the child widgets do NOT follow (they clip), so
|
Sauce:FadeIn(frame, 0.5, "outQuad")
|
||||||
-- a slide + fade is the strongest effect that keeps the layout intact. A
|
|
||||||
-- bigger travel + springy "outBack" overshoot makes the entrance pop.
|
|
||||||
Sauce:SlideIn(frame, "UP", 110, 0.5, "outBack")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Fade the results list back in when switching Hunter's Book tabs, unless disabled.
|
-- Fade the results list back in when switching Hunter's Book tabs, unless disabled.
|
||||||
@@ -27,9 +24,8 @@ local function MTH_BOOK_AnimateTabSwitch()
|
|||||||
local list = getglobal("MTH_BOOK_ListBackdrop")
|
local list = getglobal("MTH_BOOK_ListBackdrop")
|
||||||
if not list then return end
|
if not list then return end
|
||||||
if type(list.SetAlpha) == "function" then list:SetAlpha(0) end
|
if type(list.SetAlpha) == "function" then list:SetAlpha(0) end
|
||||||
-- Slide the list in from the right while fading so the tab change reads as
|
-- Fade only (position tween SetPoint is unsafe on this anchor; see FadeInWindow).
|
||||||
-- motion rather than a faint brightness bump.
|
Sauce:FadeIn(list, 0.3, "outQuad")
|
||||||
Sauce:SlideIn(list, "RIGHT", 55, 0.3, "outCubic")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Fade the book window out before hiding it, unless disabled (shares the
|
-- Fade the book window out before hiding it, unless disabled (shares the
|
||||||
@@ -42,17 +38,11 @@ local function MTH_BOOK_FadeOutWindow(frame)
|
|||||||
frame:Hide()
|
frame:Hide()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- Capture the resting anchor so SlideOut's downward displacement can be
|
-- Fade only (position tween SetPoint is unsafe on this anchor; see FadeInWindow).
|
||||||
-- restored once the window is hidden (otherwise the next open is offset).
|
Sauce:FadeTo(frame, 0, 0.26, "inQuad", {
|
||||||
local p, rel, rp, x, y = frame:GetPoint(1)
|
|
||||||
Sauce:SlideOut(frame, "DOWN", 90, 0.26, "inCubic", {
|
|
||||||
onFinish = function()
|
onFinish = function()
|
||||||
frame:Hide()
|
frame:Hide()
|
||||||
if type(frame.SetAlpha) == "function" then frame:SetAlpha(1) end
|
if type(frame.SetAlpha) == "function" then frame:SetAlpha(1) end
|
||||||
if p then
|
|
||||||
frame:ClearAllPoints()
|
|
||||||
frame:SetPoint(p, rel, rp, x, y)
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
@@ -64,8 +54,8 @@ local function MTH_BOOK_AnimateSearchResults()
|
|||||||
local list = getglobal("MTH_BOOK_ListBackdrop")
|
local list = getglobal("MTH_BOOK_ListBackdrop")
|
||||||
if not list then return end
|
if not list then return end
|
||||||
if type(list.SetAlpha) == "function" then list:SetAlpha(0) end
|
if type(list.SetAlpha) == "function" then list:SetAlpha(0) end
|
||||||
-- Slide the refreshed list in from the right so a search visibly refreshes.
|
-- Fade only (position tween SetPoint is unsafe on this anchor; see FadeInWindow).
|
||||||
Sauce:SlideIn(list, "RIGHT", 45, 0.26, "outCubic")
|
Sauce:FadeIn(list, 0.26, "outQuad")
|
||||||
end
|
end
|
||||||
|
|
||||||
MTH_HUNTERBOOK_LOADED = true
|
MTH_HUNTERBOOK_LOADED = true
|
||||||
|
|||||||
Reference in New Issue
Block a user