add right and bottom to insets

This commit is contained in:
Martin Yankov
2018-07-12 17:26:55 +03:00
parent 9b7fb990b3
commit f3e89371ec
6 changed files with 28 additions and 27 deletions

View File

@@ -156,11 +156,11 @@ export class GridLayout extends GridLayoutBase {
this.setMeasuredDimension(widthSizeAndState, heightSizeAndState);
}
public onLayout(left: number, top: number, right: number, bottom: number, insetLeft?: number, insetTop?: number): void {
public onLayout(left: number, top: number, right: number, bottom: number, insets: {left, top, right, bottom}): void {
super.onLayout(left, top, right, bottom);
let paddingLeft = this.effectiveBorderLeftWidth + this.effectivePaddingLeft + insetLeft;
let paddingTop = this.effectiveBorderTopWidth + this.effectivePaddingTop + insetTop;
let paddingLeft = this.effectiveBorderLeftWidth + this.effectivePaddingLeft + insets.left;
let paddingTop = this.effectiveBorderTopWidth + this.effectivePaddingTop + insets.top;
this.columnOffsets.length = 0;
this.rowOffsets.length = 0;

View File

@@ -75,11 +75,12 @@ export class LayoutBase extends LayoutBaseCommon {
newHeight = height + onScreenTop;
}
if (onScreenLeft + width >= layout.toDevicePixels(safeArea.origin.x) + layout.toDevicePixels(safeArea.size.width)) {
if (width && onScreenLeft + width >= layout.toDevicePixels(safeArea.origin.x) + layout.toDevicePixels(safeArea.size.width)) {
newWidth = newWidth + (layout.toDevicePixels(fullscreen.size.width) - (onScreenLeft + width));
}
if (onScreenTop + height >= layout.toDevicePixels(safeArea.origin.y) + layout.toDevicePixels(safeArea.size.height)) {
if (height && onScreenTop + height >= layout.toDevicePixels(safeArea.origin.y) + layout.toDevicePixels(safeArea.size.height)) {
// console.log(">>>>>>>> Bottom Layout: onScreenTop - " + onScreenTop + " height - " + height + " safeAreaOriginY - " + layout.toDevicePixels(safeArea.origin.y) + " safeAreaHeight - " + layout.toDevicePixels(safeArea.size.height));
newHeight = newHeight + (layout.toDevicePixels(fullscreen.size.height) - (onScreenTop + height));
}

View File

@@ -81,21 +81,21 @@ export class StackLayout extends StackLayoutBase {
this.setMeasuredDimension(widthAndState, heightAndState);
}
public onLayout(left: number, top: number, right: number, bottom: number, insetLeft?: number, insetTop?: number): void {
public onLayout(left: number, top: number, right: number, bottom: number, insets: {left, top, right, bottom}): void {
super.onLayout(left, top, right, bottom);
if (this.orientation === "vertical") {
this.layoutVertical(left, top, right, bottom, insetLeft, insetTop);
this.layoutVertical(left, top, right, bottom, insets);
}
else {
this.layoutHorizontal(left, top, right, bottom);
this.layoutHorizontal(left, top, right, bottom, insets);
}
}
private layoutVertical(left: number, top: number, right: number, bottom: number, insetLeft?: number, insetTop?: number): void {
const paddingLeft = this.effectiveBorderLeftWidth + this.effectivePaddingLeft + insetLeft;
const paddingTop = this.effectiveBorderTopWidth + this.effectivePaddingTop + insetTop;
const paddingRight = this.effectiveBorderRightWidth + this.effectivePaddingRight;
const paddingBottom = this.effectiveBorderBottomWidth + this.effectivePaddingBottom;
private layoutVertical(left: number, top: number, right: number, bottom: number, insets: {left, top, right, bottom}): void {
const paddingLeft = this.effectiveBorderLeftWidth + this.effectivePaddingLeft + insets.left;
const paddingTop = this.effectiveBorderTopWidth + this.effectivePaddingTop + insets.top;
const paddingRight = this.effectiveBorderRightWidth + this.effectivePaddingRight + insets.right;
const paddingBottom = this.effectiveBorderBottomWidth + this.effectivePaddingBottom + insets.bottom;
let childTop: number;
let childLeft: number = paddingLeft;
@@ -126,11 +126,11 @@ export class StackLayout extends StackLayoutBase {
})
}
private layoutHorizontal(left: number, top: number, right: number, bottom: number): void {
const paddingLeft = this.effectiveBorderLeftWidth + this.effectivePaddingLeft;
const paddingTop = this.effectiveBorderTopWidth + this.effectivePaddingTop;
const paddingRight = this.effectiveBorderRightWidth + this.effectivePaddingRight;
const paddingBottom = this.effectiveBorderBottomWidth + this.effectivePaddingBottom;
private layoutHorizontal(left: number, top: number, right: number, bottom: number, insets: {left, top, right, bottom}): void {
const paddingLeft = this.effectiveBorderLeftWidth + this.effectivePaddingLeft + insets.left;
const paddingTop = this.effectiveBorderTopWidth + this.effectivePaddingTop + insets.top;
const paddingRight = this.effectiveBorderRightWidth + this.effectivePaddingRight + insets.right;
const paddingBottom = this.effectiveBorderBottomWidth + this.effectivePaddingBottom + insets.bottom;
let childTop: number = paddingTop;
let childLeft: number;