Class WRectF

java.lang.Object

public class WRectF
extends WJavaScriptExposableObject
A value class that defines a rectangle.

The rectangle is defined by a top-left point and a width and height.

JavaScript exposability

A WRectF is JavaScript exposable. If a WRectF is JavaScript bound, it can be accessed in your custom JavaScript code through its handle's jsRef(). A rectangle is represented in JavaScript as an array of four elements (x,y,width,height), e.g. a rectangle WRectF(10,20,30,40) will be represented in JavaScript as:


 [10, 20, 30, 40]

 

Warning: A WRectF that is JavaScript exposed should be modified only through its handle. Any attempt at modifying it will cause an exception to be thrown.

See Also:
WPaintedWidget.createJSRect()
  • Constructor Details

    • WRectF

      public WRectF()
      Default constructor.

      Constructs an empty rectangle.

      See Also:
      isEmpty()
    • WRectF

      public WRectF​(double x, double y, double width, double height)
      Creates a rectangle.

      Constructs a rectangle with top left point (x, y) and size width x height.

    • WRectF

      public WRectF​(WRectF other)
    • WRectF

      public WRectF​(WPointF topLeft, WPointF bottomRight)
      Creates a rectangle.

      Constructs a rectangle from the two points topLeft and bottomRight .

      If you want to create a rectangle from two arbitrary corner points, you can use this constructor too, but should call getNormalized() afterwords.

  • Method Details