aboutsummaryrefslogtreecommitdiffstats
path: root/src/number.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/number.js')
-rwxr-xr-xsrc/number.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/number.js b/src/number.js
index 7218a50..697d1dc 100755
--- a/src/number.js
+++ b/src/number.js
@@ -21,6 +21,8 @@ SVG.Number = function(value) {
/* normalize percent value */
if (match[2] == '%')
this.value /= 100
+ else if (match[2] == 's')
+ this.value *= 1000
/* store unit */
this.unit = match[2]
@@ -39,7 +41,13 @@ SVG.Number = function(value) {
SVG.extend(SVG.Number, {
// Stringalize
toString: function() {
- return (this.unit == '%' ? ~~(this.value * 1e8) / 1e6 : this.value) + this.unit
+ return (
+ this.unit == '%' ?
+ ~~(this.value * 1e8) / 1e6:
+ this.unit == 's' ?
+ this.value / 1e3 :
+ this.value
+ ) + this.unit
}
, // Convert to primitive
valueOf: function() {