mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Clipping is required for iOS even with uniform borders, as long as the radius is > 0
This commit is contained in:
@@ -914,6 +914,10 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
|
||||
this.effectiveMarginTop = PercentLength.toDevicePixels(style.marginTop, 0, parentAvailableHeight);
|
||||
this.effectiveMarginBottom = PercentLength.toDevicePixels(style.marginBottom, 0, parentAvailableHeight);
|
||||
}
|
||||
|
||||
public _setNativeClipToBounds() {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
ViewCommon.prototype._oldLeft = 0;
|
||||
|
||||
@@ -13,6 +13,12 @@ const PFLAG_FORCE_LAYOUT = 1;
|
||||
const PFLAG_MEASURED_DIMENSION_SET = 1 << 1;
|
||||
const PFLAG_LAYOUT_REQUIRED = 1 << 2;
|
||||
|
||||
declare module "ui/core/view" {
|
||||
export interface View {
|
||||
_setNativeClipToBounds();
|
||||
}
|
||||
}
|
||||
|
||||
export class View extends ViewCommon {
|
||||
private _hasTransfrom = false;
|
||||
private _privateFlags: number = PFLAG_LAYOUT_REQUIRED | PFLAG_FORCE_LAYOUT;
|
||||
@@ -397,11 +403,17 @@ export class View extends ViewCommon {
|
||||
this.nativeView.backgroundColor = value;
|
||||
} else {
|
||||
this.nativeView.backgroundColor = ios.createBackgroundUIColor(this);
|
||||
this._setNativeClipToBounds();
|
||||
}
|
||||
if (!updateSuspended) {
|
||||
CATransaction.commit();
|
||||
}
|
||||
}
|
||||
|
||||
_setNativeClipToBounds() {
|
||||
let backgroundInternal = this.style.backgroundInternal;
|
||||
this.nativeView.clipsToBounds = backgroundInternal.hasUniformBorder() || backgroundInternal.getUniformBorderRadius() > 0;
|
||||
}
|
||||
}
|
||||
|
||||
export class CustomLayoutView extends View {
|
||||
|
||||
@@ -3,11 +3,19 @@
|
||||
export * from "./layout-base-common";
|
||||
|
||||
export class LayoutBase extends LayoutBaseCommon {
|
||||
|
||||
|
||||
get [clipToBoundsProperty.native](): boolean {
|
||||
return this._nativeView.clipsToBounds;
|
||||
return false;
|
||||
}
|
||||
set [clipToBoundsProperty.native](value: boolean) {
|
||||
this._nativeView.clipsToBounds = value;
|
||||
this._setNativeClipToBounds();
|
||||
}
|
||||
|
||||
_setNativeClipToBounds() {
|
||||
if (this.clipToBounds) {
|
||||
this._nativeView.clipsToBounds = true;
|
||||
} else {
|
||||
super._setNativeClipToBounds();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,7 +164,6 @@ function drawNonUniformBorders(nativeView: NativeView, background: Background) {
|
||||
layer.borderColor = undefined;
|
||||
layer.borderWidth = 0;
|
||||
layer.cornerRadius = 0;
|
||||
nativeView.clipsToBounds = true;
|
||||
|
||||
const layerBounds = layer.bounds;
|
||||
const layerOrigin = layerBounds.origin;
|
||||
|
||||
Reference in New Issue
Block a user