Class YAHOO.util.Region

Object
   |
   +--YAHOO.util.Region

class YAHOO.util.Region

A region is a representation of an object on a grid. It is defined by the top, right, bottom, left extents, so is rectangular by default. If other shapes are required, this class could be extended to support it.

Field Summary [top]

int bottom
The region's bottom extent 
int left
The region's left extent 
int right
The region's right extent 
int top
The region's top extent 

Constructor Summary [top]

YAHOO.util.Region
A region is a representation of an object on a grid. 

Method Summary [top]

boolean contains (<Region> region)
Returns true if this region contains the region passed in 
int getArea ()
Returns the area of the region 
Region intersect (<Region> region)
Returns the region where the passed in region overlaps with this one 
Object toString ()
toString 
Region union (<Region> region)
Returns the region representing the smallest region that can contain both the passed in region and this region. 
Region getRegion (<HTMLElement> el)
Returns a region that is occupied by the DOM element 

Field Detail [top]

bottom

int   bottom
The region's bottom extent

left

int   left
The region's left extent

right

int   right
The region's right extent

top

int   top
The region's top extent

Constructor Detail [top]

YAHOO.util.Region

YAHOO.util.Region ()
A region is a representation of an object on a grid. It is defined by the top, right, bottom, left extents, so is rectangular by default. If other shapes are required, this class could be extended to support it.
Parameters:
t - the top extent
r - the right extent
b - the bottom extent
l - the left extent

Method Detail [top]

contains

boolean contains (<Region> region)
Returns true if this region contains the region passed in
Parameters:
region - The region to evaluate
Returns:
True if the region is contained with this region, else false

getArea

int getArea ()
Returns the area of the region
Returns:
the region's area

intersect

Region intersect (<Region> region)
Returns the region where the passed in region overlaps with this one
Parameters:
region - The region that intersects
Returns:
The overlap region, or null if there is no overlap

toString

Object toString ()
toString
Returns:
string the region properties

union

Region union (<Region> region)
Returns the region representing the smallest region that can contain both the passed in region and this region.
Parameters:
region - The region that to create the union with
Returns:
The union region

getRegion

Region getRegion (<HTMLElement> el)
Returns a region that is occupied by the DOM element
Parameters:
el - The element
Returns:
The region that the element occupies