From fed85a7a5309200fca79e4dbdb28a3ec4a21effd Mon Sep 17 00:00:00 2001 From: LaShonda Hopper Date: Fri, 9 Feb 2018 18:12:57 -0500 Subject: [PATCH] [Case 4315] ESLint Pass 6 Pt 2 for colpick equality checks (details below). * Suppressing equality checking issues within color conversion helper functions. * These issues are suppressed as opposed to resolved because their resolution causes issues with the color picker's understanding of the color it's being set to along with the respective hue. This is likely due to rounding issues; however, it may also be something related to the equality operator implicit conversions semantics of JavaScript. It's something that can be looked into later if desired. * Bug Steps upon resolving check as opposed to suppressing them: - Select a shape entity for example. - Note the visual color and actual RGB values for that entity's color upon selection. - Click the Color Wheel. - Notice the automatic change of the color for the entity when the picker is shown. - If the issue doesn't show itself right away, alter the color for the entity close the picker, and repeat steps 2-3. * Issue Count reduced from 8 to 1 Changes Committed: modified: scripts/system/html/js/colpick.js --- scripts/system/html/js/colpick.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/system/html/js/colpick.js b/scripts/system/html/js/colpick.js index 7c640633e3..94b5d8521c 100644 --- a/scripts/system/html/js/colpick.js +++ b/scripts/system/html/js/colpick.js @@ -519,11 +519,11 @@ For usage and examples: colpick.com/plugin var max = Math.max(rgb.r, rgb.g, rgb.b); var delta = max - min; hsb.b = max; - hsb.s = max != 0 ? 255 * delta / max : 0; - if (hsb.s != 0) { - if (rgb.r == max) { + hsb.s = max != 0 ? 255 * delta / max : 0; // eslint-disable-line eqeqeq + if (hsb.s != 0) { // eslint-disable-line eqeqeq + if (rgb.r == max) { // eslint-disable-line eqeqeq hsb.h = (rgb.g - rgb.b) / delta; - } else if (rgb.g == max) { + } else if (rgb.g == max) { // eslint-disable-line eqeqeq hsb.h = 2 + (rgb.b - rgb.r) / delta; } else { hsb.h = 4 + (rgb.r - rgb.g) / delta; @@ -544,13 +544,13 @@ For usage and examples: colpick.com/plugin var h = hsb.h; var s = hsb.s*255/100; var v = hsb.b*255/100; - if (s == 0) { + if (s == 0) { // eslint-disable-line eqeqeq rgb.r = rgb.g = rgb.b = v; } else { var t1 = v; var t2 = (255-s)*v/255; var t3 = (t1-t2)*(h%60)/60; - if (h==360) { + if (h==360) { // eslint-disable-line eqeqeq h = 0; } if (h<60) { @@ -578,7 +578,7 @@ For usage and examples: colpick.com/plugin rgb.b.toString(16) ]; $.each(hex, function (nr, val) { - if (val.length == 1) { + if (val.length == 1) { // eslint-disable-line eqeqeq hex[nr] = '0' + val; } });