Fixing label positioning in subexp nodes

This commit is contained in:
Jeff Avallone 2014-12-09 20:22:44 -05:00
parent 27a23162b4
commit e26d91bae5

View File

@ -29,8 +29,7 @@ export default _.extend({}, Base, {
ry: 3 ry: 3
}); });
this.regexp.container = this.container.group().transform(Snap.matrix() this.regexp.container = this.container.group();
.translate(10, 10));
this.regexp.render(); this.regexp.render();
} else { } else {
this.regexp.container = this.container; this.regexp.container = this.container;
@ -44,9 +43,20 @@ export default _.extend({}, Base, {
this.regexp.position(); this.regexp.position();
if (this.outline) { 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(); box = this.regexp.getBBox();
this.outline.attr({ this.outline
.transform(Snap.matrix()
.translate(box.x - 10, box.y - 10))
.attr({
width: box.width + 20, width: box.width + 20,
height: box.height + 20 height: box.height + 20
}); });