View Single Post
09-07-16, 01:24 PM   #1
Sweetsour
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Dec 2014
Posts: 130
Issue with :SetPoint() when moving objects

Hello!

I'm having an issue with moving objects and keeping their positions on the screen when loading saved variables after reloading the UI.

Normal Layout


Layout after moving objects


Layout after reloading UI


Setting data to Saved Variables (after finishing with move)
Lua Code:
  1. point,_,relativePoint,x,y = LargeIconGrpTop:GetPoint(1);
  2. Auras.db.char.frames.eleGrp.LargeIconGrpTopEle.point = point;
  3. Auras.db.char.frames.eleGrp.LargeIconGrpTopEle.relativeTo = "AuraGroupEle";
  4. Auras.db.char.frames.eleGrp.LargeIconGrpTopEle.relativePoint = relativePoint;
  5. Auras.db.char.frames.eleGrp.LargeIconGrpTopEle.x = x;
  6. Auras.db.char.frames.eleGrp.LargeIconGrpTopEle.y = y;

Setting Point(s) upon "Auras:OnEnable()"
Lua Code:
  1. local function InitializeGroup(group,width,height,point,relativeTo,relativePoint,x,y)
  2.     if (width ~= nil) then
  3.         group:SetWidth(width);
  4.         group:SetHeight(height);
  5.     end
  6.     group:ClearAllPoints();
  7.     --group:SetPoint(point,(SSA[relativeTo] or UIParent),relativePoint,x,y); (what I've also tried)
  8.     group:SetPoint(point,x,y)
  9. end
  10.  
  11. local dbEle = Auras.db.char.frames.eleGrp;
  12. for groupObj in pairs(dbEle) do
  13.     InitializeGroup(SSA[groupObj],dbEle[groupObj].width,dbEle[groupObj].height,dbEle[groupObj].point,SSA[dbEle[groupObj].relativeTo],dbEle[groupObj].relativePoint,dbEle[groupObj].x,dbEle[groupObj].y);
  14. end

Last edited by Sweetsour : 09-07-16 at 01:31 PM.
  Reply With Quote