Removing need for separate setContainer calls

This commit is contained in:
Jeff Avallone 2014-12-10 19:31:07 -05:00
parent 9ac25b9a50
commit dbcdd583ed
9 changed files with 17 additions and 26 deletions

View File

@ -40,7 +40,11 @@ export default {
}); });
}, },
render() { render(container) {
if (container) {
this.setContainer(container);
}
this._labelGroups = []; this._labelGroups = [];
this._render(); this._render();
}, },
@ -56,8 +60,7 @@ export default {
proxy(node) { proxy(node) {
this._proxy = node; this._proxy = node;
this._proxy.setContainer(this.container); this._proxy.render(this.container);
this._proxy.render();
}, },
_render() { _render() {

View File

@ -10,8 +10,7 @@ export default _.extend({}, Base, {
this.partContainer = this.container.group(); this.partContainer = this.container.group();
_.each(this.parts.elements, (part => { _.each(this.parts.elements, (part => {
part.setContainer(this.partContainer.group()); part.render(this.partContainer.group());
part.render();
}).bind(this)); }).bind(this));
}, },

View File

@ -5,11 +5,8 @@ export default _.extend({}, Base, {
type: 'charset-range', type: 'charset-range',
_render() { _render() {
this.first.setContainer(this.container.group()); this.first.render(this.container.group());
this.first.render(); this.last.render(this.container.group());
this.last.setContainer(this.container.group());
this.last.render();
this.hyphen = this.container.text() this.hyphen = this.container.text()
.attr({ .attr({
@ -18,8 +15,6 @@ export default _.extend({}, Base, {
}, },
_position() { _position() {
var box;
this.first.position(); this.first.position();
this.last.position(); this.last.position();

View File

@ -16,8 +16,7 @@ export default _.extend({}, Base, {
} }
this.contents.parts = _.map(parts, (function(part) { this.contents.parts = _.map(parts, (function(part) {
part.setContainer(this.container.group()); part.render(this.container.group());
part.render();
return part; return part;
}).bind(this)); }).bind(this));

View File

@ -8,8 +8,7 @@ export default _.extend({}, Base, {
if (this._repeat.textValue === '') { if (this._repeat.textValue === '') {
this.proxy(this._content); this.proxy(this._content);
} else { } else {
this._content.setContainer(this.container.group()); this._content.render(this.container.group());
this._content.render();
} }
}, },

View File

@ -14,9 +14,7 @@ export default _.extend({}, Base, {
.addClass('regexp-matches'); .addClass('regexp-matches');
_.each(matches, (match => { _.each(matches, (match => {
match.setContainer(this.matchContainer.group()); match.render(this.matchContainer.group());
match.render();
return match.container;
}).bind(this)); }).bind(this));
} }
}, },

View File

@ -5,9 +5,9 @@ export default _.extend({}, Base, {
type: 'root', type: 'root',
_render() { _render() {
this.regexp.setContainer(this.container.group().transform(Snap.matrix() this.regexp.render(this.container.group());
.translate(10, 0))); this.regexp.container.transform(Snap.matrix()
this.regexp.render(); .translate(10, 0));
this.start = this.container.circle() this.start = this.container.circle()
.addClass('pin') .addClass('pin')

View File

@ -18,8 +18,7 @@ export default _.extend({}, Base, {
if (label) { if (label) {
this.renderLabeledBox(label); this.renderLabeledBox(label);
this.regexp.setContainer(this.container.group()); this.regexp.render(this.container.group());
this.regexp.render();
} else { } else {
this.proxy(this.regexp); this.proxy(this.regexp);
} }

View File

@ -91,8 +91,7 @@ export default class Regexper {
return Q.fcall(parser.parse.bind(parser), expression) return Q.fcall(parser.parse.bind(parser), expression)
.then((result) => { .then((result) => {
result.setContainer(snap.group()); result.render(snap.group());
result.render();
return result; return result;
}, this.showError.bind(this)) }, this.showError.bind(this))
.then((result) => { .then((result) => {