Removing unnecessary binds
This commit is contained in:
parent
d22ab35b68
commit
84d3fe797d
@ -124,11 +124,11 @@ export default {
|
|||||||
|
|
||||||
this.startRender();
|
this.startRender();
|
||||||
return this._render()
|
return this._render()
|
||||||
.then((() => {
|
.then(() => {
|
||||||
if (this.anchorDebug) {
|
if (this.anchorDebug) {
|
||||||
this.renderAnchor();
|
this.renderAnchor();
|
||||||
}
|
}
|
||||||
}).bind(this))
|
})
|
||||||
.then(this.doneRender.bind(this))
|
.then(this.doneRender.bind(this))
|
||||||
.then(_.constant(this));
|
.then(_.constant(this));
|
||||||
},
|
},
|
||||||
|
@ -16,10 +16,10 @@ export default _.extend({}, Base, {
|
|||||||
|
|
||||||
this.partContainer = this.container.group();
|
this.partContainer = this.container.group();
|
||||||
|
|
||||||
return Q.all(_.map(elements, (part => {
|
return Q.all(_.map(elements, part => {
|
||||||
return part.render(this.partContainer.group());
|
return part.render(this.partContainer.group());
|
||||||
}).bind(this)))
|
}))
|
||||||
.then((() => {
|
.then(() => {
|
||||||
this.spaceVertically(elements, {
|
this.spaceVertically(elements, {
|
||||||
padding: 5
|
padding: 5
|
||||||
});
|
});
|
||||||
@ -27,7 +27,7 @@ export default _.extend({}, Base, {
|
|||||||
return this.renderLabeledBox(this.invert() ? 'None of:' : 'One of:', this.partContainer, {
|
return this.renderLabeledBox(this.invert() ? 'None of:' : 'One of:', this.partContainer, {
|
||||||
padding: 5
|
padding: 5
|
||||||
});
|
});
|
||||||
}).bind(this));
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_getAnchor() {
|
_getAnchor() {
|
||||||
|
@ -21,12 +21,12 @@ export default _.extend({}, Base, {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (start || end || parts.length !== 1) {
|
if (start || end || parts.length !== 1) {
|
||||||
partPromises = _.map(parts, (function(part) {
|
partPromises = _.map(parts, part => {
|
||||||
return part.render(this.container.group());
|
return part.render(this.container.group());
|
||||||
}).bind(this));
|
});
|
||||||
|
|
||||||
return Q.all(_([start, partPromises, end]).flatten().compact().value())
|
return Q.all(_([start, partPromises, end]).flatten().compact().value())
|
||||||
.then(((items) => {
|
.then(items => {
|
||||||
var prev, next, paths;
|
var prev, next, paths;
|
||||||
|
|
||||||
this.items = items;
|
this.items = items;
|
||||||
@ -35,7 +35,7 @@ export default _.extend({}, Base, {
|
|||||||
});
|
});
|
||||||
|
|
||||||
prev = this.normalizeBBox(_.first(items).getBBox());
|
prev = this.normalizeBBox(_.first(items).getBBox());
|
||||||
paths = _.map(items.slice(1), (item => {
|
paths = _.map(items.slice(1), item => {
|
||||||
var path;
|
var path;
|
||||||
|
|
||||||
next = this.normalizeBBox(item.getBBox());
|
next = this.normalizeBBox(item.getBBox());
|
||||||
@ -43,11 +43,11 @@ export default _.extend({}, Base, {
|
|||||||
prev = next;
|
prev = next;
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
}).bind(this));
|
});
|
||||||
|
|
||||||
this.container.prepend(
|
this.container.prepend(
|
||||||
this.container.path(paths.join('')));
|
this.container.path(paths.join('')));
|
||||||
}).bind(this));
|
});
|
||||||
} else {
|
} else {
|
||||||
return this.proxy(parts[0]);
|
return this.proxy(parts[0]);
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ export default _.extend({}, Base, {
|
|||||||
return this.proxy(this._content);
|
return this.proxy(this._content);
|
||||||
} else {
|
} else {
|
||||||
return this._content.render(this.container.group())
|
return this._content.render(this.container.group())
|
||||||
.then((() => {
|
.then(() => {
|
||||||
var box, paths = [];
|
var box, paths = [];
|
||||||
|
|
||||||
this._content.transform(this._repeat.contentPosition());
|
this._content.transform(this._repeat.contentPosition());
|
||||||
@ -41,8 +41,8 @@ export default _.extend({}, Base, {
|
|||||||
this.container.prepend(
|
this.container.prepend(
|
||||||
this.container.path(paths.join('')));
|
this.container.path(paths.join('')));
|
||||||
}
|
}
|
||||||
}).bind(this))
|
})
|
||||||
.then((() => {
|
.then(() => {
|
||||||
var labelStr = this._repeat.label(),
|
var labelStr = this._repeat.label(),
|
||||||
label,
|
label,
|
||||||
labelBox,
|
labelBox,
|
||||||
@ -56,7 +56,7 @@ export default _.extend({}, Base, {
|
|||||||
label.transform(Snap.matrix()
|
label.transform(Snap.matrix()
|
||||||
.translate(box.x2 - labelBox.width - labelShift, box.y2 + labelBox.height));
|
.translate(box.x2 - labelBox.width - labelShift, box.y2 + labelBox.height));
|
||||||
}
|
}
|
||||||
}).bind(this));
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ export default _.extend({}, Base, {
|
|||||||
return Q.all(_.map(matches, match => {
|
return Q.all(_.map(matches, match => {
|
||||||
return match.render(matchContainer.group());
|
return match.render(matchContainer.group());
|
||||||
}))
|
}))
|
||||||
.then((() => {
|
.then(() => {
|
||||||
var containerBox,
|
var containerBox,
|
||||||
paths;
|
paths;
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ export default _.extend({}, Base, {
|
|||||||
|
|
||||||
return `M0,${box.ay}h${box.ax}M${box.ax2},${box.ay}H${container.width}`;
|
return `M0,${box.ay}h${box.ax}M${box.ax2},${box.ay}H${container.width}`;
|
||||||
}).join('')));
|
}).join('')));
|
||||||
}).bind(this));
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ export default _.extend({}, Base, {
|
|||||||
.attr({ r: 5 });
|
.attr({ r: 5 });
|
||||||
|
|
||||||
return this.regexp.render(this.container.group())
|
return this.regexp.render(this.container.group())
|
||||||
.then((() => {
|
.then(() => {
|
||||||
var box;
|
var box;
|
||||||
|
|
||||||
this.regexp.transform(Snap.matrix()
|
this.regexp.transform(Snap.matrix()
|
||||||
@ -28,7 +28,7 @@ export default _.extend({}, Base, {
|
|||||||
|
|
||||||
this.container.prepend(
|
this.container.prepend(
|
||||||
this.container.path(`M${box.ax},${box.ay}H0M${box.ax2},${box.ay}H${box.x2 + 10}`));
|
this.container.path(`M${box.ax},${box.ay}H0M${box.ax2},${box.ay}H${box.x2 + 10}`));
|
||||||
}).bind(this));
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
flags() {
|
flags() {
|
||||||
|
@ -60,10 +60,10 @@ export default class Regexper {
|
|||||||
this.setState('is-loading');
|
this.setState('is-loading');
|
||||||
|
|
||||||
this.renderRegexp(expression.replace(/[\r\n]/g, ''))
|
this.renderRegexp(expression.replace(/[\r\n]/g, ''))
|
||||||
.then((() => {
|
.then(() => {
|
||||||
this.setState('has-results');
|
this.setState('has-results');
|
||||||
this.updateLinks();
|
this.updateLinks();
|
||||||
}).bind(this))
|
})
|
||||||
.done();
|
.done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -119,8 +119,7 @@ export default class Regexper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderRegexp(expression) {
|
renderRegexp(expression) {
|
||||||
var snap = Snap(this.svg),
|
var snap = Snap(this.svg);
|
||||||
padding = this.padding;
|
|
||||||
|
|
||||||
snap.selectAll('g').remove();
|
snap.selectAll('g').remove();
|
||||||
|
|
||||||
@ -129,15 +128,15 @@ export default class Regexper {
|
|||||||
return Q.fcall(parser.parse.bind(parser), expression)
|
return Q.fcall(parser.parse.bind(parser), expression)
|
||||||
.then(null, this.showError.bind(this))
|
.then(null, this.showError.bind(this))
|
||||||
.invoke('render', snap.group())
|
.invoke('render', snap.group())
|
||||||
.then((result) => {
|
.then(result => {
|
||||||
var box;
|
var box;
|
||||||
|
|
||||||
box = result.getBBox();
|
box = result.getBBox();
|
||||||
result.container.transform(Snap.matrix()
|
result.container.transform(Snap.matrix()
|
||||||
.translate(padding - box.x, padding - box.y));
|
.translate(this.padding - box.x, this.padding - box.y));
|
||||||
snap.attr({
|
snap.attr({
|
||||||
width: box.width + padding * 2,
|
width: box.width + this.padding * 2,
|
||||||
height: box.height + padding * 2
|
height: box.height + this.padding * 2
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user