#1241 - Fix Movable to not remove the frame from the Blizzard managed table and not set isMovable on frames movable by Titan
urnati [07-08-19 - 19:07]
#1241 - Fix Movable to not remove the frame from the Blizzard managed table and not set isMovable on frames movable by Titan
diff --git a/Titan/TitanMovable.lua b/Titan/TitanMovable.lua
index cb59c6c..481d954 100755
--- a/Titan/TitanMovable.lua
+++ b/Titan/TitanMovable.lua
@@ -231,7 +231,7 @@ DESC: Adjust a given frame with the passed in values.
VAR: frame - Text string of the frame name
VAR: ... - list of frame position info
NOTE:
-Swiped from Vrul on wowinterface forum
+Swiped & modified from Vrul on wowinterface forum (https://www.wowinterface.com/forums/showthread.php?t=56519)
The table UIPARENT_MANAGED_FRAME_POSITIONS does not hold all Blizzard frames.
It is cleared for each frame in case the frame is in or might be in the table in the future.
@@ -240,26 +240,50 @@ Titan does not control the frames as other addons so we honor a user placed fram
:NOTE
--]]
local function SetPosition(frame, ...)
+ local function UserMovable(frame)
+ local fname = frame:GetName()
+ local res = false
+ -- user may move these frames via the UI
+ if (fname == 'PlayerFrame' or fname == 'TargetFrame')
+ then
+ res = true
+ else
+ res = false
+ end
+ end
if type(frame) == 'string' then
UIPARENT_MANAGED_FRAME_POSITIONS[frame] = nil
frame = _G[frame]
end
if type(frame) == 'table' and type(frame.IsObjectType) == 'function' and frame:IsObjectType('Frame') then
- local name = frame:GetName()
- if name then
- UIPARENT_MANAGED_FRAME_POSITIONS[name] = nil
+ if UserMovable(frame) then
+ -- Back off if the user has moved them via the UI
+ else
+ local name = frame:GetName()
+ -- Titan does not set in case the user needs to
+ if name then
+ UIPARENT_MANAGED_FRAME_POSITIONS[name] = nil
+ end
end
+
frame:SetMovable(true) -- allow frame to move
-- Titan honors a user placed frame so we don't need this
-- frame:SetUserPlaced(true) -- tell Blizzard to back off
- frame:SetDontSavePosition(true)
- frame:SetAttribute('ignoreFramePositionManager', true)
- frame.ignoreFramePositionManager = true
+-- Since Titan adjusts rather than controls some frames,
+-- Titan does not need to set these
+-- frame:SetDontSavePosition(true)
+-- frame:SetAttribute('ignoreFramePositionManager', true)
+-- frame.ignoreFramePositionManager = true
if ... then
frame:ClearAllPoints()
frame:SetPoint(...)
end
- frame:SetMovable(false) -- lock frame from moving
+ -- Need to add in case user (not an addon) wants to move this frames
+ if UserMovable(frame) then
+ -- do nothing
+ else
+ frame:SetMovable(false) -- lock frame from moving
+ end
end
end