Upgrade to ExtJS 4.0.7 - Released 10/19/2011
[extjs.git] / docs / source / Element.alignment.html
index 29acc83..1a6b3b2 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>
   </script>
 </head>
 <body onload="prettyPrint(); highlight();">
-  <pre class="prettyprint lang-js"><span id='Ext-core-Element'>/**
-</span> * @class Ext.core.Element
+  <pre class="prettyprint lang-js"><span id='Ext-Element'>/**
+</span> * @class Ext.Element
  */
-Ext.core.Element.addMethods({
-<span id='Ext-core-Element-method-getAnchorXY'>    /**
+Ext.Element.addMethods({
+<span id='Ext-Element-method-getAnchorXY'>    /**
 </span>     * Gets the x,y coordinates specified by the anchor position on the element.
-     * @param {String} anchor (optional) The specified anchor position (defaults to &quot;c&quot;).  See {@link #alignTo}
+     * @param {String} [anchor='c'] The specified anchor position.  See {@link #alignTo}
      * for details on supported anchor positions.
-     * @param {Boolean} local (optional) True to get the local (element top/left-relative) anchor position instead
+     * @param {Boolean} [local] True to get the local (element top/left-relative) anchor position instead
      * of page coordinates
-     * @param {Object} size (optional) An object containing the size to use for calculating anchor position
+     * @param {Object} [size] An object containing the size to use for calculating anchor position
      * {width: (target width), height: (target height)} (defaults to the element's current size)
-     * @return {Array} [x, y] An array containing the element's x and y coordinates
+     * @return {Number[]} [x, y] An array containing the element's x and y coordinates
      */
     getAnchorXY : function(anchor, local, s){
         //Passing a different size is useful for pre-calculating anchors,
@@ -37,8 +37,8 @@ Ext.core.Element.addMethods({
 
         var me = this,
             vp = me.dom == document.body || me.dom == document,
-            w = s.width || vp ? Ext.core.Element.getViewWidth() : me.getWidth(),
-            h = s.height || vp ? Ext.core.Element.getViewHeight() : me.getHeight(),
+            w = s.width || vp ? Ext.Element.getViewWidth() : me.getWidth(),
+            h = s.height || vp ? Ext.Element.getViewHeight() : me.getHeight(),
             xy,
             r = Math.round,
             o = me.getXY(),
@@ -61,16 +61,16 @@ Ext.core.Element.addMethods({
         return [xy[0] + extraX, xy[1] + extraY];
     },
 
-<span id='Ext-core-Element-method-anchorTo'>    /**
+<span id='Ext-Element-method-anchorTo'>    /**
 </span>     * Anchors an element to another element and realigns it when the window is resized.
-     * @param {Mixed} element The element to align to.
+     * @param {String/HTMLElement/Ext.Element} element The element to align to.
      * @param {String} position The position to align to.
-     * @param {Array} offsets (optional) Offset the positioning by [x, y]
-     * @param {Boolean/Object} animate (optional) True for the default animation or a standard Element animation config object
-     * @param {Boolean/Number} monitorScroll (optional) True to monitor body scroll and reposition. If this parameter
+     * @param {Number[]} [offsets] Offset the positioning by [x, y]
+     * @param {Boolean/Object} [animate] True for the default animation or a standard Element animation config object
+     * @param {Boolean/Number} [monitorScroll] True to monitor body scroll and reposition. If this parameter
      * is a number, it is used as the buffer delay (defaults to 50ms).
-     * @param {Function} callback The function to call after the animation finishes
-     * @return {Ext.core.Element} this
+     * @param {Function} [callback] The function to call after the animation finishes
+     * @return {Ext.Element} this
      */
     anchorTo : function(el, alignment, offsets, animate, monitorScroll, callback){
         var me = this,
@@ -99,9 +99,9 @@ Ext.core.Element.addMethods({
         return me;
     },
 
-<span id='Ext-core-Element-method-removeAnchor'>    /**
+<span id='Ext-Element-method-removeAnchor'>    /**
 </span>     * Remove any anchor to this element. See {@link #anchorTo}.
-     * @return {Ext.core.Element} this
+     * @return {Ext.Element} this
      */
     removeAnchor : function(){
         var me = this,
@@ -119,7 +119,7 @@ Ext.core.Element.addMethods({
 
     // private
     getAnchor : function(){
-        var data = Ext.core.Element.data,
+        var data = Ext.Element.data,
             dom = this.dom;
             if (!dom) {
                 return;
@@ -142,7 +142,7 @@ Ext.core.Element.addMethods({
         if(!el || !el.dom){
             //&lt;debug&gt;
             Ext.Error.raise({
-                sourceClass: 'Ext.core.Element',
+                sourceClass: 'Ext.Element',
                 sourceMethod: 'getAlignVector',
                 msg: 'Attempted to align an element that doesn\'t exist'
             });
@@ -152,13 +152,13 @@ Ext.core.Element.addMethods({
         elRegion = el.getRegion();
     },
 
-<span id='Ext-core-Element-method-getAlignToXY'>    /**
+<span id='Ext-Element-method-getAlignToXY'>    /**
 </span>     * Gets the x,y coordinates to align this element with another element. See {@link #alignTo} for more info on the
      * supported position values.
-     * @param {Mixed} element The element to align to.
-     * @param {String} position (optional, defaults to &quot;tl-bl?&quot;) The position to align to.
-     * @param {Array} offsets (optional) Offset the positioning by [x, y]
-     * @return {Array} [x, y]
+     * @param {String/HTMLElement/Ext.Element} element The element to align to.
+     * @param {String} [position=&quot;tl-bl?&quot;] The position to align to (defaults to )
+     * @param {Number[]} [offsets] Offset the positioning by [x, y]
+     * @return {Number[]} [x, y]
      */
     getAlignToXY : function(el, p, o){
         el = Ext.get(el);
@@ -166,7 +166,7 @@ Ext.core.Element.addMethods({
         if(!el || !el.dom){
             //&lt;debug&gt;
             Ext.Error.raise({
-                sourceClass: 'Ext.core.Element',
+                sourceClass: 'Ext.Element',
                 sourceMethod: 'getAlignToXY',
                 msg: 'Attempted to align an element that doesn\'t exist'
             });
@@ -186,8 +186,8 @@ Ext.core.Element.addMethods({
             w,
             h,
             r,
-            dw = Ext.core.Element.getViewWidth() -10, // 10px of margin for ie
-            dh = Ext.core.Element.getViewHeight()-10, // 10px of margin for ie
+            dw = Ext.Element.getViewWidth() -10, // 10px of margin for ie
+            dh = Ext.Element.getViewHeight()-10, // 10px of margin for ie
             p1y,
             p1x,
             p2y,
@@ -207,7 +207,7 @@ Ext.core.Element.addMethods({
         if(!m){
             //&lt;debug&gt;
             Ext.Error.raise({
-                sourceClass: 'Ext.core.Element',
+                sourceClass: 'Ext.Element',
                 sourceMethod: 'getAlignToXY',
                 el: el,
                 position: p,
@@ -260,7 +260,7 @@ Ext.core.Element.addMethods({
         return [x,y];
     },
 
-<span id='Ext-core-Element-method-alignTo'>    /**
+<span id='Ext-Element-method-alignTo'>    /**
 </span>     * Aligns this element with another element relative to the specified anchor points. If the other element is the
      * document it aligns it to the viewport.
      * The position parameter is optional, and can be specified in any one of the following formats:
@@ -305,11 +305,11 @@ el.alignTo(&quot;other-el&quot;, &quot;br-l?&quot;);
 // adjust the x position by -6 pixels (and the y position by 0)
 el.alignTo(&quot;other-el&quot;, &quot;c-bl&quot;, [-6, 0]);
 &lt;/code&gt;&lt;/pre&gt;
-     * @param {Mixed} element The element to align to.
-     * @param {String} position (optional, defaults to &quot;tl-bl?&quot;) The position to align to.
-     * @param {Array} offsets (optional) Offset the positioning by [x, y]
-     * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
-     * @return {Ext.core.Element} this
+     * @param {String/HTMLElement/Ext.Element} element The element to align to.
+     * @param {String} [position=&quot;tl-bl?&quot;] The position to align to
+     * @param {Number[]} [offsets] Offset the positioning by [x, y]
+     * @param {Boolean/Object} [animate] true for the default animation or a standard Element animation config object
+     * @return {Ext.Element} this
      */
     alignTo : function(element, position, offsets, animate){
         var me = this;
@@ -327,7 +327,7 @@ el.alignTo(&quot;other-el&quot;, &quot;c-bl&quot;, [-6, 0]);
         return xy;
     },
 
-<span id='Ext-core-Element-method-getConstrainVector'>    /**
+<span id='Ext-Element-method-getConstrainVector'>    /**
 </span>     * &lt;p&gt;Returns the &lt;code&gt;[X, Y]&lt;/code&gt; vector by which this element must be translated to make a best attempt
      * to constrain within the passed constraint. Returns &lt;code&gt;false&lt;/code&gt; is this element does not need to be moved.&lt;/p&gt;
      * &lt;p&gt;Priority is given to constraining the top and left within the constraint.&lt;/p&gt;
@@ -336,7 +336,7 @@ el.alignTo(&quot;other-el&quot;, &quot;c-bl&quot;, [-6, 0]);
      * @param constrainTo {Mixed} The Element or {@link Ext.util.Region Region} into which this element is to be constrained.
      * @param proposedPosition {Array} A proposed &lt;code&gt;[X, Y]&lt;/code&gt; position to test for validity and to produce a vector for instead
      * of using this Element's current position;
-     * @returns {Array} &lt;b&gt;If&lt;/b&gt; this element &lt;i&gt;needs&lt;/i&gt; to be translated, an &lt;code&gt;[X, Y]&lt;/code&gt;
+     * @returns {Number[]/Boolean} &lt;b&gt;If&lt;/b&gt; this element &lt;i&gt;needs&lt;/i&gt; to be translated, an &lt;code&gt;[X, Y]&lt;/code&gt;
      * vector by which this element must be translated. Otherwise, &lt;code&gt;false&lt;/code&gt;.
      */
     getConstrainVector: function(constrainTo, proposedPosition) {
@@ -381,17 +381,17 @@ el.alignTo(&quot;other-el&quot;, &quot;c-bl&quot;, [-6, 0]);
         return overflowed ? vector : false;
     },
 
-<span id='Ext-core-Element-method-getCenterXY'>    /**
+<span id='Ext-Element-method-getCenterXY'>    /**
 </span>    * Calculates the x, y to center this element on the screen
-    * @return {Array} The x, y values [x, y]
+    * @return {Number[]} The x, y values [x, y]
     */
     getCenterXY : function(){
         return this.getAlignToXY(document, 'c-c');
     },
 
-<span id='Ext-core-Element-method-center'>    /**
+<span id='Ext-Element-method-center'>    /**
 </span>    * Centers the Element in either the viewport, or another Element.
-    * @param {Mixed} centerIn (optional) The element in which to center the element.
+    * @param {String/HTMLElement/Ext.Element} centerIn (optional) The element in which to center the element.
     */
     center : function(centerIn){
         return this.alignTo(centerIn || document, 'c-c');