mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
clip-path support added
This commit is contained in:
@@ -742,6 +742,7 @@ export class ViewStyler implements style.Styler {
|
||||
style.registerHandler(style.borderWidthProperty, borderHandler);
|
||||
style.registerHandler(style.borderColorProperty, borderHandler);
|
||||
style.registerHandler(style.borderRadiusProperty, borderHandler);
|
||||
style.registerHandler(style.clipPathProperty, borderHandler);
|
||||
|
||||
style.registerHandler(style.nativeLayoutParamsProperty, new style.StylePropertyChangedHandler(
|
||||
ViewStyler.setNativeLayoutParamsProperty,
|
||||
|
||||
@@ -567,7 +567,7 @@ export class ViewStyler implements style.Styler {
|
||||
private static getTranslateYProperty(view: View): any {
|
||||
return view.translateY;
|
||||
}
|
||||
|
||||
|
||||
//z-index
|
||||
private static setZIndexProperty(view: View, newValue: any) {
|
||||
view.ios.layer.zPosition = newValue;
|
||||
@@ -580,13 +580,41 @@ export class ViewStyler implements style.Styler {
|
||||
private static getZIndexProperty(view: View): any {
|
||||
return view.ios.layer.zPosition;
|
||||
}
|
||||
|
||||
//Clip-path methods
|
||||
private static setClipPathProperty(view: View, newValue: any) {
|
||||
var nativeView: UIView = <UIView>view._nativeView;
|
||||
if (nativeView) {
|
||||
ensureBackground();
|
||||
var updateSuspended = view._isPresentationLayerUpdateSuspeneded();
|
||||
if (!updateSuspended) {
|
||||
CATransaction.begin();
|
||||
}
|
||||
nativeView.backgroundColor = background.ios.createBackgroundUIColor(view);
|
||||
if (!updateSuspended) {
|
||||
CATransaction.commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static resetClipPathProperty(view: View, nativeValue: any) {
|
||||
var nativeView: UIView = <UIView>view._nativeView;
|
||||
if (nativeView) {
|
||||
// TODO: Check how to reset.
|
||||
}
|
||||
}
|
||||
|
||||
public static registerHandlers() {
|
||||
|
||||
style.registerHandler(style.backgroundInternalProperty, new style.StylePropertyChangedHandler(
|
||||
ViewStyler.setBackgroundInternalProperty,
|
||||
ViewStyler.resetBackgroundInternalProperty,
|
||||
ViewStyler.getNativeBackgroundInternalValue));
|
||||
|
||||
style.registerHandler(style.clipPathProperty, new style.StylePropertyChangedHandler(
|
||||
ViewStyler.setClipPathProperty,
|
||||
ViewStyler.resetClipPathProperty));
|
||||
|
||||
style.registerHandler(style.visibilityProperty, new style.StylePropertyChangedHandler(
|
||||
ViewStyler.setVisibilityProperty,
|
||||
ViewStyler.resetVisibilityProperty));
|
||||
|
||||
Reference in New Issue
Block a user