Cleanup of path code

This commit is contained in:
Jeff Avallone 2014-12-10 19:09:31 -05:00
parent f0c25dfc41
commit 521ab74723
2 changed files with 10 additions and 6 deletions

View File

@ -22,20 +22,23 @@ export default _.extend({}, Base, {
box = this._content.getBBox(); box = this._content.getBBox();
if (this._repeat.hasSkip()) { 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, vert: box.height / 2 - 10,
horiz: box.width - 10 horiz: box.width - 10
}, box))); }));
} }
if (this._repeat.hasLoop()) { 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 vert: box.height / 2 - 10
}, box))); }));
} }
if (paths.length) { if (paths.length) {
this.container.path(paths.join('')); this.container.prepend(
this.container.path(paths.join('')));
} }
} }
}); });

View File

@ -77,7 +77,8 @@ export default _.extend({}, Base, {
bottom: _.last(matches).getBBox().cy - 10 bottom: _.last(matches).getBBox().cy - 10
})); }));
this.container.prepend(this.container.path(paths.join(''))); this.container.prepend(
this.container.path(paths.join('')));
}, },
matches() { matches() {