Normalizing function names

This commit is contained in:
Jeff Avallone 2014-12-09 18:08:40 -05:00
parent 7ab386e7a4
commit 7ed865ecdb
7 changed files with 26 additions and 26 deletions

View File

@ -7,6 +7,6 @@ export default _.extend({}, Base, {
render() {
this.container.addClass('any-character');
this.label = this.render_label(this.container, 'any character');
this.label = this.renderLabel(this.container, 'any character');
}
});

View File

@ -1,5 +1,5 @@
export default {
render_label(container, text) {
renderLabel(container, text) {
var group = container.group();
group.rect();
@ -11,7 +11,7 @@ export default {
return group;
},
position_label(group) {
positionLabel(group) {
var text = group.select('text'),
rect = group.select('rect'),
box = text.getBBox(),
@ -36,7 +36,7 @@ export default {
this.container.addClass('placeholder');
this.label = this.render_label(this.container, this.textValue);
this.label = this.renderLabel(this.container, this.textValue);
this.label.select('rect').attr({
rx: 10,
@ -45,6 +45,6 @@ export default {
},
position() {
this.position_label(this.label);
this.positionLabel(this.label);
}
};

View File

@ -15,7 +15,7 @@ export default _.extend({}, Base, {
render() {
this.container.addClass('escape');
this.label = this.render_label(this.container, _.result(this, this.code()));
this.label = this.renderLabel(this.container, _.result(this, this.code()));
this.label.select('rect').attr({
rx: 3,

View File

@ -7,7 +7,7 @@ export default _.extend({}, Base, {
render() {
this.container.addClass('literal');
this.label = this.render_label(this.container, '"' + this.literal.textValue + '"');
this.label = this.renderLabel(this.container, '"' + this.literal.textValue + '"');
this.label.select('rect').attr({
rx: 3,

View File

@ -9,8 +9,8 @@ export default _.extend({}, Base, {
this.contents = {};
if (this.anchor_start()) {
this.contents.anchor_start = this.render_label(this.container, 'Start of line')
if (this.anchorStart()) {
this.contents.anchor_start = this.renderLabel(this.container, 'Start of line')
.addClass('anchor');
}
@ -20,8 +20,8 @@ export default _.extend({}, Base, {
return part;
});
if (this.anchor_end()) {
this.contents.anchor_end = this.render_label(this.container, 'End of line')
if (this.anchorEnd()) {
this.contents.anchor_end = this.renderLabel(this.container, 'End of line')
.addClass('anchor');
}
},
@ -30,8 +30,8 @@ export default _.extend({}, Base, {
var offset = 0,
path = [];
if (this.anchor_start()) {
this.position_label(this.contents.anchor_start);
if (this.anchorStart()) {
this.positionLabel(this.contents.anchor_start);
offset += this.contents.anchor_start.getBBox().width + 10;
path.push(Snap.format('M{x2},{cy}h10', this.contents.anchor_start.getBBox()));
}
@ -44,8 +44,8 @@ export default _.extend({}, Base, {
path.push(Snap.format('M{x2},{cy}h10', part.container.getBBox()));
});
if (this.anchor_end()) {
this.position_label(this.contents.anchor_end);
if (this.anchorEnd()) {
this.positionLabel(this.contents.anchor_end);
this.contents.anchor_end.transform(Snap.matrix()
.translate(offset, 0));
} else {
@ -57,11 +57,11 @@ export default _.extend({}, Base, {
);
},
anchor_start() {
anchorStart() {
return this._anchor_start.textValue !== '';
},
anchor_end() {
anchorEnd() {
return this._anchor_end.textValue !== '';
},

View File

@ -15,24 +15,24 @@ export default _.extend({}, Base, {
this._content.position();
if (this._repeat.textValue !== '') {
this._content.container.transform(this._repeat.content_position());
this._content.container.transform(this._repeat.contentPosition());
box = this._content.container.getBBox();
if (this._repeat.has_skip()) {
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({
vert: box.height / 2 - 10,
horiz: box.width - 10
}, box)));
}
if (this._repeat.has_loop()) {
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({
vert: box.height / 2 - 10
}, box)));
}
if (this._repeat.has_loop() || this._repeat.has_skip()) {
if (this._repeat.hasLoop() || this._repeat.hasSkip()) {
paths.push(Snap.format('M0,{cy}h15M{x2},{cy}h15', box));
}

View File

@ -11,22 +11,22 @@ export default {
return (this._greedy.textValue !== '');
},
has_skip() {
hasSkip() {
return this.minimum() === 0;
},
has_loop() {
hasLoop() {
return this.maximum() === -1 || this.maximum() > 1;
},
content_position() {
contentPosition() {
var x = 0, y = 0;
if (this.has_skip()) {
if (this.hasSkip()) {
y = 10;
}
if (this.has_skip() || this.has_loop()) {
if (this.hasSkip() || this.hasLoop()) {
x = 15;
}