From 4af501b37b79b23d4397c91c4d5b17e2f395f0f0 Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Fri, 5 Dec 2014 23:06:02 -0500 Subject: [PATCH] Fixing positioning of rendered expression --- src/js/regexper.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/js/regexper.js b/src/js/regexper.js index afc4e5a..92ec965 100644 --- a/src/js/regexper.js +++ b/src/js/regexper.js @@ -82,8 +82,7 @@ export default class Regexper { snap.selectAll('g').remove(); result = parser.parse(expression); - result.container = snap.group().transform(Snap.matrix() - .translate(this.padding, this.padding)); + result.container = snap.group(); result.render(); return result; @@ -95,6 +94,8 @@ export default class Regexper { parsed.position(); box = parsed.container.getBBox(); + parsed.container.transform(Snap.matrix() + .translate(this.padding - box.x, this.padding - box.y)); snap.attr({ width: box.width + this.padding * 2, height: box.height + this.padding * 2