+
+<span id='Ext-Element-method-getBox'> /**
+</span> * Return an object defining the area of this Element which can be passed to {@link #setBox} to
+ * set another Element's size/location to match this element.
+ * @param {Boolean} contentBox (optional) If true a box for the content of the element is returned.
+ * @param {Boolean} local (optional) If true the element's left and top are returned instead of page x/y.
+ * @return {Object} box An object in the format<pre><code>
+{
+ x: &lt;Element's X position>,
+ y: &lt;Element's Y position>,
+ width: &lt;Element's width>,
+ height: &lt;Element's height>,
+ bottom: &lt;Element's lower bound>,
+ right: &lt;Element's rightmost bound>
+}
+</code></pre>
+ * The returned object may also be addressed as an Array where index 0 contains the X position
+ * and index 1 contains the Y position. So the result may also be used for {@link #setXY}
+ */
+ getBox: function(contentBox, local) {
+ var me = this,
+ xy,
+ left,
+ top,
+ getBorderWidth = me.getBorderWidth,
+ getPadding = me.getPadding,
+ l, r, t, b, w, h, bx;
+ if (!local) {
+ xy = me.getXY();
+ } else {
+ left = parseInt(me.getStyle("left"), 10) || 0;
+ top = parseInt(me.getStyle("top"), 10) || 0;
+ xy = [left, top];
+ }
+ w = me.getWidth();
+ h = me.getHeight();
+ if (!contentBox) {
+ bx = {
+ x: xy[0],
+ y: xy[1],
+ 0: xy[0],
+ 1: xy[1],
+ width: w,
+ height: h
+ };
+ } else {
+ l = getBorderWidth.call(me, "l") + getPadding.call(me, "l");
+ r = getBorderWidth.call(me, "r") + getPadding.call(me, "r");
+ t = getBorderWidth.call(me, "t") + getPadding.call(me, "t");
+ b = getBorderWidth.call(me, "b") + getPadding.call(me, "b");
+ bx = {
+ x: xy[0] + l,
+ y: xy[1] + t,
+ 0: xy[0] + l,
+ 1: xy[1] + t,
+ width: w - (l + r),
+ height: h - (t + b)
+ };
+ }
+ bx.right = bx.x + bx.width;
+ bx.bottom = bx.y + bx.height;
+ return bx;
+ },
+
+<span id='Ext-Element-method-move'> /**
+</span> * Move this element relative to its current position.
+ * @param {String} direction Possible values are: "l" (or "left"), "r" (or "right"), "t" (or "top", or "up"), "b" (or "bottom", or "down").
+ * @param {Number} distance How far to move the element in pixels
+ * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
+ */
+ move: function(direction, distance, animate) {
+ var me = this,
+ xy = me.getXY(),
+ x = xy[0],
+ y = xy[1],
+ left = [x - distance, y],
+ right = [x + distance, y],
+ top = [x, y - distance],
+ bottom = [x, y + distance],
+ hash = {
+ l: left,
+ left: left,
+ r: right,
+ right: right,
+ t: top,
+ top: top,
+ up: top,
+ b: bottom,
+ bottom: bottom,
+ down: bottom
+ };
+
+ direction = direction.toLowerCase();
+ me.moveTo(hash[direction][0], hash[direction][1], animate);
+ },
+
+<span id='Ext-Element-method-setLeftTop'> /**
+</span> * Quick set left and top adding default units
+ * @param {String} left The left CSS property value
+ * @param {String} top The top CSS property value
+ * @return {Ext.Element} this
+ */
+ setLeftTop: function(left, top) {
+ var me = this,
+ style = me.dom.style;
+ style.left = me.addUnits(left);
+ style.top = me.addUnits(top);
+ return me;
+ },
+
+<span id='Ext-Element-method-getRegion'> /**
+</span> * Returns the region of this element.
+ * The element must be part of the DOM tree to have a region (display:none or elements not appended return false).
+ * @return {Ext.util.Region} A Region containing "top, left, bottom, right" member data.
+ */
+ getRegion: function() {
+ return this.getPageBox(true);
+ },
+
+<span id='Ext-Element-method-getViewRegion'> /**
+</span> * Returns the <b>content</b> region of this element. That is the region within the borders and padding.
+ * @return {Ext.util.Region} A Region containing "top, left, bottom, right" member data.
+ */
+ getViewRegion: function() {
+ var me = this,
+ isBody = me.dom === document.body,
+ scroll, pos, top, left, width, height;
+
+ // For the body we want to do some special logic
+ if (isBody) {
+ scroll = me.getScroll();
+ left = scroll.left;
+ top = scroll.top;
+ width = Ext.Element.getViewportWidth();
+ height = Ext.Element.getViewportHeight();
+ }
+ else {
+ pos = me.getXY();
+ left = pos[0] + me.getBorderWidth('l') + me.getPadding('l');
+ top = pos[1] + me.getBorderWidth('t') + me.getPadding('t');
+ width = me.getWidth(true);
+ height = me.getHeight(true);
+ }
+
+ return Ext.create('Ext.util.Region', top, left + width, top + height, left);
+ },
+
+<span id='Ext-Element-method-getPageBox'> /**
+</span> * Return an object defining the area of this Element which can be passed to {@link #setBox} to
+ * set another Element's size/location to match this element.
+ * @param {Boolean} asRegion(optional) If true an Ext.util.Region will be returned
+ * @return {Object} box An object in the format<pre><code>
+{
+ x: &lt;Element's X position>,
+ y: &lt;Element's Y position>,
+ width: &lt;Element's width>,
+ height: &lt;Element's height>,
+ bottom: &lt;Element's lower bound>,
+ right: &lt;Element's rightmost bound>
+}
+</code></pre>
+ * The returned object may also be addressed as an Array where index 0 contains the X position
+ * and index 1 contains the Y position. So the result may also be used for {@link #setXY}
+ */
+ getPageBox : function(getRegion) {
+ var me = this,
+ el = me.dom,
+ isDoc = el === document.body,
+ w = isDoc ? Ext.Element.getViewWidth() : el.offsetWidth,
+ h = isDoc ? Ext.Element.getViewHeight() : el.offsetHeight,
+ xy = me.getXY(),
+ t = xy[1],
+ r = xy[0] + w,
+ b = xy[1] + h,
+ l = xy[0];
+
+ if (getRegion) {
+ return Ext.create('Ext.util.Region', t, r, b, l);
+ }
+ else {
+ return {
+ left: l,
+ top: t,
+ width: w,
+ height: h,
+ right: r,
+ bottom: b
+ };
+ }
+ },
+
+<span id='Ext-Element-method-setBounds'> /**
+</span> * Sets the element's position and size in one shot. If animation is true then width, height, x and y will be animated concurrently.
+ * @param {Number} x X value for new position (coordinates are page-based)
+ * @param {Number} y Y value for new position (coordinates are page-based)
+ * @param {Number/String} width The new width. This may be one of:<div class="mdetail-params"><ul>
+ * <li>A Number specifying the new width in this Element's {@link #defaultUnit}s (by default, pixels)</li>
+ * <li>A String used to set the CSS width style. Animation may <b>not</b> be used.
+ * </ul></div>
+ * @param {Number/String} height The new height. This may be one of:<div class="mdetail-params"><ul>
+ * <li>A Number specifying the new height in this Element's {@link #defaultUnit}s (by default, pixels)</li>
+ * <li>A String used to set the CSS height style. Animation may <b>not</b> be used.</li>
+ * </ul></div>
+ * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
+ * @return {Ext.Element} this
+ */
+ setBounds: function(x, y, width, height, animate) {
+ var me = this;
+ if (!animate || !me.anim) {
+ me.setSize(width, height);
+ me.setLocation(x, y);
+ } else {
+ if (!Ext.isObject(animate)) {
+ animate = {};
+ }
+ me.animate(Ext.applyIf({
+ to: {
+ x: x,
+ y: y,
+ width: me.adjustWidth(width),
+ height: me.adjustHeight(height)
+ }
+ }, animate));
+ }
+ return me;
+ },
+
+<span id='Ext-Element-method-setRegion'> /**
+</span> * Sets the element's position and size the specified region. If animation is true then width, height, x and y will be animated concurrently.
+ * @param {Ext.util.Region} region The region to fill
+ * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
+ * @return {Ext.Element} this
+ */
+ setRegion: function(region, animate) {
+ return this.setBounds(region.left, region.top, region.right - region.left, region.bottom - region.top, animate);