diff --git a/src/js/parser/javascript/subexp.js b/src/js/parser/javascript/subexp.js index 483b7dc..a796bbb 100644 --- a/src/js/parser/javascript/subexp.js +++ b/src/js/parser/javascript/subexp.js @@ -29,8 +29,7 @@ export default _.extend({}, Base, { ry: 3 }); - this.regexp.container = this.container.group().transform(Snap.matrix() - .translate(10, 10)); + this.regexp.container = this.container.group(); this.regexp.render(); } else { this.regexp.container = this.container; @@ -44,12 +43,23 @@ export default _.extend({}, Base, { this.regexp.position(); if (this.outline) { + box = this.label.getBBox(); + + this.label.transform(Snap.matrix() + .translate(0, box.height)); + + this.regexp.container.transform(Snap.matrix() + .translate(10, 10 + box.height)); + box = this.regexp.getBBox(); - this.outline.attr({ - width: box.width + 20, - height: box.height + 20 - }); + this.outline + .transform(Snap.matrix() + .translate(box.x - 10, box.y - 10)) + .attr({ + width: box.width + 20, + height: box.height + 20 + }); this.container.path(Snap.format('M0,{content.cy}h10M{content.x2},{content.cy}H{container.x2}', { container: this.getBBox(),