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
18 * <p>This is a layout that inherits the anchoring of <b>{@link Ext.layout.container.Anchor}</b> and adds the
19 * ability for x/y positioning using the standard x and y component config options.</p>
20 * <p>This class is intended to be extended or created via the <tt><b>{@link Ext.container.Container#layout layout}</b></tt>
21 * configuration property. See <tt><b>{@link Ext.container.Container#layout}</b></tt> for additional details.</p>
22 * {@img Ext.layout.container.Absolute/Ext.layout.container.Absolute.png Ext.layout.container.Absolute container layout}
23 * <p>Example usage:</p>
25 Ext.create('Ext.form.Panel', {
26 title: 'Absolute Layout',
31 // layout-specific configs go here
32 //itemCls: 'x-abs-layout-item',
35 defaultType: 'textfield',
45 anchor:'90%' // anchor width by percentage
55 anchor: '90%' // anchor width by percentage
59 xtype: 'textareafield',
61 anchor: '100% 100%' // anchor width and height
63 renderTo: Ext.getBody()
68 Ext.define('Ext.layout.container.Absolute', {
70 /* Begin Definitions */
72 alias: 'layout.absolute',
73 extend: 'Ext.layout.container.Anchor',
74 requires: ['Ext.chart.axis.Axis', 'Ext.fx.Anim'],
75 alternateClassName: 'Ext.layout.AbsoluteLayout',
79 itemCls: Ext.baseCSSPrefix + 'abs-layout-item',
83 onLayout: function() {
85 target = me.getTarget(),
86 targetIsBody = target.dom === document.body;
88 // Do not set position: relative; when the absolute layout target is the body
92 me.paddingLeft = target.getPadding('l');
93 me.paddingTop = target.getPadding('t');
94 me.callParent(arguments);
98 adjustWidthAnchor: function(value, comp) {
99 //return value ? value - comp.getPosition(true)[0] + this.paddingLeft: value;
100 return value ? value - comp.getPosition(true)[0] : value;
104 adjustHeightAnchor: function(value, comp) {
105 //return value ? value - comp.getPosition(true)[1] + this.paddingTop: value;
106 return value ? value - comp.getPosition(true)[1] : value;