Fixing positioning of rendered expression

This commit is contained in:
Jeff Avallone 2014-12-05 23:06:02 -05:00
parent 354f9bc928
commit 4af501b37b

View File

@ -82,8 +82,7 @@ export default class Regexper {
snap.selectAll('g').remove(); snap.selectAll('g').remove();
result = parser.parse(expression); result = parser.parse(expression);
result.container = snap.group().transform(Snap.matrix() result.container = snap.group();
.translate(this.padding, this.padding));
result.render(); result.render();
return result; return result;
@ -95,6 +94,8 @@ export default class Regexper {
parsed.position(); parsed.position();
box = parsed.container.getBBox(); box = parsed.container.getBBox();
parsed.container.transform(Snap.matrix()
.translate(this.padding - box.x, this.padding - box.y));
snap.attr({ snap.attr({
width: box.width + this.padding * 2, width: box.width + this.padding * 2,
height: box.height + this.padding * 2 height: box.height + this.padding * 2