From 75da5c50ceb785a983008693cd2e037cab6fef6a Mon Sep 17 00:00:00 2001 From: tophf Date: Wed, 22 Nov 2017 02:26:49 +0300 Subject: [PATCH] colorpicker Ctrl-up/down steps in 50 on S, L, .5 on alpha --- vendor-overwrites/colorpicker/colorpicker.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/vendor-overwrites/colorpicker/colorpicker.js b/vendor-overwrites/colorpicker/colorpicker.js index c1ff8415..29adf78b 100644 --- a/vendor-overwrites/colorpicker/colorpicker.js +++ b/vendor-overwrites/colorpicker/colorpicker.js @@ -388,16 +388,17 @@ CodeMirror.defineExtension('colorpicker', function () { }).join('') + a; newValue = options.hexUppercase ? newValue.toUpperCase() : newValue.toLowerCase(); } else if (!alt) { - const delta = - shift && !ctrl ? 10 : - ctrl && !shift ? 100 : - 1; value = parseFloat(el.value); const isHue = el === $inputs.hsl[0]; const isAlpha = el === $inputs[currentFormat][3]; + const isRGB = currentFormat === 'rgb'; const min = isHue ? -360 : 0; - const max = isHue ? 360 : isAlpha ? 1 : currentFormat === 'rgb' ? 255 : 100; + const max = isHue ? 360 : isAlpha ? 1 : isRGB ? 255 : 100; const scale = isAlpha ? .01 : 1; + const delta = + shift && !ctrl ? 10 : + ctrl && !shift ? (isHue || isRGB ? 100 : 50) : + 1; newValue = constrain(min, max, value + delta * scale * dir); newValue = isAlpha ? alphaToString(newValue) : newValue; }