From 521ab747237a5b4c1d04cb7f92097fefd192eb96 Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Wed, 10 Dec 2014 19:09:31 -0500 Subject: [PATCH] Cleanup of path code --- src/js/parser/javascript/match_fragment.js | 13 ++++++++----- src/js/parser/javascript/regexp.js | 3 ++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/js/parser/javascript/match_fragment.js b/src/js/parser/javascript/match_fragment.js index c357cda..276c3c2 100644 --- a/src/js/parser/javascript/match_fragment.js +++ b/src/js/parser/javascript/match_fragment.js @@ -22,20 +22,23 @@ export default _.extend({}, Base, { box = this._content.getBBox(); if (this._repeat.hasSkip()) { - paths.push(Snap.format('M0,{cy}q10,0 10,-10v-{vert}q0,-10 10,-10h{horiz}q10,0 10,10v{vert}q0,10 10,10', _.extend({ + paths.push(Snap.format('M0,{box.cy}q10,0 10,-10v-{vert}q0,-10 10,-10h{horiz}q10,0 10,10v{vert}q0,10 10,10', { + box, vert: box.height / 2 - 10, horiz: box.width - 10 - }, box))); + })); } if (this._repeat.hasLoop()) { - paths.push(Snap.format('M{x},{cy}q-10,0 -10,10v{vert}q0,10 10,10h{width}q10,0 10,-10v-{vert}q0,-10 -10,-10', _.extend({ + paths.push(Snap.format('M{box.x},{box.cy}q-10,0 -10,10v{vert}q0,10 10,10h{box.width}q10,0 10,-10v-{vert}q0,-10 -10,-10', { + box, vert: box.height / 2 - 10 - }, box))); + })); } if (paths.length) { - this.container.path(paths.join('')); + this.container.prepend( + this.container.path(paths.join(''))); } } }); diff --git a/src/js/parser/javascript/regexp.js b/src/js/parser/javascript/regexp.js index f83f233..74bf207 100644 --- a/src/js/parser/javascript/regexp.js +++ b/src/js/parser/javascript/regexp.js @@ -77,7 +77,8 @@ export default _.extend({}, Base, { bottom: _.last(matches).getBBox().cy - 10 })); - this.container.prepend(this.container.path(paths.join(''))); + this.container.prepend( + this.container.path(paths.join(''))); }, matches() {