doodle.geom.createRectangle

Description:

Rectangle (x:number, y:number, width:number, height:number) :Rectangle

Inherits

  1. Object

Parameters

  1. x:number – [optional]
  2. y:number – [optional]
  3. width:number – [optional]
  4. height:number – [optional]

Returns

  • Rectangle –

Throws

  • TypeError –
  • SyntaxError –

Properties

bottom :number

Returns

  • number –

Throws

  • TypeError –
height :number

Returns

  • number –

Throws

  • TypeError –
left :number

Returns

  • number –

Throws

  • TypeError –
right :number

Returns

  • number –

Throws

  • TypeError –
top :number

Returns

  • number –

Throws

  • TypeError –
width :number

Returns

  • number –

Throws

  • TypeError –
x :number

Returns

  • number –

Throws

  • TypeError –
y :number

Returns

  • number –

Throws

  • TypeError –

Methods

union (rect:Rectangle) :Rectangle

Adds two rectangles together to create a new Rectangle object, by filling in the horizontal and vertical space between the two.

Parameters

  1. rect:Rectangle –

Returns

  • Rectangle –

Throws

  • TypeError –
offset (dx:number, dy:number) :Rectangle

Adjusts the location of the rectangle, as determined by its top-left corner, by the specified amounts.

Parameters

  1. dx:number –
  2. dy:number –

Returns

  • Rectangle –

Throws

  • TypeError –
isEmpty () :boolean

Determines whether or not this Rectangle object is empty.

Returns

  • boolean –
intersects (rect:Rectangle) :boolean

Determines whether the rectangle argument intersects with this rectangle.

Parameters

  1. rect:Rectangle –

Returns

  • boolean –

Throws

  • TypeError –
containsRect (rect:Rectangle) :boolean

Determines whether the rectangle argument is contained within this rectangle.

Parameters

  1. rect:Rectangle –

Returns

  • boolean –

Throws

  • TypeError –
equals (rect:Rectangle) :boolean

Determines whether the rectangle argument is equal to this rectangle.

Parameters

  1. rect:Rectangle –

Returns

  • boolean –

Throws

  • TypeError –
contains (x:number, y:number) :boolean

Determines whether the specified point is contained within the rectangular region defined by this Rectangle object.

Parameters

  1. x:number –
  2. y:number –

Returns

  • boolean –

Throws

  • TypeError –
containsPoint (pt:Point) :boolean

Determines whether the specified point is contained within this rectangle object.

Parameters

  1. pt:Point –

Returns

  • boolean –

Throws

  • TypeError –
intersection (rect:Rectangle) :Rectangle

If the rectangle argument intersects with this rectangle, returns the area of intersection as a Rectangle object. If the rectangles do not intersect, this method returns an empty Rectangle object with its properties set to 0.

Parameters

  1. rect:Rectangle –

Returns

  • Rectangle –

Throws

  • TypeError –
inflate (dx:number, dy:number) :Rectangle

Increases the size of the rectangle by the specified amounts, in pixels. The center point of the Rectangle object stays the same, and its size increases to the left and right by the dx value, and to the top and the bottom by the dy value.

Parameters

  1. dx:number –
  2. dy:number –

Returns

  • Rectangle –

Throws

  • TypeError –
clone () :Rectangle

Returns

  • Rectangle –
id () :string

Returns

  • string –
toArray () :Array

Returns

  • Array –
toString () :string

Returns

  • string –
compose (x:number, y:number, w:number, h:number) :Rectangle

Sets this rectangle's parameters.

Parameters

  1. x:number –
  2. y:number –
  3. w:number –
  4. h:number –

Returns

  • Rectangle –

Throws

  • TypeError –

Class Functions

isRect (rect:Rectangle) :boolean

Check if a given object contains a numeric rectangle properties including x, y, width, height, top, bottom, right, left. Does not check if a rectangle is actually a doodle.geom.rectangle.

Parameters

  1. rect:Rectangle – Object with numeric rectangle parameters.

Returns

  • boolean –