Add ol.color.stringOrColorEquals
This commit is contained in:
@@ -279,3 +279,22 @@ ol.color.transform = function(color, transform, opt_color) {
|
||||
result[3] = color[3];
|
||||
return ol.color.normalize(result, result);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Color|string} color1 Color2.
|
||||
* @param {ol.Color|string} color2 Color2.
|
||||
* @return {boolean} Equals.
|
||||
*/
|
||||
ol.color.stringOrColorEquals = function(color1, color2) {
|
||||
if (color1 === color2 || color1 == color2) {
|
||||
return true;
|
||||
}
|
||||
if (goog.isString(color1)) {
|
||||
color1 = ol.color.fromString(color1);
|
||||
}
|
||||
if (goog.isString(color2)) {
|
||||
color2 = ol.color.fromString(color2);
|
||||
}
|
||||
return ol.color.equals(color1, color2);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user