Print Friendly

Class YAHOO.util.Region

Package:YAHOO.util
Class:Region
Extends:Object
Subclasses:Point
Defined In:dom.js
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.

Public Properties

Property Defined By
  bottom : Int Region
The region's bottom extent
  left : Int Region
The region's left extent
  right : int Region
The region's right extent
  1 : Int Region
The region's top extent as index, for symmetry with set/getXY
  top : Int Region
The region's top extent

Public Methods

Method Defined By
  Region() Region
  contains(Region region) : Boolean Region
Returns true if this region contains the region passed in
  getArea() : Int Region
Returns the area of the region
  getRegion(HTMLElement el) : Region Region
<static> Returns a region that is occupied by the DOM element
  intersect(Region region) : Region Region
Returns the region where the passed in region overlaps with this one
  toString() : string Region
toString
  union(Region region) : Region Region
Returns the region representing the smallest region that can contain both the passed in region and this region.

Public Events

This class has no public events.

Property Details

bottom

public Int bottom
The region's bottom extent
This property is defined by Region.

left

public Int left
The region's left extent
This property is defined by Region.

right

public int right
The region's right extent
This property is defined by Region.

1

public Int 1
The region's top extent as index, for symmetry with set/getXY
This property is defined by Region.

top

public Int top
The region's top extent
This property is defined by Region.

Constructor Details

Region

public function Region()
Parameters:
  • None.

Method Details

contains

public function contains(Region region)
Returns true if this region contains the region passed in
Parameters:
  • region : Region
    The region to evaluate
Returns:
  • Boolean
    True if the region is contained with this region, else false
This method is defined by Region.

getArea

public function getArea()
Returns the area of the region
Parameters:
  • None.
Returns:
  • Int
    the region's area
This method is defined by Region.

getRegion

public function getRegion(HTMLElement el)
<static> Returns a region that is occupied by the DOM element
Parameters:
  • el : HTMLElement
    The element
Returns:
  • Region
    The region that the element occupies
This method is defined by Region.

intersect

public function intersect(Region region)
Returns the region where the passed in region overlaps with this one
Parameters:
  • region : Region
    The region that intersects
Returns:
  • Region
    The overlap region, or null if there is no overlap
This method is defined by Region.

toString

public function toString()
toString
Parameters:
  • None.
Returns:
  • string
    the region properties
This method is defined by Region.

union

public function union(Region region)
Returns the region representing the smallest region that can contain both the passed in region and this region.
Parameters:
  • region : Region
    The region that to create the union with
Returns:
  • Region
    The union region
This method is defined by Region.

yui-ext - Copyright © 2006 Jack Slocum. | Yahoo! UI - Copyright © 2006 Yahoo! Inc.
All rights reserved.