WoW:XML/Inset: Difference between revisions

From AddOn Studio
< XML
Jump to navigation Jump to search
No edit summary
 
m (Move page script moved page XML/Inset to XML/Inset without leaving a redirect)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== HitRectInsets ==
{{uixmltype}}


Elements: AbsInset, RelInset
[[XML/Inset|Inset]] alters the hit rectangle or 'hit rect' for user input. Defines a 4-way set of margins, positioning one area within another. See [[XML/Dimension|Dimension]] for numerical value pairs use type and [[XML/Value|Value]] for single value version. Inset is used for properties such as [[XML_properties#TextInsets|TextInsets]] and [[XML_properties#HitRectInsets|HitRectInsets]].


Attributes: left, right, top, bottom
== Inheritance ==
Inherited by: none, Inherits: none, Defined in: [[XML/Backdrop|Backdrop]],[[XML/EditBox|EditBox]],[[XML/Frame|Frame]]


Specifies the rectangle to be used for mouse interaction with the frame. E.g. a 100x100 frame with HitRectInsets of 2 for each attribute will only respond to mouse events within a 96x96 square centered within the frame.
== Elements ==
* [[XML/AbsInset|AbsInset]]
* [[XML/RelInset|RelInset]]


== Example ==
== Attributes ==
* left (int) - Default is '0'.
* right (int) - Default is '0'.
* top (int) - Default is '0'.
* bottom (int) - Default is '0'.


From FrameXML\OptionsFrameTemplates.xml:
== Summary ==
[[XML/Inset|Inset]] alters the active hit area for positional input devices. Hit rects are used for determining which screen element belongs to an input event by having an associated screen rectangle. [[XML/Inset|Inset]] type changes the default 'hit rect' for its display element. Inset is used for properties like: <BackgroundInsets> to "push in" the background texture to put in line with the border or edge textures of the frame; <TextInsets> to define text margins; <HitRectInsets> to modify a frame's hit rectangle in relation to its normal size.


  <CheckButton name="OptionsCheckButtonTemplate" inherits="UICheckButtonTemplate" virtual="true">
=== Example ===
<HitRectInsets>
  <CheckButton name="MyCheckTemplate" inherits="UICheckButtonTemplate" virtual="true">
<AbsInset left="0" right="-100" top="0" bottom="0"/>
  <HitRectInsets>
</HitRectInsets>
    <[[XML/AbsInset|AbsInset]] left="0" right="-100" top="0" bottom="0"/>
  </HitRectInsets>
  </CheckButton>
  </CheckButton>
<[[XML/Frame|Frame]] name="MyFrame">
  <HitRectInsets>
    <RelInset left="0" right="-0.1" top="0" bottom="0"/>
  </HitRectInsets>
  <Layers>
    <[[XML/Layer|Layer]]>
      <[[XML/Texture|Texture]]>
        <Size x="100" y="100" />
        <HitRectInsets>
          <[[XML/AbsInset|AbsInset]] left="0" right="-100" top="0" bottom="0"/>
        </HitRectInsets>
        <Color a="1" r="1" g="1" b="1" />
      </Texture>
      <Texture>
        <Size x="100" y="100" />
        <HitRectInsets left="0" right="-100" top="0" bottom="0" />
        <Color a="1" r="1" g="1" b="1" />
      </Texture>
    </Layer>
  </Layers>
</Frame>


This allows you to click the checkbox up to 100 pixels (scaled) to the right of the box itself (where the label would be).
This example will show a frame with several textures, with altered 'hit rect' insets. The <CheckBotton> template allows you to click the checkbox up to 100 pixels (scaled) to the right of the box itself (where the label would be).


[[Category:Interface Customization]]
== Details ==
 
== BackgroundInsets ==
You add the background file which is the dialog box background. You then add the edgeFile which will be the dialog box border texture (this will go around the border or "edge" of the frame). You will notice if you remove the background insets you will see the background texture on the outside of the edge texture. BackgroundInsets fixes this.
[[Category:Interface customization]]

Latest revision as of 04:49, 15 August 2023

XML UI ← XML types < Inset

Inset alters the hit rectangle or 'hit rect' for user input. Defines a 4-way set of margins, positioning one area within another. See Dimension for numerical value pairs use type and Value for single value version. Inset is used for properties such as TextInsets and HitRectInsets.

Inheritance[edit]

Inherited by: none, Inherits: none, Defined in: Backdrop,EditBox,Frame

Elements[edit]

Attributes[edit]

  • left (int) - Default is '0'.
  • right (int) - Default is '0'.
  • top (int) - Default is '0'.
  • bottom (int) - Default is '0'.

Summary[edit]

Inset alters the active hit area for positional input devices. Hit rects are used for determining which screen element belongs to an input event by having an associated screen rectangle. Inset type changes the default 'hit rect' for its display element. Inset is used for properties like: <BackgroundInsets> to "push in" the background texture to put in line with the border or edge textures of the frame; <TextInsets> to define text margins; <HitRectInsets> to modify a frame's hit rectangle in relation to its normal size.

Example[edit]

<CheckButton name="MyCheckTemplate" inherits="UICheckButtonTemplate" virtual="true">
  <HitRectInsets>
    <AbsInset left="0" right="-100" top="0" bottom="0"/>
  </HitRectInsets>
</CheckButton>
<Frame name="MyFrame">
 <HitRectInsets>
   <RelInset left="0" right="-0.1" top="0" bottom="0"/>
 </HitRectInsets>
 <Layers>
    <Layer>
      <Texture>
        <Size x="100" y="100" />
        <HitRectInsets>
          <AbsInset left="0" right="-100" top="0" bottom="0"/>
        </HitRectInsets>
        <Color a="1" r="1" g="1" b="1" />
      </Texture>
      <Texture>
        <Size x="100" y="100" />
        <HitRectInsets left="0" right="-100" top="0" bottom="0" />
        <Color a="1" r="1" g="1" b="1" />
      </Texture>
    </Layer>
  </Layers>
</Frame>

This example will show a frame with several textures, with altered 'hit rect' insets. The <CheckBotton> template allows you to click the checkbox up to 100 pixels (scaled) to the right of the box itself (where the label would be).

Details[edit]

BackgroundInsets[edit]

You add the background file which is the dialog box background. You then add the edgeFile which will be the dialog box border texture (this will go around the border or "edge" of the frame). You will notice if you remove the background insets you will see the background texture on the outside of the edge texture. BackgroundInsets fixes this.