mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
add right and bottom to insets
This commit is contained in:
@@ -641,7 +641,7 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
|
||||
}
|
||||
|
||||
public abstract onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;
|
||||
public abstract onLayout(left: number, top: number, right: number, bottom: number, insetLeft?: number, insetTop?: number): void;
|
||||
public abstract onLayout(left: number, top: number, right: number, bottom: number, insets?: {left, top, right, bottom}): void;
|
||||
public abstract layoutNativeView(left: number, top: number, right: number, bottom: number): void;
|
||||
|
||||
public static resolveSizeAndState(size: number, specSize: number, specMode: number, childMeasuredState: number): number {
|
||||
|
||||
2
tns-core-modules/ui/core/view/view.d.ts
vendored
2
tns-core-modules/ui/core/view/view.d.ts
vendored
@@ -404,7 +404,7 @@ export abstract class View extends ViewBase {
|
||||
* @param right Right position, relative to parent
|
||||
* @param bottom Bottom position, relative to parent
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
* This method must be called by onMeasure(int, int) to store the measured width and measured height. Failing to do so will trigger an exception at measurement time.
|
||||
|
||||
@@ -92,16 +92,16 @@ export class View extends ViewCommon {
|
||||
}
|
||||
|
||||
if (boundsChanged || (this._privateFlags & PFLAG_LAYOUT_REQUIRED) === PFLAG_LAYOUT_REQUIRED) {
|
||||
let insetLeft = 0;
|
||||
let insetTop = 0;
|
||||
let insets = { left: 0, top: 0, right: 0, bottom: 0};
|
||||
|
||||
if (this.nativeViewProtected.safeAreaInsets) {
|
||||
insetLeft = layout.toDevicePixels(this.nativeViewProtected.safeAreaInsets.left);
|
||||
insetTop = layout.toDevicePixels(this.nativeViewProtected.safeAreaInsets.top);
|
||||
insets.left = layout.toDevicePixels(this.nativeViewProtected.safeAreaInsets.left);
|
||||
insets.top = layout.toDevicePixels(this.nativeViewProtected.safeAreaInsets.top);
|
||||
insets.right = layout.toDevicePixels(this.nativeViewProtected.safeAreaInsets.right);
|
||||
insets.bottom = layout.toDevicePixels(this.nativeViewProtected.safeAreaInsets.bottom);
|
||||
}
|
||||
|
||||
// this.onLayout(actualPosition.left, actualPosition.top, actualPosition.right, actualPosition.bottom, insetLeft, insetTop, insetRight, insetBottom);
|
||||
this.onLayout(actualPosition.left, actualPosition.top, actualPosition.right, actualPosition.bottom, insetLeft, insetTop);
|
||||
this.onLayout(actualPosition.left, actualPosition.top, actualPosition.right, actualPosition.bottom, insets);
|
||||
this._privateFlags &= ~PFLAG_LAYOUT_REQUIRED;
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ export class View extends ViewCommon {
|
||||
this.setMeasuredDimension(widthAndState, heightAndState);
|
||||
}
|
||||
|
||||
public onLayout(left: number, top: number, right: number, bottom: number, insetLeft?: number, insetTop?: number, insetRight?: number, insetBottom?: number): void {
|
||||
public onLayout(left: number, top: number, right: number, bottom: number, insets?: {left, top, right, bottom}): void {
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user