mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Clean up handling of messages.
This commit is contained in:
parent
fc57fd2136
commit
d9f96b9a7a
1 changed files with 19 additions and 15 deletions
|
@ -7,17 +7,21 @@ function compareNumbers(number1, number2, message) {
|
|||
}
|
||||
|
||||
function comparePoints(point1, point2, message) {
|
||||
compareNumbers(point1.x, point2.x, message ? message + ' x' : undefined);
|
||||
compareNumbers(point1.y, point2.y, message ? message + ' y' : undefined);
|
||||
compareNumbers(point1.x, point2.x,
|
||||
(message || '') + ' x');
|
||||
compareNumbers(point1.y, point2.y,
|
||||
(message || '') + ' y');
|
||||
}
|
||||
|
||||
function compareRectangles(rect1, rect2, message) {
|
||||
compareNumbers(rect1.x, rect2.x, message ? message + ' x' : undefined);
|
||||
compareNumbers(rect1.y, rect2.y, message ? message + ' y' : undefined);
|
||||
compareNumbers(rect1.x, rect2.x,
|
||||
(message || '') + ' x');
|
||||
compareNumbers(rect1.y, rect2.y,
|
||||
(message || '') + ' y');
|
||||
compareNumbers(rect1.width, rect2.width,
|
||||
message ? message + ' width' : undefined);
|
||||
(message || '') + ' width');
|
||||
compareNumbers(rect1.height, rect2.height,
|
||||
message ? message + ' height' : undefined);
|
||||
(message || '') + ' height');
|
||||
}
|
||||
|
||||
function compareRGBColors(color1, color2, message) {
|
||||
|
@ -25,13 +29,13 @@ function compareRGBColors(color1, color2, message) {
|
|||
color2 = new RGBColor(color2);
|
||||
|
||||
compareNumbers(color1.red, color2.red,
|
||||
message ? message + ' red' : undefined);
|
||||
(message || '') + ' red');
|
||||
compareNumbers(color1.green, color2.green,
|
||||
message ? message + ' green' : undefined);
|
||||
(message || '') + ' green');
|
||||
compareNumbers(color1.blue, color2.blue,
|
||||
message ? message + ' blue' : undefined);
|
||||
(message || '') + ' blue');
|
||||
compareNumbers(color1.alpha, color2.alpha,
|
||||
message ? message + ' alpha' : undefined);
|
||||
(message || '') + ' alpha');
|
||||
}
|
||||
|
||||
function compareHSBColors(color1, color2, message) {
|
||||
|
@ -39,13 +43,13 @@ function compareHSBColors(color1, color2, message) {
|
|||
color2 = new HSBColor(color2);
|
||||
|
||||
compareNumbers(color1.hue, color2.hue,
|
||||
message ? message + ' hue' : undefined);
|
||||
(message || '') + ' hue');
|
||||
compareNumbers(color1.saturation, color2.saturation,
|
||||
message ? message + ' saturation' : undefined);
|
||||
(message || '') + ' saturation');
|
||||
compareNumbers(color1.brightness, color2.brightness,
|
||||
message ? message + ' brightness' : undefined);
|
||||
(message || '') + ' brightness');
|
||||
compareNumbers(color1.alpha, color2.alpha,
|
||||
message ? message + ' alpha' : undefined);
|
||||
(message || '') + ' alpha');
|
||||
}
|
||||
|
||||
function compareGrayColors(color1, color2, message) {
|
||||
|
@ -53,5 +57,5 @@ function compareGrayColors(color1, color2, message) {
|
|||
color2 = new GrayColor(color2);
|
||||
|
||||
compareNumbers(color1.gray, color2.gray,
|
||||
message ? message + ' gray' : undefined);
|
||||
(message || '') + ' gray');
|
||||
}
|
Loading…
Reference in a new issue