refactor: apply insets to wrap layout

This commit is contained in:
Vasil Chimev
2018-07-25 13:48:00 +03:00
committed by Martin Yankov
parent 2d0d36c6d8
commit 726c5bb913

View File

@@ -119,14 +119,14 @@ export class WrapLayout extends WrapLayoutBase {
this.setMeasuredDimension(widthAndState, heightAndState); this.setMeasuredDimension(widthAndState, heightAndState);
} }
public onLayout(left: number, top: number, right: number, bottom: number): void { public onLayout(left: number, top: number, right: number, bottom: number, insets: {left, top, right, bottom}): void {
super.onLayout(left, top, right, bottom); super.onLayout(left, top, right, bottom);
const isVertical = this.orientation === "vertical"; const isVertical = this.orientation === "vertical";
const paddingLeft = this.effectiveBorderLeftWidth + this.effectivePaddingLeft; const paddingLeft = this.effectiveBorderLeftWidth + this.effectivePaddingLeft + insets.left;
const paddingTop = this.effectiveBorderTopWidth + this.effectivePaddingTop; const paddingTop = this.effectiveBorderTopWidth + this.effectivePaddingTop + insets.top;
const paddingRight = this.effectiveBorderRightWidth + this.effectivePaddingRight; const paddingRight = this.effectiveBorderRightWidth + this.effectivePaddingRight + insets.right;
const paddingBottom = this.effectiveBorderBottomWidth + this.effectivePaddingBottom; const paddingBottom = this.effectiveBorderBottomWidth + this.effectivePaddingBottom + insets.bottom;
let childLeft = paddingLeft; let childLeft = paddingLeft;
let childTop = paddingTop; let childTop = paddingTop;