Refactoring to not render connectors for a Regexp with one Match
This commit is contained in:
parent
fe6727b79a
commit
6a9d498bf6
@ -18,7 +18,8 @@ export default _.extend({}, Base, {
|
||||
positions,
|
||||
container = this.container,
|
||||
totalHeight,
|
||||
verticalCenter;
|
||||
verticalCenter,
|
||||
includeLines = (this.matches().length > 1);
|
||||
|
||||
_.invoke(this.matches(), 'position');
|
||||
|
||||
@ -32,13 +33,14 @@ export default _.extend({}, Base, {
|
||||
|
||||
totalHeight = positions.reduce((offset, pos) => {
|
||||
pos.content.transform(Snap.matrix()
|
||||
.translate(center - pos.box.cx + 20, offset));
|
||||
.translate(center - pos.box.cx + (includeLines ? 20 : 0), offset));
|
||||
|
||||
return offset + pos.box.height + 5;
|
||||
}, 0).value() - 5;
|
||||
|
||||
verticalCenter = totalHeight / 2
|
||||
|
||||
if (includeLines) {
|
||||
positions.each(pos => {
|
||||
var box = pos.content.getBBox(),
|
||||
direction = box.cy > verticalCenter ? 1 : -1,
|
||||
@ -59,6 +61,7 @@ export default _.extend({}, Base, {
|
||||
path.clone().transform(Snap.matrix()
|
||||
.scale(-1, 1, center + 20, 0));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
matches() {
|
||||
|
Loading…
Reference in New Issue
Block a user