本文整理汇总了TypeScript中ui/core/view.View.layoutChild方法的典型用法代码示例。如果您正苦于以下问题:TypeScript View.layoutChild方法的具体用法?TypeScript View.layoutChild怎么用?TypeScript View.layoutChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ui/core/view.View
的用法示例。
在下文中一共展示了View.layoutChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: switch
this.eachLayoutChild((child, last) => {
let lp: CommonLayoutParams = child.style._getValue(nativeLayoutParamsProperty);
let childWidth = child.getMeasuredWidth() + (lp.leftMargin + lp.rightMargin) * density;
let childHeight = child.getMeasuredHeight() + (lp.topMargin + lp.bottomMargin) * density;
if (last && this.stretchLastChild) {
// Last child with stretch - give it all the space and return;
View.layoutChild(this, child, x, y, x + remainingWidth, y + remainingHeight);
return;
}
let dock = DockLayout.getDock(child);
switch (dock) {
case Dock.top:
childLeft = x;
childTop = y;
childWidth = remainingWidth;
y += childHeight;
remainingHeight = Math.max(0, remainingHeight - childHeight);
break;
case Dock.bottom:
childLeft = x;
childTop = y + remainingHeight - childHeight;
childWidth = remainingWidth;
remainingHeight = Math.max(0, remainingHeight - childHeight);
break;
case Dock.right:
childLeft = x + remainingWidth - childWidth;
childTop = y;
childHeight = remainingHeight;
remainingWidth = Math.max(0, remainingWidth - childWidth);
break;
case Dock.left:
default:
childLeft = x;
childTop = y;
childHeight = remainingHeight;
x += childWidth;
remainingWidth = Math.max(0, remainingWidth - childWidth);
break;
}
View.layoutChild(this, child, childLeft, childTop, childLeft + childWidth, childTop + childHeight);
});
示例2:
this.eachLayoutChild((child, last) => {
let lp: CommonLayoutParams = child.style._getValue(nativeLayoutParamsProperty);
let childWidth = child.getMeasuredWidth();
let childHeight = child.getMeasuredHeight();
let childLeft = (this.paddingLeft + AbsoluteLayout.getLeft(child)) * density;
let childTop = (this.paddingTop + AbsoluteLayout.getTop(child)) * density;
let childRight = childLeft + childWidth + (lp.leftMargin + lp.rightMargin) * density;
let childBottom = childTop + childHeight + (lp.topMargin + lp.bottomMargin) * density;
View.layoutChild(this, child, childLeft, childTop, childRight, childBottom);
});