Package com.valhalla.sdk.api.widgets
Class WidgetBounds
java.lang.Object
com.valhalla.sdk.api.widgets.WidgetBounds
Immutable native-surface rectangle for a widget whose geometry was published
by the active adapter.
Geometry is optional evidence. An adapter may know a widget's identity,
text, and actions without publishing safe bounds, so
WidgetSnapshot.getBounds() returns an empty value in that case rather
than a fabricated (0, 0, 0, 0) rectangle. Never treat absent geometry
as a real position.
Containment is half-open: the left and top edges are inside, the right and bottom edges are outside, so adjacent rectangles never both contain a point.
-
Constructor Summary
ConstructorsConstructorDescriptionWidgetBounds(int x, int y, int width, int height) Creates validated native-surface bounds. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(int pointX, int pointY) Tests half-open containment of a native-surface point.booleanintReturns the exclusive bottom edge.intReturns the height in native-surface pixels.intgetRight()Returns the exclusive right edge.intgetWidth()Returns the width in native-surface pixels.intgetX()Returns the left coordinate.intgetY()Returns the top coordinate.inthashCode()toString()
-
Constructor Details
-
WidgetBounds
public WidgetBounds(int x, int y, int width, int height) Creates validated native-surface bounds.- Parameters:
x- left coordinate on the native game surfacey- top coordinate on the native game surfacewidth- positive width in native-surface pixelsheight- positive height in native-surface pixels- Throws:
IllegalArgumentException- when width or height is not positive
-
-
Method Details
-
getX
public int getX()Returns the left coordinate.- Returns:
- the left coordinate
-
getY
public int getY()Returns the top coordinate.- Returns:
- the top coordinate
-
getWidth
public int getWidth()Returns the width in native-surface pixels.- Returns:
- the width in native-surface pixels
-
getHeight
public int getHeight()Returns the height in native-surface pixels.- Returns:
- the height in native-surface pixels
-
getRight
public int getRight()Returns the exclusive right edge.- Returns:
- the exclusive right edge
-
getBottom
public int getBottom()Returns the exclusive bottom edge.- Returns:
- the exclusive bottom edge
-
contains
public boolean contains(int pointX, int pointY) Tests half-open containment of a native-surface point.- Parameters:
pointX- native-surface X coordinatepointY- native-surface Y coordinate- Returns:
truewhen the point lies inside these bounds
-
equals
-
hashCode
public int hashCode() -
toString
-