Package org.testfx.util
Class PointQueryUtils
- java.lang.Object
-
- org.testfx.util.PointQueryUtils
-
public final class PointQueryUtils extends java.lang.Object
-
-
Constructor Summary
Constructors Modifier Constructor Description privatePointQueryUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static javafx.geometry.Point2DatPosition(javafx.geometry.Bounds bounds, javafx.geometry.Pos position)static javafx.geometry.Point2DatPositionFactors(javafx.geometry.Bounds bounds, javafx.geometry.Point2D positionFactors)Returns the point within the given bounds computed using the givenpositionFactors.static javafx.geometry.Point2DcomputePositionFactors(javafx.geometry.Pos position)Computes the width/height factors for the point defined by the givenposition.private static doublecomputePositionX(javafx.geometry.HPos hPos)private static doublecomputePositionY(javafx.geometry.VPos vPos)private static doublelerp(double start, double distance, double factor)
-
-
-
Method Detail
-
atPosition
public static javafx.geometry.Point2D atPosition(javafx.geometry.Bounds bounds, javafx.geometry.Pos position)- Parameters:
bounds- the given boundsposition- the position within the bounds- Returns:
- a point somewhere in the given bounds whose x and y values are determined by
passing the given
positiontocomputePositionFactors(Pos).
-
atPositionFactors
public static javafx.geometry.Point2D atPositionFactors(javafx.geometry.Bounds bounds, javafx.geometry.Point2D positionFactors)Returns the point within the given bounds computed using the givenpositionFactors.The x-component of the returned point is computed using:
x = bounds.x + positionFactors.x * bounds.widthand analogously the y-component of the returned point is computed using:
y = bounds.y + positionFactors.y * bounds.height- Parameters:
bounds- the given boundspositionFactors- aPoint2Dobject whose x and y values represent percentages (0.0 = 0% and 1.0 = 100%). As an example, an x value of 0 will returnBounds.getMinX(), 1.0 will returnBounds.getMaxX(), and 0.5 will returnbounds.getMinX() + (bounds.getWidth() * positionFactors.getX().- Returns:
- the point somewhere within the given bounds whose x and y values are determined by the given
positionFactors.
-
computePositionFactors
public static javafx.geometry.Point2D computePositionFactors(javafx.geometry.Pos position)
Computes the width/height factors for the point defined by the givenposition.The width factor is returned in the x component and the height factor in the y component of the point. That is,
Pos.TOP_LEFThas a width and height factor of 0.0, whereasPos.BOTTOM_RIGHThas a width and height factor of 1.0.- Parameters:
position- the position to compute width/height factors for- Returns:
- a
Point2Dthat can be used as apositionFactorobject inatPositionFactors(Bounds, Point2D).
-
lerp
private static double lerp(double start, double distance, double factor)
-
computePositionX
private static double computePositionX(javafx.geometry.HPos hPos)
-
computePositionY
private static double computePositionY(javafx.geometry.VPos vPos)
-
-