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-Fit'>/**
19 </span> * @class Ext.layout.container.Fit
20 * @extends Ext.layout.container.AbstractFit
21 * <p>This is a base class for layouts that contain <b>a single item</b> that automatically expands to fill the layout's
22 * container. This class is intended to be extended or created via the <tt>layout:'fit'</tt> {@link Ext.container.Container#layout}
23 * config, and should generally not need to be created directly via the new keyword.</p>
24 * <p>FitLayout does not have any direct config options (other than inherited ones). To fit a panel to a container
25 * using FitLayout, simply set layout:'fit' on the container and add a single panel to it. If the container has
26 * multiple panels, only the first one will be displayed.
27 * {@img Ext.layout.container.Fit/Ext.layout.container.Fit.png Ext.layout.container.Fit container layout}
28 * Example usage:</p>
29 * <pre><code>
30 Ext.create('Ext.panel.Panel', {
37 html: 'This is the inner panel content',
41 renderTo: Ext.getBody()
43 </code></pre>
45 Ext.define('Ext.layout.container.Fit', {
47 /* Begin Definitions */
49 extend: 'Ext.layout.container.AbstractFit',
51 alternateClassName: 'Ext.layout.FitLayout',
56 onLayout : function() {
60 if (me.owner.items.length) {
61 me.setItemBox(me.owner.items.get(0), me.getLayoutTargetSize());
65 getTargetBox : function() {
66 return this.getLayoutTargetSize();
69 setItemBox : function(item, box) {
71 if (item && box.height > 0) {
72 if (me.isManaged('width') === true) {
73 box.width = undefined;
75 if (me.isManaged('height') === true) {
76 box.height = undefined;
78 me.setItemSize(item, box.width, box.height);