Upgrade to ExtJS 4.0.7 - Released 10/19/2011
[extjs.git] / docs / source / Region.html
index c5164a0..fa64325 100644 (file)
@@ -3,8 +3,8 @@
 <head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <title>The source code</title>
-  <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
-  <script type="text/javascript" src="../prettify/prettify.js"></script>
+  <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
+  <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
   <style type="text/css">
     .highlight { display: block; background-color: #ddd; }
   </style>
 </head>
 <body onload="prettyPrint(); highlight();">
   <pre class="prettyprint lang-js"><span id='Ext-util-Region'>/**
-</span> * @class Ext.util.Region
- * @extends Object
+</span> * This class represents a rectangular region in X,Y space, and performs geometric
+ * transformations or tests upon the region.
  *
- * Represents a rectangular region and provides a number of utility methods
- * to compare regions.
+ * This class may be used to compare the document regions occupied by elements.
  */
-
 Ext.define('Ext.util.Region', {
 
     /* Begin Definitions */
@@ -30,21 +28,21 @@ Ext.define('Ext.util.Region', {
     requires: ['Ext.util.Offset'],
 
     statics: {
-<span id='Ext-util-Region-method-getRegion'>        /**
+<span id='Ext-util-Region-static-method-getRegion'>        /**
 </span>         * @static
-         * @param {Mixed} el A string, DomElement or Ext.core.Element representing an element
-         * on the page.
-         * @returns {Ext.util.Region} region
          * Retrieves an Ext.util.Region for a particular element.
+         * @param {String/HTMLElement/Ext.Element} el An element ID, htmlElement or Ext.Element representing an element in the document.
+         * @returns {Ext.util.Region} region
          */
         getRegion: function(el) {
             return Ext.fly(el).getPageBox(true);
         },
 
-<span id='Ext-util-Region-method-from'>        /**
+<span id='Ext-util-Region-static-method-from'>        /**
 </span>         * @static
-         * @param {Object} o An object with top, right, bottom, left properties
-         * @return {Ext.util.Region} region The region constructed based on the passed object
+         * Creates a Region from a &quot;box&quot; Object which contains four numeric properties `top`, `right`, `bottom` and `left`.
+         * @param {Object} o An object with `top`, `right`, `bottom` and `left` properties.
+         * @return {Ext.util.Region} region The Region constructed based on the passed object
          */
         from: function(o) {
             return new this(o.top, o.right, o.bottom, o.left);
@@ -54,11 +52,11 @@ Ext.define('Ext.util.Region', {
     /* End Definitions */
 
 <span id='Ext-util-Region-method-constructor'>    /**
-</span>     * @constructor
-     * @param {Number} top Top
-     * @param {Number} right Right
-     * @param {Number} bottom Bottom
-     * @param {Number} left Left
+</span>     * Creates a region from the bounding sides.
+     * @param {Number} top Top The topmost pixel of the Region.
+     * @param {Number} right Right The rightmost pixel of the Region.
+     * @param {Number} bottom Bottom The bottom pixel of the Region.
+     * @param {Number} left Left The leftmost pixel of the Region.
      */
     constructor : function(t, r, b, l) {
         var me = this;
@@ -71,6 +69,7 @@ Ext.define('Ext.util.Region', {
 <span id='Ext-util-Region-method-contains'>    /**
 </span>     * Checks if this region completely contains the region that is passed in.
      * @param {Ext.util.Region} region
+     * @return {Boolean}
      */
     contains : function(region) {
         var me = this;
@@ -104,6 +103,7 @@ Ext.define('Ext.util.Region', {
 <span id='Ext-util-Region-method-union'>    /**
 </span>     * Returns the smallest region that contains the current AND targetRegion.
      * @param {Ext.util.Region} region
+     * @return {Ext.util.Region} a new region
      */
     union : function(region) {
         var me = this,
@@ -118,6 +118,7 @@ Ext.define('Ext.util.Region', {
 <span id='Ext-util-Region-method-constrainTo'>    /**
 </span>     * Modifies the current region to be constrained to the targetRegion.
      * @param {Ext.util.Region} targetRegion
+     * @return {Ext.util.Region} this
      */
     constrainTo : function(r) {
         var me = this,
@@ -135,6 +136,7 @@ Ext.define('Ext.util.Region', {
      * @param {Number} right right offset
      * @param {Number} bottom bottom offset
      * @param {Number} left left offset
+     * @return {Ext.util.Region} this
      */
     adjust : function(t, r, b, l) {
         var me = this;
@@ -147,8 +149,8 @@ Ext.define('Ext.util.Region', {
 
 <span id='Ext-util-Region-method-getOutOfBoundOffset'>    /**
 </span>     * Get the offset amount of a point outside the region
-     * @param {String} axis optional
-     * @param {Ext.util.Point} p the point
+     * @param {String} [axis]
+     * @param {Ext.util.Point} [p] the point
      * @return {Ext.util.Offset}
      */
     getOutOfBoundOffset: function(axis, p) {
@@ -200,8 +202,8 @@ Ext.define('Ext.util.Region', {
 
 <span id='Ext-util-Region-method-isOutOfBound'>    /**
 </span>     * Check whether the point / offset is out of bound
-     * @param {String} axis optional
-     * @param {Ext.util.Point/Number} p the point / offset
+     * @param {String} [axis]
+     * @param {Ext.util.Point/Number} [p] the point / offset
      * @return {Boolean}
      */
     isOutOfBound: function(axis, p) {
@@ -235,12 +237,13 @@ Ext.define('Ext.util.Region', {
         return (p &lt; this.y || p &gt; this.bottom);
     },
 
-    /*
-     * Restrict a point within the region by a certain factor.
-     * @param {String} axis Optional
-     * @param {Ext.util.Point/Ext.util.Offset/Object} p
-     * @param {Number} factor
+<span id='Ext-util-Region-method-restrict'>    /**
+</span>     * Restrict a point within the region by a certain factor.
+     * @param {String} [axis]
+     * @param {Ext.util.Point/Ext.util.Offset/Object} [p]
+     * @param {Number} [factor]
      * @return {Ext.util.Point/Ext.util.Offset/Object/Number}
+     * @private
      */
     restrict: function(axis, p, factor) {
         if (Ext.isObject(axis)) {
@@ -271,11 +274,12 @@ Ext.define('Ext.util.Region', {
         }
     },
 
-    /*
-     * Restrict an offset within the region by a certain factor, on the x-axis
+<span id='Ext-util-Region-method-restrictX'>    /**
+</span>     * Restrict an offset within the region by a certain factor, on the x-axis
      * @param {Number} p
-     * @param {Number} factor The factor, optional, defaults to 1
-     * @return
+     * @param {Number} [factor=1] The factor.
+     * @return {Number}
+     * @private
      */
     restrictX : function(p, factor) {
         if (!factor) {
@@ -291,10 +295,12 @@ Ext.define('Ext.util.Region', {
         return p;
     },
 
-    /*
-     * Restrict an offset within the region by a certain factor, on the y-axis
+<span id='Ext-util-Region-method-restrictY'>    /**
+</span>     * Restrict an offset within the region by a certain factor, on the y-axis
      * @param {Number} p
-     * @param {Number} factor The factor, optional, defaults to 1
+     * @param {Number} [factor] The factor, defaults to 1
+     * @return {Number}
+     * @private
      */
     restrictY : function(p, factor) {
         if (!factor) {
@@ -310,9 +316,10 @@ Ext.define('Ext.util.Region', {
         return p;
     },
 
-    /*
-     * Get the width / height of this region
+<span id='Ext-util-Region-method-getSize'>    /**
+</span>     * Get the width / height of this region
      * @return {Object} an object with width and height properties
+     * @private
      */
     getSize: function() {
         return {
@@ -322,7 +329,7 @@ Ext.define('Ext.util.Region', {
     },
 
 <span id='Ext-util-Region-method-copy'>    /**
-</span>     * Copy a new instance
+</span>     * Create a copy of this Region.
      * @return {Ext.util.Region}
      */
     copy: function() {
@@ -331,8 +338,8 @@ Ext.define('Ext.util.Region', {
 
 <span id='Ext-util-Region-method-copyFrom'>    /**
 </span>     * Copy the values of another Region to this Region
-     * @param {Region} The region to copy from.
-     * @return {Ext.util.Point} this This point
+     * @param {Ext.util.Region} p The region to copy from.
+     * @return {Ext.util.Region} This Region
      */
     copyFrom: function(p) {
         var me = this;
@@ -344,20 +351,19 @@ Ext.define('Ext.util.Region', {
         return this;
     },
 
-<span id='Ext-util-Region-method-toString'>    /**
-</span>     * Dump this to an eye-friendly string, great for debugging
+    /*
+     * Dump this to an eye-friendly string, great for debugging
      * @return {String}
      */
     toString: function() {
         return &quot;Region[&quot; + this.top + &quot;,&quot; + this.right + &quot;,&quot; + this.bottom + &quot;,&quot; + this.left + &quot;]&quot;;
     },
 
-
 <span id='Ext-util-Region-method-translateBy'>    /**
 </span>     * Translate this region by the given offset amount
-     * @param {Ext.util.Offset/Object} offset Object containing the &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; properties.
+     * @param {Ext.util.Offset/Object} x Object containing the `x` and `y` properties.
      * Or the x value is using the two argument form.
-     * @param {Number} The y value unless using an Offset object.
+     * @param {Number} The y value unless using an Offset object.
      * @return {Ext.util.Region} this This Region
      */
     translateBy: function(x, y) {