From 5a000ec302fe78a7bc677abb13ce8a3a6ebd38ea Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Wed, 3 Dec 2014 20:26:09 -0500 Subject: [PATCH] Adding spacing between MatchFragments --- src/js/parser/javascript/match.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/js/parser/javascript/match.js b/src/js/parser/javascript/match.js index 881b692..728a197 100644 --- a/src/js/parser/javascript/match.js +++ b/src/js/parser/javascript/match.js @@ -27,18 +27,21 @@ export default _.extend({}, Base, { }, position() { - var offset = 0; + var offset = 0, + path = []; if (this.anchor_start()) { this.position_label(this.contents.anchor_start); - offset += this.contents.anchor_start.getBBox().width; + offset += this.contents.anchor_start.getBBox().width + 10; + path.push(Snap.format('M{x2},{cy}h10', this.contents.anchor_start.getBBox())); } _.each(this.contents.parts, function(part) { part.position(); part.container.transform(Snap.matrix() .translate(offset, 0)); - offset += part.container.getBBox().width; + offset += part.container.getBBox().width + 10; + path.push(Snap.format('M{x2},{cy}h10', part.container.getBBox())); }); if (this.anchor_end()) { @@ -46,6 +49,10 @@ export default _.extend({}, Base, { this.contents.anchor_end.transform(Snap.matrix() .translate(offset, 0)); } + + this.container.prepend( + this.container.path(path.join('')) + ); }, anchor_start() {