4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-layout-container-Absolute'>/**
19 </span> * @class Ext.layout.container.Absolute
20 * @extends Ext.layout.container.Anchor
21 * <p>This is a layout that inherits the anchoring of <b>{@link Ext.layout.container.Anchor}</b> and adds the
22 * ability for x/y positioning using the standard x and y component config options.</p>
23 * <p>This class is intended to be extended or created via the <tt><b>{@link Ext.container.Container#layout layout}</b></tt>
24 * configuration property. See <tt><b>{@link Ext.container.Container#layout}</b></tt> for additional details.</p>
25 * {@img Ext.layout.container.Absolute/Ext.layout.container.Absolute.png Ext.layout.container.Absolute container layout}
26 * <p>Example usage:</p>
27 * <pre><code>
28 Ext.create('Ext.form.Panel', {
29 title: 'Absolute Layout',
34 // layout-specific configs go here
35 //itemCls: 'x-abs-layout-item',
38 defaultType: 'textfield',
48 anchor:'90%' // anchor width by percentage
58 anchor: '90%' // anchor width by percentage
62 xtype: 'textareafield',
64 anchor: '100% 100%' // anchor width and height
66 renderTo: Ext.getBody()
68 </code></pre>
71 Ext.define('Ext.layout.container.Absolute', {
73 /* Begin Definitions */
75 alias: 'layout.absolute',
76 extend: 'Ext.layout.container.Anchor',
77 requires: ['Ext.chart.axis.Axis', 'Ext.fx.Anim'],
78 alternateClassName: 'Ext.layout.AbsoluteLayout',
82 itemCls: Ext.baseCSSPrefix + 'abs-layout-item',
86 onLayout: function() {
88 target = me.getTarget(),
89 targetIsBody = target.dom === document.body;
91 // Do not set position: relative; when the absolute layout target is the body
95 me.paddingLeft = target.getPadding('l');
96 me.paddingTop = target.getPadding('t');
97 me.callParent(arguments);
101 adjustWidthAnchor: function(value, comp) {
102 //return value ? value - comp.getPosition(true)[0] + this.paddingLeft: value;
103 return value ? value - comp.getPosition(true)[0] : value;
107 adjustHeightAnchor: function(value, comp) {
108 //return value ? value - comp.getPosition(true)[1] + this.paddingTop: value;
109 return value ? value - comp.getPosition(true)[1] : value;