XML/Inset

From Warcraft Wiki
< XML
Jump to navigation Jump to search

<Inset> defines padding or overflow from a region's edges.

<Inset left="" right="" bottom="" top="" />
<Inset>
	<AbsInset left="" right="" bottom="" top="" />
	<RelInset left="" right="" bottom="" top="" />
<Inset>

Attributes

left (xs:float?Optional. Could be nil.) - (+) padding or (-) overflow from the left edge, scaling dependent.
right (xs:float?Optional. Could be nil.) - (+) padding or (-) overflow from the right edge, scaling dependent.
bottom (xs:float?Optional. Could be nil.) - (+) padding or (-) overflow from the bottom edge, scaling dependent.
top (xs:float?Optional. Could be nil.) - (+) padding or (-) overflow from the top edge, scaling dependent.

Child elements

<AbsInset> uses scaling-dependent coordinates; equivalent to attributes on the <Inset> tag itself.

<RelInset> multiplies coordinates by 1560 (16:9) or 1250 (4:3) before applying scaling.

Details

  • This documentation differs from the official schema:
    • <Inset> accepts xs:float, similar to <AbsInset>, despite the schema requiring xs:int.
    • <RelInset> silently defaults each value to 0.0 despite the schema requiring all four attributes.
  • The ratio for <RelInset> is evident from in-game testing (see below), but the reason for it to be about 1560 or 1250 is unclear.

Example

<HitRectInsets> inherits from <Inset> when causing a tiny frame (white) to be interactive over a larger area (red):

<Frame movable="true" enableMouse="true" clampedToScreen="true" frameStrata="DIALOG">
	<HitRectInsets>
		<RelInset top="-0.1" bottom="-0.1" right="-0.1" left="-0.1" />
	</HitRectInsets>
	<Size x="10" y="10" />
	<Anchors>
		<Anchor point="CENTER" />
	</Anchors>
	<Layers>
		<Layer level="ARTWORK">
			<Texture setAllPoints="true">
				<Color r="1" g="1" b="1" />
			</Texture>
		</Layer>
		<Layer level="BACKGROUND">
			<Texture>
				<Color r="0.5" g="0" b="0" a="0.8" />
				<Size x="322" y="322" />  <!-- 1560 * 0.1 * 2, plus the height of the white box -->
				<Anchors>
					<Anchor point="CENTER" />
				</Anchors>
			</Texture>
			<FontString text="Edge of 16:9 resolutions" inherits="GameFontNormal">
				<Anchors>
					<Anchor point="CENTER" x="0" y="155" />
				</Anchors>
			</FontString>
		</Layer>
		<Layer level="BORDER">
			<Texture>
				<Color r="0.5" g="0.5" b="0" a="0.8" />
				<Size x="260" y="260" />  <!-- 1250 * 0.1 * 2, plus the height of the white box -->
				<Anchors>
					<Anchor point="CENTER" />
				</Anchors>
			</Texture>
			<FontString text="All resolutions (ie, 800x600)" inherits="GameFontNormal">
				<Anchors>
					<Anchor point="CENTER" x="0" y="100" />
				</Anchors>
			</FontString>
		</Layer>
	</Layers>
	<Scripts>
		<OnDragStart>
			self:StartMoving()
		</OnDragStart>
		<OnDragStop>
			self:StopMovingOrSizing()
		</OnDragStop>
		<OnLoad>
			self:RegisterForDrag("LeftButton")
		</OnLoad>
	</Scripts>
</Frame>

From FrameXML\OptionsFrameTemplates.xml, to click a checkbox up to 100 pixels to the right of the box itself:

<CheckButton name="OptionsCheckButtonTemplate" inherits="UICheckButtonTemplate" virtual="true">
	<HitRectInsets>
		<AbsInset left="0" right="-100" top="0" bottom="0"/>
	</HitRectInsets>
</CheckButton>

See also

The following tags inherit <Insets>:

  • <HitRectInsets>, a child element of <Frame>.
  • <TextInsets>, a child element of <EditBox>.