mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-19 23:13:04 +08:00

It comes with a major refactoring of the BorderDrawable. Now all Paths are cached not to regenerate them on every draw pass. Also it is important to understand that the clipping feature on android comes at a cost. It will be done only when truelly necessary. but with complex paths ((border radius > 0 && border non uniform) || border-width >0) then we must apply a costly drawing pass (though hardware accelerated) to accomplish it.
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));
|
|
}
|
|
}
|