FitAllLayout.js
1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
This file is part of Ext JS 4
Copyright (c) 2011 Sencha Inc
Contact: http://www.sencha.com/contact
GNU General Public License Usage
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.
If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
*/
/*!
* Ext JS Library 4.0
* Copyright(c) 2006-2011 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.ux.desktop.FitAllLayout
* @extends Ext.layout.container.AbstractFit
* <p>This layout applies a "fit" layout to all items, overlaying them on top of each
* other.</p>
*/
Ext.define('Ext.ux.desktop.FitAllLayout', {
extend: 'Ext.layout.container.AbstractFit',
alias: 'layout.fitall',
// @private
onLayout : function() {
var me = this;
me.callParent();
var size = me.getLayoutTargetSize();
me.owner.items.each(function (item) {
me.setItemBox(item, size);
});
},
getTargetBox : function() {
return this.getLayoutTargetSize();
},
setItemBox : function(item, box) {
var me = this;
if (item && box.height > 0) {
if (item.layoutManagedWidth == 2) {
box.width = undefined;
}
if (item.layoutManagedHeight == 2) {
box.height = undefined;
}
item.getEl().position('absolute', null, 0, 0);
me.setItemSize(item, box.width, box.height);
}
}
});