Skip to main content

Home > blockly > utils > Rect

utils.Rect class

Class for representing rectangular regions.

Signature:

export declare class Rect 

Constructors

ConstructorModifiersDescription
(constructor)(top, bottom, left, right)Constructs a new instance of the Rect class

Properties

PropertyModifiersTypeDescription
bottomnumber
leftnumber
rightnumber
topnumber

Methods

MethodModifiersDescription
clone()Creates a new copy of this rectangle.
contains(x, y)Tests whether this rectangle contains a x/y coordinate.
createFromPoint(position, width, height)staticCreates a new Rect using a position and supplied dimensions.
equals(a, b)staticCompares bounding rectangles for equality.
from(rect)staticConverts a DOM or SVG Rect to a Blockly Rect.
getHeight()Returns the height of this rectangle.
getOrigin()Returns the top left coordinate of this rectangle.
getWidth()Returns the width of this rectangle.
intersects(other)Tests whether this rectangle intersects the provided rectangle. Assumes that the coordinate system increases going down and left.