|
|
|
@ -6,25 +6,17 @@ node.Dimension = function Dimension(value, unit) {
|
|
|
|
|
|
|
|
|
|
node.Dimension.prototype = {
|
|
|
|
|
eval: function () { return this },
|
|
|
|
|
toColor: function () {
|
|
|
|
|
return new(node.Color)([this.value, this.value, this.value]);
|
|
|
|
|
},
|
|
|
|
|
toCSS: function () {
|
|
|
|
|
var css = this.value + this.unit;
|
|
|
|
|
return css;
|
|
|
|
|
},
|
|
|
|
|
'+': function (other) {
|
|
|
|
|
return new(node.Dimension)
|
|
|
|
|
(this.value + other.value, this.unit);
|
|
|
|
|
},
|
|
|
|
|
'-': function (other) {
|
|
|
|
|
return new(node.Dimension)
|
|
|
|
|
(this.value - other.value, this.unit);
|
|
|
|
|
},
|
|
|
|
|
'*': function (other) {
|
|
|
|
|
return new(node.Dimension)
|
|
|
|
|
(this.value * other.value, this.unit);
|
|
|
|
|
},
|
|
|
|
|
'/': function (other) {
|
|
|
|
|
operate: function (op, other) {
|
|
|
|
|
return new(node.Dimension)
|
|
|
|
|
(this.value / other.value, this.unit);
|
|
|
|
|
(node.operate(op, this.value, other.value),
|
|
|
|
|
this.unit);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|