mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00

* performance improvements around border handling BREAKING CHANGE: * if you have broder-radius or clip-path, it will clip by default
48 lines
2.1 KiB
TypeScript
48 lines
2.1 KiB
TypeScript
import { LayoutBaseCommon, clipToBoundsProperty, isPassThroughParentEnabledProperty } from './layout-base-common';
|
|
import { Length, paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty } from '../styling/style-properties';
|
|
import { CoreTypes } from '../../core-types';
|
|
|
|
export * from './layout-base-common';
|
|
|
|
export class LayoutBase extends LayoutBaseCommon {
|
|
[clipToBoundsProperty.getDefault](): boolean {
|
|
return true;
|
|
}
|
|
[clipToBoundsProperty.setNative](value: boolean) {
|
|
(<any>this.nativeViewProtected).setClipToBounds(value);
|
|
|
|
}
|
|
|
|
[isPassThroughParentEnabledProperty.setNative](value: boolean) {
|
|
(<any>this.nativeViewProtected).setPassThroughParent(value);
|
|
}
|
|
|
|
[paddingTopProperty.getDefault](): CoreTypes.LengthType {
|
|
return { value: this._defaultPaddingTop, unit: 'px' };
|
|
}
|
|
[paddingTopProperty.setNative](value: CoreTypes.LengthType) {
|
|
org.nativescript.widgets.ViewHelper.setPaddingTop(this.nativeViewProtected, Length.toDevicePixels(value, 0) + Length.toDevicePixels(this.style.borderTopWidth, 0));
|
|
}
|
|
|
|
[paddingRightProperty.getDefault](): CoreTypes.LengthType {
|
|
return { value: this._defaultPaddingRight, unit: 'px' };
|
|
}
|
|
[paddingRightProperty.setNative](value: CoreTypes.LengthType) {
|
|
org.nativescript.widgets.ViewHelper.setPaddingRight(this.nativeViewProtected, Length.toDevicePixels(value, 0) + Length.toDevicePixels(this.style.borderRightWidth, 0));
|
|
}
|
|
|
|
[paddingBottomProperty.getDefault](): CoreTypes.LengthType {
|
|
return { value: this._defaultPaddingBottom, unit: 'px' };
|
|
}
|
|
[paddingBottomProperty.setNative](value: CoreTypes.LengthType) {
|
|
org.nativescript.widgets.ViewHelper.setPaddingBottom(this.nativeViewProtected, Length.toDevicePixels(value, 0) + Length.toDevicePixels(this.style.borderBottomWidth, 0));
|
|
}
|
|
|
|
[paddingLeftProperty.getDefault](): CoreTypes.LengthType {
|
|
return { value: this._defaultPaddingLeft, unit: 'px' };
|
|
}
|
|
[paddingLeftProperty.setNative](value: CoreTypes.LengthType) {
|
|
org.nativescript.widgets.ViewHelper.setPaddingLeft(this.nativeViewProtected, Length.toDevicePixels(value, 0) + Length.toDevicePixels(this.style.borderLeftWidth, 0));
|
|
}
|
|
}
|