Fixed issue with blank color field

This commit is contained in:
Devine Lu Linvega
2018-03-21 20:10:09 +13:00
parent e71b577cec
commit a486b67876
7 changed files with 54 additions and 17 deletions
+8
View File
@@ -27,6 +27,8 @@ function Picker()
this.validate = function()
{
if(!is_valid(this.el.value)){ return; }
dotgrid.tool.style().color = this.el.value;
dotgrid.tool.style().fill = dotgrid.tool.style().fill != "none" ? this.el.value : "none";
dotgrid.draw();
@@ -63,5 +65,11 @@ function Picker()
this.update();
}
function is_valid(val)
{
var re = /[0-9A-Fa-f]{6}/g;
return re.test(val)
}
this.el.onkeyup = function(event){ dotgrid.picker.listen(event); };
}