summaryrefslogtreecommitdiffstats
path: root/dist
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-08 12:59:03 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-08 12:59:03 +0100
commitae04f7599c822dec52af60c51aeb2ab135818c5d (patch)
tree200f63b61b5c265da460bd3a27767a2d34398cfc /dist
parent6cafed8db9588c0b6b3b367aa822d9a0547e8e27 (diff)
downloadsvg.js-ae04f7599c822dec52af60c51aeb2ab135818c5d.tar.gz
svg.js-ae04f7599c822dec52af60c51aeb2ab135818c5d.zip
implements `round()` (#916)
Diffstat (limited to 'dist')
-rw-r--r--dist/svg.js22
1 files changed, 21 insertions, 1 deletions
diff --git a/dist/svg.js b/dist/svg.js
index 6b05383..e80e6bd 100644
--- a/dist/svg.js
+++ b/dist/svg.js
@@ -6,7 +6,7 @@
* @copyright Wout Fierens <wout@mick-wout.com>
* @license MIT
*
-* BUILT: Thu Nov 08 2018 12:02:46 GMT+0100 (GMT+01:00)
+* BUILT: Thu Nov 08 2018 12:57:03 GMT+0100 (GMT+01:00)
*/;
var SVG = (function () {
'use strict';
@@ -1618,6 +1618,26 @@ var SVG = (function () {
element = makeInstance(element);
this.node.parentNode.replaceChild(element.node, this.node);
return element;
+ }
+ }, {
+ key: "round",
+ value: function round() {
+ var precision = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 2;
+ var map$$1 = arguments.length > 1 ? arguments[1] : undefined;
+ var factor = Math.pow(10, precision);
+ var attrs = this.attr(); // If we have no map, build one from attrs
+
+ if (!map$$1) {
+ map$$1 = Object.keys(attrs);
+ } // Holds rounded attributes
+
+
+ var newAttrs = {};
+ map$$1.forEach(function (key) {
+ newAttrs[key] = Math.round(attrs[key] * factor) / factor;
+ });
+ this.attr(newAttrs);
+ return this;
} // Return id on string conversion
}, {