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
1 changed files with 16 additions and 6 deletions

View File

@ -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(),