<span id='Ext-layout-container-Anchor-cfg-defaultAnchor'> /**
</span> * @cfg {String} defaultAnchor
- *
- * default anchor for all child container items applied if no anchor or specific width is set on the child item. Defaults to '100%'.
- *
+ * Default anchor for all child <b>container</b> items applied if no anchor or specific width is set on the child item. Defaults to '100%'.
*/
defaultAnchor: '100%',
components = me.getVisibleItems(owner),
len = components.length,
boxes = [],
- box, newTargetSize, anchorWidth, anchorHeight, component, anchorSpec, calcWidth, calcHeight,
- anchorsArray, anchor, i, el, cleaner;
+ box, newTargetSize, component, anchorSpec, calcWidth, calcHeight,
+ i, el, cleaner;
if (ownerWidth < 20 && ownerHeight < 20) {
return;
});
}
- // find the container anchoring size
- if (owner.anchorSize) {
- if (typeof owner.anchorSize == 'number') {
- anchorWidth = owner.anchorSize;
- }
- else {
- anchorWidth = owner.anchorSize.width;
- anchorHeight = owner.anchorSize.height;
- }
- }
- else {
- anchorWidth = owner.initialConfig.width;
- anchorHeight = owner.initialConfig.height;
- }
-
// Work around WebKit RightMargin bug. We're going to inline-block all the children only ONCE and remove it when we're done
if (!Ext.supports.RightMargin) {
cleaner = Ext.core.Element.getRightMarginFixCleaner(target);
for (i = 0; i < len; i++) {
component = components[i];
el = component.el;
- anchor = component.anchor;
- if (!component.anchor && component.items && !Ext.isNumber(component.width) && !(Ext.isIE6 && Ext.isStrict)) {
- component.anchor = anchor = me.defaultAnchor;
- }
-
- if (anchor) {
- anchorSpec = component.anchorSpec;
- // cache all anchor values
- if (!anchorSpec) {
- anchorsArray = anchor.split(' ');
- component.anchorSpec = anchorSpec = {
- right: me.parseAnchor(anchorsArray[0], component.initialConfig.width, anchorWidth),
- bottom: me.parseAnchor(anchorsArray[1], component.initialConfig.height, anchorHeight)
- };
+ anchorSpec = component.anchorSpec;
+ if (anchorSpec) {
+ if (anchorSpec.right) {
+ calcWidth = me.adjustWidthAnchor(anchorSpec.right(ownerWidth) - el.getMargin('lr'), component);
+ } else {
+ calcWidth = undefined;
+ }
+ if (anchorSpec.bottom) {
+ calcHeight = me.adjustHeightAnchor(anchorSpec.bottom(ownerHeight) - el.getMargin('tb'), component);
+ } else {
+ calcHeight = undefined;
}
- calcWidth = anchorSpec.right ? me.adjustWidthAnchor(anchorSpec.right(ownerWidth) - el.getMargin('lr'), component) : undefined;
- calcHeight = anchorSpec.bottom ? me.adjustHeightAnchor(anchorSpec.bottom(ownerHeight) - el.getMargin('tb'), component) : undefined;
boxes.push({
component: component,
// private
adjustHeightAnchor: function(value, comp) {
return value;
+ },
+
+ configureItem: function(item) {
+ var me = this,
+ owner = me.owner,
+ anchor= item.anchor,
+ anchorsArray,
+ anchorSpec,
+ anchorWidth,
+ anchorHeight;
+
+ if (!item.anchor && item.items && !Ext.isNumber(item.width) && !(Ext.isIE6 && Ext.isStrict)) {
+ item.anchor = anchor = me.defaultAnchor;
+ }
+
+ // find the container anchoring size
+ if (owner.anchorSize) {
+ if (typeof owner.anchorSize == 'number') {
+ anchorWidth = owner.anchorSize;
+ }
+ else {
+ anchorWidth = owner.anchorSize.width;
+ anchorHeight = owner.anchorSize.height;
+ }
+ }
+ else {
+ anchorWidth = owner.initialConfig.width;
+ anchorHeight = owner.initialConfig.height;
+ }
+
+ if (anchor) {
+ // cache all anchor values
+ anchorsArray = anchor.split(' ');
+ item.anchorSpec = anchorSpec = {
+ right: me.parseAnchor(anchorsArray[0], item.initialConfig.width, anchorWidth),
+ bottom: me.parseAnchor(anchorsArray[1], item.initialConfig.height, anchorHeight)
+ };
+
+ if (anchorSpec.right) {
+ item.layoutManagedWidth = 1;
+ } else {
+ item.layoutManagedWidth = 2;
+ }
+
+ if (anchorSpec.bottom) {
+ item.layoutManagedHeight = 1;
+ } else {
+ item.layoutManagedHeight = 2;
+ }
+ } else {
+ item.layoutManagedWidth = 2;
+ item.layoutManagedHeight = 2;
+ }
+ this.callParent(arguments);
}
});</pre>