Regions
Ojay comes with a class called Ojay.Region, which is a decorator
for the YAHOO.util.Region class.
It is used to represent the area occupied by an element on a web page. All region objects
have four properties: top, bottom, left and right, which specify the edges of the
rectangle containing the element, measured in pixels. All dimensions returned by region
objects are in pixels.
Required files
http://yui.yahooapis.com/2.7.0/build/yahoo-dom-event/yahoo-dom-event.jshttp://yui.yahooapis.com/2.7.0/build/selector/selector-beta.jshttp://yoursite.com/ojay/js-class.jshttp://yoursite.com/ojay/core.js
Region API
Region objects are returned by the Ojay('#myElement').getRegion() method. Region objects
have the following methods:
getWidth()– returns the width of the regiongetHeight()– returns the height of the regiongetDiagonal()– returns the diagonal length of the regiongetArea()– returns the area of the region in square pixelsgetCenter()– returns an object withleftandtopproperties describing the center of the region.contains(region)– returnstrueiff the receiver completely containsregion.intersects(region)– returnstrueiff the receiver overlapsregion.intersection(region)– returns the region occupied by both the receiver andregion.union(region)– returns the region that just contains both the receiver andregion.
