Class Index | File Index

Classes


Class Bounds


Extends Point.
Represents a Rectangular area with x,y coordinates as well as width, and height.
Defined in: Bounds.js.

// Creates a new Bounds object using standard JSON.
var myBounds = Bounds({x: 10, y: 10, w: 100, h: 100});
Alerts true
alert(myBounds.contains(Bounds({x: 15, y: 15})));
Alerts true
alert(myBounds.contains({x: 20, y: 20, w: 20, h: 20}));
Alerts false
alert(myBounds.contains({x: 20, y: 20, w: 100, h: 100}));
This example alerts false, because when width and height are supplied, the
given bounds must be completely within the 'myBounds' area.
// Using a Bounds object.
var myBounds = Bounds({x: 10, y: 10, w: 100, h: 100});
// alerts 10
alert(myBounds.x);
// alerts 200
alerts(myBounds.w * myBounds.h);
Class Summary
Constructor Attributes Constructor Name and Description
 
Bounds(_bounds)
Field Summary
Field Attributes Field Name and Description
 
h
Height
 
w
Width
Fields borrowed from class Point:
details, x, y
Method Summary
Method Attributes Method Name and Description
 
contains(_bounds)
Checks to see if the given Bounds object is within this bounds object.
Methods borrowed from class Point:
extend
Class Detail
Bounds(_bounds)

Author: Eric Berry.
Parameters:
{Bounds|Point|Object} _bounds
Another Bounds object, or Point object. Can be created using this function or created with a JSON Object containing the following attributes:
Property Required Default
x yes
y yes
w yes
h yes
Field Detail
h
Height

w
Width
Method Detail
contains(_bounds)
Checks to see if the given Bounds object is within this bounds object. This function works with Point objects as well. Meaning that if you pass it an object with only x, and y coordinates, it only checks to see if they are within this bounds.
Parameters:
_bounds

Documentation generated by JsDoc Toolkit 2.3.0 on Fri Oct 30 2009 09:09:10 GMT-0700 (PDT)