From 1486a10883708f5368aef886727cbc08e9451c3d Mon Sep 17 00:00:00 2001 From: shagu Date: Sun, 3 Jun 2018 11:41:14 +0200 Subject: [PATCH] api: add init option for movables --- api/api.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/api/api.lua b/api/api.lua index 076a8e79..83ab278b 100644 --- a/api/api.lua +++ b/api/api.lua @@ -460,7 +460,8 @@ end -- Loads and update the configured position of the specified frame. -- It also creates an entry in the movables table. -- 'frame' [frame] the frame that should be updated. -function pfUI.api.UpdateMovable(frame) +-- 'init' [bool] treats the current position as initial data +function pfUI.api.UpdateMovable(frame, init) local name = frame:GetName() if pfUI_config.global.offscreen == "0" then @@ -472,9 +473,11 @@ function pfUI.api.UpdateMovable(frame) end -- update position data - frame.posdata = { scale = frame:GetScale(), pos = {} } - for i=1,frame:GetNumPoints() do - frame.posdata.pos[i] = { frame:GetPoint(i) } + if not frame.posdata or init then + frame.posdata = { scale = frame:GetScale(), pos = {} } + for i=1,frame:GetNumPoints() do + frame.posdata.pos[i] = { frame:GetPoint(i) } + end end if pfUI_config["position"][frame:GetName()] then