Palette Editor : Fix color change from hex input

This commit is contained in:
jdescottes 2015-07-21 23:40:55 +02:00
parent 7a8efc56b0
commit 2fdc85556b

View File

@ -36,6 +36,9 @@
this.spectrumEl = null; this.spectrumEl = null;
}; };
/**
* Handle change event on all color inputs
*/
ns.HslRgbColorPicker.prototype.onPickerChange_ = function (evt) { ns.HslRgbColorPicker.prototype.onPickerChange_ = function (evt) {
var target = evt.target; var target = evt.target;
if (target.dataset.dimension) { if (target.dataset.dimension) {
@ -47,6 +50,9 @@
} }
}; };
/**
* Handle up/down arrow keydown on text inputs
*/
ns.HslRgbColorPicker.prototype.onKeydown_ = function (evt) { ns.HslRgbColorPicker.prototype.onKeydown_ = function (evt) {
var target = evt.target; var target = evt.target;
@ -90,7 +96,7 @@
this.setColor(color); this.setColor(color);
} }
} else if (model === 'hex') { } else if (model === 'hex') {
if (/^#([a-f0-9]{3}) {1,2}$/i.test(value)) { if (/^#([a-f0-9]{3}){1,2}$/i.test(value)) {
this.setColor(value); this.setColor(value);
} }
} }