summaryrefslogtreecommitdiffstats
path: root/src/number.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2014-02-03 21:59:15 +0100
committerwout <wout@impinc.co.uk>2014-02-03 21:59:15 +0100
commit189f009dbb28525f3eb2c0bb7a72312cb6fe4ba6 (patch)
tree39728b3425c7906b772a84d46778d33e34770ddf /src/number.js
parent8dcb37d3406a85ef639e31b256823cf24fd7b7c6 (diff)
downloadsvg.js-189f009dbb28525f3eb2c0bb7a72312cb6fe4ba6.tar.gz
svg.js-189f009dbb28525f3eb2c0bb7a72312cb6fe4ba6.zip
Added second values to SVG.Number
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() {