WoW:XML/Anchor: Difference between revisions

981 bytes added ,  15 August 2023
m
Move page script moved page XML/Anchor to WoW:XML/Anchor without leaving a redirect
m (Move page script moved page XML/Anchor to WoW:XML/Anchor without leaving a redirect)
 
(9 intermediate revisions by one other user not shown)
Line 12: Line 12:


== Attributes ==
== Attributes ==
* point ([[XML/FRAMEPOINT|FRAMEPOINT]]) - place on the layout frame or frame that should get anchored
* point ([[XML/FRAMEPOINT|FRAMEPOINT]]) - this place on this layout frame that should get anchored
* relativeTo (string) - global name of LayoutFrame to make relative to. Default value is the parent.  
* relativeTo (string) - global name of LayoutFrame to make relative to. By is relative to its parent.  
* relativeKey (string) - a Lua reference to make relative to. Alternative to using 'relativeTo'. See 'parentKey' in [[XML/LayoutFrame|LayoutFrame]].
* relativeKey (string) - a Lua reference to make relative to. Alternative to using 'relativeTo'. See 'parentKey' in [[XML/LayoutFrame|LayoutFrame]].
* relativePoint ([[XML/FRAMEPOINT|FRAMEPOINT]]) - place on the relative frame or region that 'point' should be relative to. Default value is same 'point'
* relativePoint ([[XML/FRAMEPOINT|FRAMEPOINT]]) - place on the relative frame that 'point' should anchored to. Default value is same as value of 'point'  
* x (int) - horizontal offset from the effective 'relativePoint'. Default is 0.
* x (int) - horizontal offset from the effective 'relativePoint'. Default is 0.
* y (int) - vertical offset from the effective 'relativePoint'. Default is 0.
* y (int) - vertical offset from the effective 'relativePoint'. Default is 0.
Line 49: Line 49:


=== Points and Relative Points ===
=== Points and Relative Points ===
A particular edge or corner of a layout frame is an anchor 'point'.
1) A particular edge or corner of a layout frame is an anchor 'point'.


* point ([[XML/FRAMEPOINT|FRAMEPOINT]])
* point ([[XML/FRAMEPOINT|FRAMEPOINT]])


For a frame corner, a 'point' of 'TOPLEFT' refers to the top left corner of the of the layout frame the anchor is defined on. For an edge like 'LEFT', the center of that edge is considered to be the actual anchor point of the layout frame the anchor is defined on, if no other anchors overriding the verticle axis are defined.
This defines where in this layout frame that it should be anchored. For example, a value of 'TOPLEFT' refers to the top left corner of the of this layout frame. For an edge, 'LEFT' for example, the center of that edge is considered to be the actual anchor point, if no other anchors additionally overriding the layout frames vertical axis are defined.


The 'relativePoint' defines where, on another layout frame, to place a particular 'point' of the layout frame itself.
2) The 'relativePoint' defines where, on another layout frame, to place a particular 'point' of the layout frame itself.


* relativePoint ([[XML/FRAMEPOINT|FRAMEPOINT]])
* relativePoint ([[XML/FRAMEPOINT|FRAMEPOINT]])


For this to matter, another layout frame must be cited using 'relativeTo' or 'relativeKey', which contains the relative point to which this frames 'point' is being anchored to.
This is the anchor's relative position on the 'relative frame'. By default, the anchor will attach to the same point on the relative frame as defined by 'point'. So, if 'point' is set to 'LEFT', then by default the anchor will also attach to the left side of the relative frame. If 'relativePoint' is set however, it overrides the default behavior. So if 'relativePoint' set to 'RIGHT', then the left side of this layout frame, in this example, will instead anchor to the right side of the relative frame. 
 
3) The 'relativeTo' and 'relativeKey' atributes define which other 'layout frame' this anchor is relative to.


* relativeTo (string)
* relativeTo (string)
* relativeKey (string)
* relativeKey (string)


The 'relativeTo' is the name of a frame to use for the 'relativePoint'. Alternativley, the 'relativeKey' is the name of a runtime Lua variable that contains a reference to the layout frame to be used for the 'relativePoint'. If 'relativeTo' is defined, then 'relativeKey' will be ignored.
By default, all layout frames are relative to their parent. If either of these are set, then it overrides the relative layout frame with respect to this anchor point. Different anchors can also have different relative layout frames, such that a texture could automatically stretch across two different other layout frames.
 
The 'relativeTo' is the global name of a frame to use for the 'relativePoint'. Alternatively, the 'relativeKey' is the name of a runtime Lua variable on this layout frame's parent, that contains a reference to the layout frame to be used for the 'relativePoint'. Using 'parentKey' elsewhere is a way to define these values for 'realtiveKey'. If 'relativeTo' is defined, then 'relativeKey' will be ignored. See the 'parentKey' attribute in [[XML/LayoutFrame]] as one of the many ways to set this value.


=== Layouts ===
=== Layouts ===
Layout in printing or computer graphics is concerned with the flow of elements with respect to each other. A layout system is a system for defining that layout. For WoW, flow in layout is defined by frames and anchors, and flow order is established by 'laying out' frames from their creation order from top to bottom, and from parent to child. Frames with the smae parent and render z-order, will be rendered from first to last in definition order as well.
Layout in printing or computer graphics is concerned with the flow of elements with respect to each other. A layout system is a system for defining that layout. For WoW, flow in layout is defined by frames and anchors, and flow order is established by 'laying out' frames from their creation order from top to bottom, and from parent to child. Frames with the same parent and render z-order, will be rendered from first to last in definition order as well.
 
  <Frame name="Frame">
  <Frame name="Frame">
  <Frames>
<Frames>
    <Frame name="Frame2">
<Frame name="Frame2">
      <Size x="100" y="100">
<Size x="100" y="100">
      <[[XML/Anchors|Anchors]]><[[XML/Anchor|Anchor]] point="TOP" relativePoint="BOTTOM" x="0" y="-10" /></Anchors>
<[[XML/Anchors|Anchors]]><[[XML/Anchor|Anchor]] point="TOP" relativePoint="BOTTOM" x="0" y="-10" /></Anchors>
    </frame>
</frame>
    <Frame name="Frame3">
<Frame name="Frame3">
      <Size x="100" y="100">
<Size x="100" y="100">
      <[[XML/Anchors|Anchors]]><[[XML/Anchor|Anchor]] point="TOPLEFT" /></Anchors>
<[[XML/Anchors|Anchors]]><[[XML/Anchor|Anchor]] point="TOPLEFT" /></Anchors>
    </frame>
</frame>
  </Frames>
</Frames>
  </Frame>
  </Frame>


This will place the 'Frame2' child at an offset of 10 from the bottom of its parent frame; 'relativeTo' for 'Frame2' is its parent by default. Frame3 will be rendered on top of Frame2 is they overlap.
This will place the 'Frame2' child at an offset of 10 from the bottom of its parent frame; 'relativeTo' for 'Frame2' is its parent by default. Frame3 will be rendered on top of Frame2 is they overlap.
     <Frame name="Frame3">
     <Frame name="Frame3">
       <Size x="50" y="50">
       <Size x="50" y="50">
Anonymous user