mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: box shadow updates (#9220)
This commit is contained in:
committed by
Nathan Walker
parent
726ef9fd8f
commit
207edb94f4
@@ -4,6 +4,7 @@ import { BackgroundRepeat } from '../styling/style-properties';
|
||||
import { LinearGradient } from './linear-gradient';
|
||||
// Types.
|
||||
import { Color } from '../../color';
|
||||
import { BoxShadow } from './box-shadow';
|
||||
|
||||
export class Background implements BackgroundDefinition {
|
||||
public static default = new Background();
|
||||
@@ -26,6 +27,7 @@ export class Background implements BackgroundDefinition {
|
||||
public borderBottomLeftRadius = 0;
|
||||
public borderBottomRightRadius = 0;
|
||||
public clipPath: string;
|
||||
public boxShadow: BoxShadow;
|
||||
|
||||
private clone(): Background {
|
||||
const clone = new Background();
|
||||
@@ -48,6 +50,7 @@ export class Background implements BackgroundDefinition {
|
||||
clone.borderBottomRightRadius = this.borderBottomRightRadius;
|
||||
clone.borderBottomLeftRadius = this.borderBottomLeftRadius;
|
||||
clone.clipPath = this.clipPath;
|
||||
clone.boxShadow = this.boxShadow;
|
||||
|
||||
return clone;
|
||||
}
|
||||
@@ -178,6 +181,13 @@ export class Background implements BackgroundDefinition {
|
||||
return clone;
|
||||
}
|
||||
|
||||
public withBoxShadow(value: BoxShadow): Background {
|
||||
const clone = this.clone();
|
||||
clone.boxShadow = value;
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
||||
public isEmpty(): boolean {
|
||||
return !this.color && !this.image && !this.hasBorderWidth() && !this.hasBorderRadius() && !this.clipPath;
|
||||
}
|
||||
@@ -274,6 +284,14 @@ export class Background implements BackgroundDefinition {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public hasBoxShadow(): boolean {
|
||||
return !!this.boxShadow;
|
||||
}
|
||||
|
||||
public getBoxShadow(): BoxShadow {
|
||||
return this.boxShadow;
|
||||
}
|
||||
|
||||
public toString(): string {
|
||||
return `isEmpty: ${this.isEmpty()}; color: ${this.color}; image: ${this.image}; repeat: ${this.repeat}; position: ${this.position}; size: ${this.size}; borderTopColor: ${this.borderTopColor}; borderRightColor: ${this.borderRightColor}; borderBottomColor: ${this.borderBottomColor}; borderLeftColor: ${this.borderLeftColor}; borderTopWidth: ${this.borderTopWidth}; borderRightWidth: ${this.borderRightWidth}; borderBottomWidth: ${this.borderBottomWidth}; borderLeftWidth: ${this.borderLeftWidth}; borderTopLeftRadius: ${this.borderTopLeftRadius}; borderTopRightRadius: ${
|
||||
this.borderTopRightRadius
|
||||
|
||||
Reference in New Issue
Block a user