From 46ab0662f5ef8903ac15a44f71c56efbd9055796 Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Sun, 14 Dec 2014 17:48:23 -0500 Subject: [PATCH] Simplifying positioning code for root nodes --- src/js/parser/javascript/root.js | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/js/parser/javascript/root.js b/src/js/parser/javascript/root.js index 33799e2..a0b647e 100644 --- a/src/js/parser/javascript/root.js +++ b/src/js/parser/javascript/root.js @@ -13,19 +13,9 @@ export default _.extend({}, Base, { .attr({ r: 5 }); return this.regexp.render(this.container.group()) - .then((() => { - var contentBox; - - this.regexp.transform(Snap.matrix() - .translate(10, 0)); - - contentBox = this.regexp.getBBox(); - - this.start.transform(Snap.matrix() - .translate(0, contentBox.cy)); - this.end.transform(Snap.matrix() - .translate(contentBox.x2 + 10, contentBox.cy)); - }).bind(this)); + .then(this.spaceHorizontally.bind(this, [this.start, this.regexp, this.end], { + padding: 10 + })); }, flags() {