Removing unnecessary binds

This commit is contained in:
Jeff Avallone 2014-12-15 22:00:24 -05:00
parent d22ab35b68
commit 84d3fe797d
7 changed files with 27 additions and 28 deletions

View File

@ -124,11 +124,11 @@ export default {
this.startRender();
return this._render()
.then((() => {
.then(() => {
if (this.anchorDebug) {
this.renderAnchor();
}
}).bind(this))
})
.then(this.doneRender.bind(this))
.then(_.constant(this));
},

View File

@ -16,10 +16,10 @@ export default _.extend({}, Base, {
this.partContainer = this.container.group();
return Q.all(_.map(elements, (part => {
return Q.all(_.map(elements, part => {
return part.render(this.partContainer.group());
}).bind(this)))
.then((() => {
}))
.then(() => {
this.spaceVertically(elements, {
padding: 5
});
@ -27,7 +27,7 @@ export default _.extend({}, Base, {
return this.renderLabeledBox(this.invert() ? 'None of:' : 'One of:', this.partContainer, {
padding: 5
});
}).bind(this));
});
},
_getAnchor() {

View File

@ -21,12 +21,12 @@ export default _.extend({}, Base, {
}
if (start || end || parts.length !== 1) {
partPromises = _.map(parts, (function(part) {
partPromises = _.map(parts, part => {
return part.render(this.container.group());
}).bind(this));
});
return Q.all(_([start, partPromises, end]).flatten().compact().value())
.then(((items) => {
.then(items => {
var prev, next, paths;
this.items = items;
@ -35,7 +35,7 @@ export default _.extend({}, Base, {
});
prev = this.normalizeBBox(_.first(items).getBBox());
paths = _.map(items.slice(1), (item => {
paths = _.map(items.slice(1), item => {
var path;
next = this.normalizeBBox(item.getBBox());
@ -43,11 +43,11 @@ export default _.extend({}, Base, {
prev = next;
return path;
}).bind(this));
});
this.container.prepend(
this.container.path(paths.join('')));
}).bind(this));
});
} else {
return this.proxy(parts[0]);
}

View File

@ -9,7 +9,7 @@ export default _.extend({}, Base, {
return this.proxy(this._content);
} else {
return this._content.render(this.container.group())
.then((() => {
.then(() => {
var box, paths = [];
this._content.transform(this._repeat.contentPosition());
@ -41,8 +41,8 @@ export default _.extend({}, Base, {
this.container.prepend(
this.container.path(paths.join('')));
}
}).bind(this))
.then((() => {
})
.then(() => {
var labelStr = this._repeat.label(),
label,
labelBox,
@ -56,7 +56,7 @@ export default _.extend({}, Base, {
label.transform(Snap.matrix()
.translate(box.x2 - labelBox.width - labelShift, box.y2 + labelBox.height));
}
}).bind(this));
});
}
},

View File

@ -20,7 +20,7 @@ export default _.extend({}, Base, {
return Q.all(_.map(matches, match => {
return match.render(matchContainer.group());
}))
.then((() => {
.then(() => {
var containerBox,
paths;
@ -44,7 +44,7 @@ export default _.extend({}, Base, {
return `M0,${box.ay}h${box.ax}M${box.ax2},${box.ay}H${container.width}`;
}).join('')));
}).bind(this));
});
}
},

View File

@ -13,7 +13,7 @@ export default _.extend({}, Base, {
.attr({ r: 5 });
return this.regexp.render(this.container.group())
.then((() => {
.then(() => {
var box;
this.regexp.transform(Snap.matrix()
@ -28,7 +28,7 @@ export default _.extend({}, Base, {
this.container.prepend(
this.container.path(`M${box.ax},${box.ay}H0M${box.ax2},${box.ay}H${box.x2 + 10}`));
}).bind(this));
});
},
flags() {

View File

@ -60,10 +60,10 @@ export default class Regexper {
this.setState('is-loading');
this.renderRegexp(expression.replace(/[\r\n]/g, ''))
.then((() => {
.then(() => {
this.setState('has-results');
this.updateLinks();
}).bind(this))
})
.done();
}
}
@ -119,8 +119,7 @@ export default class Regexper {
}
renderRegexp(expression) {
var snap = Snap(this.svg),
padding = this.padding;
var snap = Snap(this.svg);
snap.selectAll('g').remove();
@ -129,15 +128,15 @@ export default class Regexper {
return Q.fcall(parser.parse.bind(parser), expression)
.then(null, this.showError.bind(this))
.invoke('render', snap.group())
.then((result) => {
.then(result => {
var box;
box = result.getBBox();
result.container.transform(Snap.matrix()
.translate(padding - box.x, padding - box.y));
.translate(this.padding - box.x, this.padding - box.y));
snap.attr({
width: box.width + padding * 2,
height: box.height + padding * 2
width: box.width + this.padding * 2,
height: box.height + this.padding * 2
});
});
}