3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
16 * @class Ext.layout.container.Absolute
17 * @extends Ext.layout.container.Anchor
19 * This is a layout that inherits the anchoring of {@link Ext.layout.container.Anchor} and adds the
20 * ability for x/y positioning using the standard x and y component config options.
22 * This class is intended to be extended or created via the {@link Ext.container.Container#layout layout}
23 * configuration property. See {@link Ext.container.Container#layout} for additional details.
26 * Ext.create('Ext.form.Panel', {
27 * title: 'Absolute Layout',
32 * // layout-specific configs go here
33 * //itemCls: 'x-abs-layout-item',
35 * url:'save-form.php',
36 * defaultType: 'textfield',
46 * anchor:'90%' // anchor width by percentage
56 * anchor: '90%' // anchor width by percentage
60 * xtype: 'textareafield',
62 * anchor: '100% 100%' // anchor width and height
64 * renderTo: Ext.getBody()
67 Ext.define('Ext.layout.container.Absolute', {
69 /* Begin Definitions */
71 alias: 'layout.absolute',
72 extend: 'Ext.layout.container.Anchor',
73 alternateClassName: 'Ext.layout.AbsoluteLayout',
77 itemCls: Ext.baseCSSPrefix + 'abs-layout-item',
81 onLayout: function() {
83 target = me.getTarget(),
84 targetIsBody = target.dom === document.body;
86 // Do not set position: relative; when the absolute layout target is the body
90 me.paddingLeft = target.getPadding('l');
91 me.paddingTop = target.getPadding('t');
92 me.callParent(arguments);
96 adjustWidthAnchor: function(value, comp) {
97 //return value ? value - comp.getPosition(true)[0] + this.paddingLeft: value;
98 return value ? value - comp.getPosition(true)[0] : value;
102 adjustHeightAnchor: function(value, comp) {
103 //return value ? value - comp.getPosition(true)[1] + this.paddingTop: value;
104 return value ? value - comp.getPosition(true)[1] : value;