Protect stroke width from wrong user input. Protect color pick from wrong user input.

This commit is contained in:
Daniela 2017-09-21 15:54:53 +01:00
parent 4568541737
commit 7ccfac0b3b
2 changed files with 7 additions and 0 deletions

View file

@ -417,7 +417,11 @@
if (e.value > 1) {
document.getElementById("lineWidthText").value = 1;
}
if (e.value < 0) {
document.getElementById("lineWidthText").value = 0;
}
document.getElementById("lineWidthRange").value = e.value > 1 ? 1 : e.value;
document.getElementById("lineWidthRange").value = e.value < 0 ? 0 : e.value;
notifyLineWidthChanged(e);
}

View file

@ -68,6 +68,7 @@ For usage and examples: colpick.com/plugin
cal.data('colpick').color = col = hexToHsb(fixHex(this.value));
fillRGBFields(col, cal.get(0));
fillHSBFields(col, cal.get(0));
fillHexFields(col, cal.get(0));
} else if (this.parentNode.className.indexOf('_hsb') > 0) {
cal.data('colpick').color = col = fixHSB({
h: parseInt(cal.data('colpick').fields.eq(4).val(), 10),
@ -76,6 +77,7 @@ For usage and examples: colpick.com/plugin
});
fillRGBFields(col, cal.get(0));
fillHexFields(col, cal.get(0));
fillHSBFields(col, cal.get(0));
} else {
cal.data('colpick').color = col = rgbToHsb(fixRGB({
r: parseInt(cal.data('colpick').fields.eq(1).val(), 10),
@ -84,6 +86,7 @@ For usage and examples: colpick.com/plugin
}));
fillHexFields(col, cal.get(0));
fillHSBFields(col, cal.get(0));
fillRGBFields(col, cal.get(0));
}
setSelector(col, cal.get(0));
setHue(col, cal.get(0));