diff --git a/Unlock.lua b/Unlock.lua
index 241d8b8..dbd1c91 100644
--- a/Unlock.lua
+++ b/Unlock.lua
@@ -60,6 +60,43 @@ local uiFrames = {
local uiPanel
+
+
+
+
+
+
+local origApplyFlipAnimationStyle = ActionButton.ApplyFlipAnimationStyle
+
+local function ApplyFlipAnimationStyle(self)
+ local timeline = self.hotbarSwapAnimation
+
+ if (timeline) then
+ local width, height = self.flipCard:GetDimensions()
+ local scale = self.flipCard:GetScale()
+
+ width, height = (width / scale) , (height / scale)
+
+ local firstAnimation = timeline:GetFirstAnimation()
+ local lastAnimation = timeline:GetLastAnimation()
+
+ firstAnimation:SetStartAndEndWidth(width, width)
+ firstAnimation:SetStartAndEndHeight(height, 0)
+ lastAnimation:SetStartAndEndWidth(width, width)
+ lastAnimation:SetStartAndEndHeight(0, height)
+ end
+end
+
+
+
+
+
+
+
+
+
+
+
local alertTextAlign = TEXT_ALIGN_RIGHT
-- --------------------------------------------
@@ -77,7 +114,7 @@ end
local function ConfigureAlertTextNotificationTextAlign(point)
local line
-
+
if (point == 2 or point == 3 or point == 6) then -- LEFT or TOPLEFT or BOTTOMLEFT
alertTextAlign = TEXT_ALIGN_LEFT
else
@@ -89,7 +126,7 @@ local function ConfigureAlertTextNotificationTextAlign(point)
else
line = ZO_AlertTextNotificationGamepad:GetChild(1)
end
-
+
line.fadingControlBuffer.anchor = ZO_Anchor:New(point)
end
@@ -103,7 +140,7 @@ function Azurah:RestoreDefaultData()
else
self.db.uiData.gamepad = {}
end
-
+
ReloadUI('ingame')
end
@@ -134,7 +171,7 @@ function Azurah:RestoreDefaultData() -- reset all frames to default positions
if (self.db.uiData[frame]) then
self.db.uiData[frame] = nil -- cleanse user data
end
-
+
obj:ClearAnchors()
obj:SetAnchor(data.point, data.rel, data.relPoint, data.x, data.y)
obj:SetScale(data.scale)
@@ -158,7 +195,7 @@ function Azurah:RecordUserData(frame, point, x, y, scale)
if (not self.db.uiData.keyboard[frame]) then
self.db.uiData.keyboard[frame] = {}
end
-
+
self.db.uiData.keyboard[frame].point = point
self.db.uiData.keyboard[frame].x = x
self.db.uiData.keyboard[frame].y = y
@@ -167,13 +204,13 @@ function Azurah:RecordUserData(frame, point, x, y, scale)
if (not self.db.uiData.gamepad[frame]) then
self.db.uiData.gamepad[frame] = {}
end
-
+
self.db.uiData.gamepad[frame].point = point
self.db.uiData.gamepad[frame].x = x
self.db.uiData.gamepad[frame].y = y
self.db.uiData.gamepad[frame].scale = scale
end
-
+
-- special cases
if (frame == 'ZO_CompassframeName') then
AZ_MOVED_COMPASS = true -- GLOBALS FOR WYKKYD
@@ -198,16 +235,24 @@ function Azurah:RecordUserData(frame, point, x, y, scale)
if (frame == 'ZO_AlertTextNotification' or frame == 'ZO_AlertTextNotificationGamepad') then -- configure the alignment of alert text notifications
ConfigureAlertTextNotificationTextAlign(point)
end
+
+ if (frame == 'ZO_ActionBar1') then
+ if (scale ~= 1) then -- scale of action bar is not the default, replace ActionButton.ApplyFlipAnimationStyle
+ ActionButton.ApplyFlipAnimationStyle = ApplyFlipAnimationStyle
+ else -- scale is default, ensure original function is in place
+ ActionButton.ApplyFlipAnimationStyle = origApplyFlipAnimationStyle
+ end
+ end
end
function Azurah:RestoreUserData()
local obj, userData, framesList
-
+
if self.db.uiData and not self.db.uiData.keyboard then
-- Old data conversion
self.db.oldData = self.db.uiData
self.db.uiData = nil
-
+
self.db.uiData = {}
self.db.uiData.keyboard = self.db.oldData
self.db.uiData.gamepad = {}
@@ -218,7 +263,7 @@ function Azurah:RestoreUserData()
self.db.uiData.keyboard = {}
self.db.uiData.gamepad = {}
end
-
+
if not IsInGamepadPreferredMode() then
userData = self.db.uiData.keyboard
framesList = uiFrames.keyboard
@@ -226,15 +271,15 @@ function Azurah:RestoreUserData()
userData = self.db.uiData.gamepad
framesList = uiFrames.gamepad
end
-
+
for frame, data in pairs(framesList) do
obj = _G[frame]
-
+
-- Apply minimum dimensions if needed
if (data[3] or data[4]) then
obj:SetDimensionConstraints(data[3], data[4])
end
-
+
-- special cases
if (frame == 'ZO_PlayerAttributeHealth') then -- scale attached bar
if userData[frame] then
@@ -243,7 +288,7 @@ function Azurah:RestoreUserData()
ZO_PlayerAttributeMountStamina:SetScale(1)
end
end
-
+
if (frame == 'ZO_PlayerAttributeMagicka') then -- scale attached bar
if userData[frame] then
ZO_PlayerAttributeWerewolf:SetScale(userData[frame].scale)
@@ -251,7 +296,7 @@ function Azurah:RestoreUserData()
ZO_PlayerAttributeMountStamina:SetScale(1)
end
end
-
+
if (frame == 'ZO_PlayerAttributeStamina') then -- scale attached bar
if userData[frame] then
ZO_PlayerAttributeMountStamina:SetScale(userData[frame].scale)
@@ -259,23 +304,27 @@ function Azurah:RestoreUserData()
ZO_PlayerAttributeMountStamina:SetScale(1)
end
end
-
+
if ((frame == 'ZO_AlertTextNotification' or frame == 'ZO_AlertTextNotificationGamepad') and userData[frame]) then
ConfigureAlertTextNotificationTextAlign(userData[frame].point) -- configure the alignment of alert text notifications
end
-
+
if userData[frame] then
obj:ClearAnchors()
obj:SetAnchor(userData[frame].point, GuiRoot, userData[frame].point, userData[frame].x, userData[frame].y)
obj:SetScale(userData[frame].scale)
-
+
if (frame == 'ZO_CompassFrame') then
AZ_MOVED_COMPASS = true -- GLOBALS FOR WYKKYD
end
-
+
if (frame == 'ZO_TargetUnitFramereticleover') then
AZ_MOVED_TARGET = true -- GLOBALS FOR WYKKYD
end
+
+ if (frame == 'ZO_ActionBar1' and userData[frame].scale ~= 1) then -- scale of action bar is not the default, replace ActionButton.ApplyFlipAnimationStyle with our own
+ ActionButton.ApplyFlipAnimationStyle = ApplyFlipAnimationStyle
+ end
else
-- Needs updating after adjusting the dimensions when it hasn't been moved before
if (frame == "ZO_ActiveCombatTips" and not userData[frame]) then
@@ -491,16 +540,16 @@ function Azurah:LockUI()
if (uiPanel) then
local framesList
-
+
uiPanel:SetHidden(true)
uiPanel = nil
-
+
if not IsInGamepadPreferredMode() then
framesList = uiFrames.keyboard
else
framesList = uiFrames.gamepad
end
-
+
for frame, data in pairs(framesList) do
Azurah.movers[frame] = nil
end
@@ -512,7 +561,7 @@ function Azurah:UnlockUI()
BuildUnlockPanel() -- build ui panel to
local mover, userData, framesList
-
+
if not IsInGamepadPreferredMode() then
userData = self.db.uiData.keyboard
framesList = uiFrames.keyboard
@@ -520,13 +569,13 @@ function Azurah:UnlockUI()
userData = self.db.uiData.gamepad
framesList = uiFrames.gamepad
end
-
+
for frame, data in pairs(framesList) do
-- Target frame is anchored to the compass by default in gamepad mode
if (frame == 'ZO_TargetUnitFramereticleover' and IsInGamepadPreferredMode() and not userData[frame]) then
_G[frame]:SetAnchor(TOP, GuiRoot, TOP, 0, 140)
end
-
+
mover = self.Mover:New(_G[frame], data[2])
if (data[1] == 2) then -- anchored frame, show but disallow drag
@@ -637,63 +686,63 @@ end
local function ApplyTemplateHook(obj, funcName, controlName)
local origFunc = obj[funcName]
-
+
obj[funcName] = function(self)
local result, data
-
+
result = origFunc(self)
-
+
if not IsInGamepadPreferredMode() then
data = Azurah.db.uiData.keyboard[controlName]
else
data = Azurah.db.uiData.gamepad[controlName]
end
-
- if data then
+
+ if data then
_G[controlName]:ClearAnchors()
_G[controlName]:SetAnchor(data.point, GuiRoot, data.point, data.x, data.y)
_G[controlName]:SetScale(data.scale)
end
-
+
return result
end
end
function Azurah:InitializeUnlock()
local uiData
-
+
-- replace Alert Text Notification function with our own variable text alignment func.
local line, AlertTextNotification
-
+
if not IsInGamepadPreferredMode() then
local line = ZO_AlertTextNotification:GetChild(1)
-
+
if (not line) then
ZO_Alert(UI_ALERT_CATEGORY_ALERT, nil, ' ')
line = ZO_AlertTextNotification:GetChild(1)
end
-
+
line.fadingControlBuffer.templates.ZO_AlertLine.setup = AlertTextNotificationAlignmentFunc
else
local line = ZO_AlertTextNotificationGamepad:GetChild(1)
-
+
if (not line) then
ZO_Alert(UI_ALERT_CATEGORY_ALERT, nil, ' ')
line = ZO_AlertTextNotificationGamepad:GetChild(1)
end
-
+
line.fadingControlBuffer.templates.ZO_AlertLineGamepad.setup = AlertTextNotificationAlignmentFunc
end
-
+
--self:RecordDefaultData()
self:RestoreUserData()
-
+
if not IsInGamepadPreferredMode() then
uiData = self.db.uiData.keyboard
else
uiData = self.db.uiData.gamepad
end
-
+
ZO_PreHookHandler(ZO_ActionBar1, 'OnShow', function()
if (uiData['ZO_ActionBar1']) then -- user has moved the action bar
if (ZO_Skills:IsHidden()) then -- restore to user location on skill window close
@@ -723,3 +772,4 @@ function Azurah:InitializeUnlock()
self:ConfigureCompass()
end
+