carto/lib/less/node/dimension.js
cloudhead ad66408b9f init
2010-02-23 13:39:05 -05:00

31 lines
795 B
JavaScript

node.Dimension = function Dimension(value, unit) {
this.value = parseFloat(value);
this.unit = unit || null;
};
node.Dimension.prototype = {
eval: function () { return this },
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) {
return new(node.Dimension)
(this.value / other.value, this.unit);
}
};