mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
Fix wrap-layout implementation for iOS
Fix layout-helper so that unit-tests can work again
This commit is contained in:
@ -88,6 +88,13 @@ export class MyButton extends button.Button {
|
|||||||
get layoutTop(): number {
|
get layoutTop(): number {
|
||||||
return this._layoutTop;
|
return this._layoutTop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_getCurrentMeasureSpecs(): { widthMeasureSpec: number; heightMeasureSpec: number } {
|
||||||
|
return {
|
||||||
|
widthMeasureSpec: (<any>this)._oldWidthMeasureSpec,
|
||||||
|
heightMeasureSpec: (<any>this)._oldHeightMeasureSpec
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function assertMeasure(btn: MyButton, width: number, height: number, name?: string) {
|
export function assertMeasure(btn: MyButton, width: number, height: number, name?: string) {
|
||||||
|
@ -146,7 +146,7 @@ export class WrapLayout extends common.WrapLayout {
|
|||||||
|
|
||||||
|
|
||||||
childWidth = length;
|
childWidth = length;
|
||||||
childHeight = isNaN(this.itemHeight) ? childHeight : this.itemHeight * density;
|
childHeight = this.itemHeight > 0 ? this.itemHeight * density : childHeight;
|
||||||
if (childTop + childHeight > childrenLength) {
|
if (childTop + childHeight > childrenLength) {
|
||||||
// Move to top.
|
// Move to top.
|
||||||
childTop = this.paddingTop * density;
|
childTop = this.paddingTop * density;
|
||||||
@ -162,7 +162,7 @@ export class WrapLayout extends common.WrapLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
childWidth = isNaN(this.itemWidth) ? childWidth : this.itemWidth * density;
|
childWidth = this.itemWidth > 0 ? this.itemWidth * density : childWidth;
|
||||||
childHeight = length;
|
childHeight = length;
|
||||||
if (childLeft + childWidth > childrenLength) {
|
if (childLeft + childWidth > childrenLength) {
|
||||||
// Move to left.
|
// Move to left.
|
||||||
|
Reference in New Issue
Block a user