Fix: color and font comparers

This commit is contained in:
vakrilov
2015-06-26 16:44:17 +03:00
parent 9e597976c1
commit 7e44bbc0dc
2 changed files with 16 additions and 0 deletions

View File

@@ -94,6 +94,12 @@ export class Color implements definition.Color {
} }
public static equals(value1: definition.Color, value2: definition.Color): boolean { public static equals(value1: definition.Color, value2: definition.Color): boolean {
// both values are falsy
if (!value1 && !value2) {
return true;
}
// only one is falsy
if (!value1 || !value2) { if (!value1 || !value2) {
return false; return false;
} }

View File

@@ -84,6 +84,16 @@ export class Font implements definitios.Font {
} }
public static equals(value1: Font, value2: Font): boolean { public static equals(value1: Font, value2: Font): boolean {
// both values are falsy
if (!value1 && !value2) {
return true;
}
// only one is falsy
if (!value1 || !value2) {
return false;
}
return value1.fontFamily === value2.fontFamily && return value1.fontFamily === value2.fontFamily &&
value1.fontSize === value2.fontSize && value1.fontSize === value2.fontSize &&
value1.fontStyle === value2.fontStyle && value1.fontStyle === value2.fontStyle &&