colorpicker Ctrl-up/down steps in 50 on S, L, .5 on alpha

This commit is contained in:
tophf 2017-11-22 02:26:49 +03:00
parent 6c858d6449
commit 75da5c50ce

View File

@ -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;
}