<!DOCTYPE html>
|
<html>
|
<head>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<title>The source code</title>
|
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
|
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
|
<style type="text/css">
|
.highlight { display: block; background-color: #ddd; }
|
</style>
|
<script type="text/javascript">
|
function highlight() {
|
document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
|
}
|
</script>
|
</head>
|
<body onload="prettyPrint(); highlight();">
|
<pre class="prettyprint lang-js"><span id='Ext-layout-component-Draw'>/**
|
</span> * @class Ext.layout.component.Draw
|
* @private
|
*
|
*/
|
|
Ext.define('Ext.layout.component.Draw', {
|
|
/* Begin Definitions */
|
|
alias: 'layout.draw',
|
|
extend: 'Ext.layout.component.Auto',
|
|
<span id='Ext-layout-component-Draw-cfg-setHeightInDom'> setHeightInDom: true,
|
</span>
|
<span id='Ext-layout-component-Draw-cfg-setWidthInDom'> setWidthInDom: true,
|
</span>
|
<span id='Ext-layout-component-Draw-property-type'> /* End Definitions */
|
</span>
|
type: 'draw',
|
|
<span id='Ext-layout-component-Draw-method-measureContentWidth'> measureContentWidth : function (ownerContext) {
|
</span> var target = ownerContext.target,
|
paddingInfo = ownerContext.getPaddingInfo(),
|
bbox = this.getBBox(ownerContext);
|
|
if (!target.viewBox) {
|
if (target.autoSize) {
|
return bbox.width + paddingInfo.width;
|
} else {
|
return bbox.x + bbox.width + paddingInfo.width;
|
}
|
} else {
|
if (ownerContext.heightModel.shrinkWrap) {
|
return paddingInfo.width;
|
} else {
|
return bbox.width / bbox.height * (ownerContext.getProp('contentHeight') - paddingInfo.height) + paddingInfo.width;
|
}
|
}
|
},
|
|
<span id='Ext-layout-component-Draw-method-measureContentHeight'> measureContentHeight : function (ownerContext) {
|
</span> var target = ownerContext.target,
|
paddingInfo = ownerContext.getPaddingInfo(),
|
bbox = this.getBBox(ownerContext);
|
|
if (!ownerContext.target.viewBox) {
|
if (target.autoSize) {
|
return bbox.height + paddingInfo.height;
|
} else {
|
return bbox.y + bbox.height + paddingInfo.height;
|
}
|
} else {
|
if (ownerContext.widthModel.shrinkWrap) {
|
return paddingInfo.height;
|
} else {
|
return bbox.height / bbox.width * (ownerContext.getProp('contentWidth') - paddingInfo.width) + paddingInfo.height;
|
}
|
}
|
},
|
|
<span id='Ext-layout-component-Draw-method-getBBox'> getBBox: function(ownerContext) {
|
</span> var bbox = ownerContext.surfaceBBox;
|
if (!bbox) {
|
bbox = ownerContext.target.surface.items.getBBox();
|
// If the surface is empty, we'll get these values, normalize them
|
if (bbox.width === -Infinity && bbox.height === -Infinity) {
|
bbox.width = bbox.height = bbox.x = bbox.y = 0;
|
}
|
ownerContext.surfaceBBox = bbox;
|
}
|
return bbox;
|
},
|
|
<span id='Ext-layout-component-Draw-method-publishInnerWidth'> publishInnerWidth: function (ownerContext, width) {
|
</span> ownerContext.setContentWidth(width - ownerContext.getFrameInfo().width, true);
|
},
|
|
<span id='Ext-layout-component-Draw-method-publishInnerHeight'> publishInnerHeight: function (ownerContext, height) {
|
</span> ownerContext.setContentHeight(height - ownerContext.getFrameInfo().height, true);
|
},
|
|
<span id='Ext-layout-component-Draw-method-finishedLayout'> finishedLayout: function (ownerContext) {
|
</span> // TODO: Is there a better way doing this?
|
var props = ownerContext.props,
|
paddingInfo = ownerContext.getPaddingInfo();
|
|
// We don't want the cost of getProps, so we just use the props data... this is ok
|
// because all the props have been calculated by this time
|
this.owner.setSurfaceSize(props.contentWidth - paddingInfo.width, props.contentHeight - paddingInfo.height);
|
|
// calls afterComponentLayout, so we want the surface to be sized before that:
|
this.callParent(arguments);
|
}
|
});
|
</pre>
|
</body>
|
</html>
|