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);
Constructor Attributes | Constructor Name and Description |
---|---|
Bounds(_bounds)
|
Field Attributes | Field Name and Description |
---|---|
Height
|
|
Width
|
Method Attributes | Method Name and Description |
---|---|
contains(_bounds)
Checks to see if the given Bounds object is within this
bounds object.
|
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