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,12 +43,23 @@ 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
width: box.width + 20, .transform(Snap.matrix()
height: box.height + 20 .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}', { this.container.path(Snap.format('M0,{content.cy}h10M{content.x2},{content.cy}H{container.x2}', {
container: this.getBBox(), container: this.getBBox(),