backport from master to support unsigned types

This commit is contained in:
javi 2014-01-23 17:46:13 +01:00
parent 449be47e91
commit 83c478875f
2 changed files with 11 additions and 0 deletions

View File

@ -21,6 +21,10 @@ tree.Dimension.prototype = {
return this;
},
round: function() {
this.value = Math.round(this.value);
return this;
},
toColor: function() {
return new tree.Color([this.value, this.value, this.value]);
},

View File

@ -174,6 +174,13 @@ tree.Reference.validValue = function(env, selector, value) {
}
} else if (tree.Reference.selector(selector).type == 'expression') {
return true;
} else if (tree.Reference.selector(selector).type === 'unsigned') {
if (value.value[0].is === 'float') {
value.value[0].round();
return true;
} else {
return false;
}
} else {
if (tree.Reference.selector(selector).validate) {
var valid = false;