View Single Post
05/22/14, 07:34 AM   #7
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by Tar000un View Post
The parts about the concerned code :

Lua Code:
  1. UI_Texture:ClearAnchors();
  2. UI_Label:ClearAnchors();
  3. UI_BG:ClearAnchors();
  4. UI:ClearAnchors();
  5.  
  6. UI:SetAnchor( TOPLEFT, GuiRoot, TOPLEFT, defaults.x, defaults.y );
  7. UI_BG:SetAnchor(TOPLEFT, UI, TOPLEFT, 0, 0);
  8. UI_Texture:SetAnchor(TOPLEFT, UI_BG, TOPLEFT, 0, 0);
  9. UI_Label:SetAnchor(BOTTOM, UI_BG, BOTTOM, 0, 0);



The XML:
Code:
<Controls>
	<Backdrop name="$(parent)_BGcompassTiny" 
			inherits="ZO_CenterlessBackdrop" edgeColor="000000" 
			centerColor="000000" alpha="0">
		<AnchorFill />
	</Backdrop>
	<Texture name="$(parent)_TextureCompassTiny" />
	<Label name="$(parent)_LabelCompassTiny" 
		verticalAlignment="BOTTOM" horizontalAlignment="CENTER" 
		text="Label" alpha="1" 
	/>
</Controls>
Everything is anchored to the UI (top level window), so it should be enough to move just UI.
Lua Code:
  1. UI:ClearAnchors()
  2. UI:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, defaults.x, defaults.y)

Also in my opinion both backdrop and texture needs two anchors:
Lua Code:
  1. UI:ClearAnchors()
  2. UI:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, defaults.x, defaults.y)
  3.  
  4. UI_BG:ClearAnchors()
  5. UI_BG:SetAnchor(TOPLEFT, UI, TOPLEFT, 0, 0)
  6. UI_BG:SetAnchor(BOTTOMRIGHT, UI, BOTTOMRIGHT, 0, 0)
  7. --or instead of two lines above use:
  8. --UI_BG:SetAnchorFill(UI)
  9.  
  10. UI_Texture:ClearAnchors()
  11. UI_Texture:SetAnchor(TOPLEFT, UI_BG, TOPLEFT, 0, 0)
  12. UI_Texture:SetAnchor(BOTTOMRIGHT, UI_BG, BOTTOMRIGHT, 0, 0)
  13. --or instead of two lines above use:
  14. --UI_Texture:SetAnchorFill(UI_BG)
  15.  
  16. UI_Label:ClearAnchors()
  17. UI_Label:SetAnchor(BOTTOM, UI_BG, BOTTOM, 0, 0)

Last edited by Garkin : 05/22/14 at 07:38 AM.
  Reply With Quote