2010-02-24 02:39:05 +08:00
|
|
|
|
|
|
|
node.Dimension = function Dimension(value, unit) {
|
|
|
|
this.value = parseFloat(value);
|
|
|
|
this.unit = unit || null;
|
|
|
|
};
|
|
|
|
|
|
|
|
node.Dimension.prototype = {
|
|
|
|
eval: function () { return this },
|
2010-02-27 11:30:30 +08:00
|
|
|
toColor: function () {
|
|
|
|
return new(node.Color)([this.value, this.value, this.value]);
|
|
|
|
},
|
2010-02-24 02:39:05 +08:00
|
|
|
toCSS: function () {
|
|
|
|
var css = this.value + this.unit;
|
|
|
|
return css;
|
|
|
|
},
|
2010-02-27 11:30:30 +08:00
|
|
|
operate: function (op, other) {
|
2010-02-24 02:39:05 +08:00
|
|
|
return new(node.Dimension)
|
2010-02-27 11:30:30 +08:00
|
|
|
(node.operate(op, this.value, other.value),
|
|
|
|
this.unit);
|
2010-02-24 02:39:05 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|