4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../resources/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-component-Tip'>/**
19 </span> * Component layout for Tip/ToolTip/etc. components
20 * @class Ext.layout.component.Tip
21 * @extends Ext.layout.component.Dock
25 Ext.define('Ext.layout.component.Tip', {
27 /* Begin Definitions */
29 alias: ['layout.tip'],
31 extend: 'Ext.layout.component.Dock',
37 onLayout: function(width, height) {
47 // Position offscreen so the natural width is not affected by the viewport's right edge
48 el.setXY([-9999,-9999]);
50 // Calculate initial layout
51 this.callParent(arguments);
53 // Handle min/maxWidth for auto-width tips
54 if (!Ext.isNumber(width)) {
55 minWidth = owner.minWidth;
56 maxWidth = owner.maxWidth;
57 // IE6/7 in strict mode have a problem doing an autoWidth
58 if (Ext.isStrict && (Ext.isIE6 || Ext.isIE7)) {
59 constrainedWidth = me.doAutoWidth();
61 naturalWidth = el.getWidth();
63 if (naturalWidth < minWidth) {
64 constrainedWidth = minWidth;
66 else if (naturalWidth > maxWidth) {
67 constrainedWidth = maxWidth;
69 if (constrainedWidth) {
70 this.callParent([constrainedWidth, height]);
78 doAutoWidth: function(){
82 width = body.getTextWidth();
85 width = Math.max(width, owner.header.getWidth());
87 if (!Ext.isDefined(me.frameWidth)) {
88 me.frameWidth = owner.el.getWidth() - body.getWidth();
90 width += me.frameWidth + body.getPadding('lr');