Record Class Rect
java.lang.Object
java.lang.Record
com.vaadin.flow.component.ai.common.Rect
- Record Components:
x- the left edge as a fraction of the surface widthy- the top edge as a fraction of the surface heightwidth- the width as a fraction of the surface widthheight- the height as a fraction of the surface height
- All Implemented Interfaces:
Serializable
public record Rect(double x, double y, double width, double height)
extends Record
implements Serializable
A rectangle expressed as fractions of the surface it sits on, measured from
the top-left corner. All values are in the
0..1 range, so the
rectangle holds at any zoom level and rendering size: multiply by the
rendered width and height to get pixel coordinates.
The fractions describe the surface as the user sees it — for a PDF page marked as rotated, they refer to the rotated page rather than the unrotated one.
- Since:
- 25.3
- Author:
- Vaadin Ltd
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionRect(double x, double y, double width, double height) Creates a new rectangle. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.doubleheight()Returns the value of theheightrecord component.final StringtoString()Returns a string representation of this record class.doublewidth()Returns the value of thewidthrecord component.doublex()Returns the value of thexrecord component.doubley()Returns the value of theyrecord component.
-
Constructor Details
-
Rect
public Rect(double x, double y, double width, double height) Creates a new rectangle.- Parameters:
x- the left edge as a fraction of the surface width, in the0..1rangey- the top edge as a fraction of the surface height, in the0..1rangewidth- the width as a fraction of the surface width, greater than0and at most1height- the height as a fraction of the surface height, greater than0and at most1- Throws:
IllegalArgumentException- if a value is outside its range, or not a number
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
x
public double x()Returns the value of thexrecord component.- Returns:
- the value of the
xrecord component
-
y
public double y()Returns the value of theyrecord component.- Returns:
- the value of the
yrecord component
-
width
public double width()Returns the value of thewidthrecord component.- Returns:
- the value of the
widthrecord component
-
height
public double height()Returns the value of theheightrecord component.- Returns:
- the value of the
heightrecord component
-