Normalizing function names
This commit is contained in:
parent
7ab386e7a4
commit
7ed865ecdb
@ -7,6 +7,6 @@ export default _.extend({}, Base, {
|
|||||||
render() {
|
render() {
|
||||||
this.container.addClass('any-character');
|
this.container.addClass('any-character');
|
||||||
|
|
||||||
this.label = this.render_label(this.container, 'any character');
|
this.label = this.renderLabel(this.container, 'any character');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
export default {
|
export default {
|
||||||
render_label(container, text) {
|
renderLabel(container, text) {
|
||||||
var group = container.group();
|
var group = container.group();
|
||||||
|
|
||||||
group.rect();
|
group.rect();
|
||||||
@ -11,7 +11,7 @@ export default {
|
|||||||
return group;
|
return group;
|
||||||
},
|
},
|
||||||
|
|
||||||
position_label(group) {
|
positionLabel(group) {
|
||||||
var text = group.select('text'),
|
var text = group.select('text'),
|
||||||
rect = group.select('rect'),
|
rect = group.select('rect'),
|
||||||
box = text.getBBox(),
|
box = text.getBBox(),
|
||||||
@ -36,7 +36,7 @@ export default {
|
|||||||
|
|
||||||
this.container.addClass('placeholder');
|
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({
|
this.label.select('rect').attr({
|
||||||
rx: 10,
|
rx: 10,
|
||||||
@ -45,6 +45,6 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
position() {
|
position() {
|
||||||
this.position_label(this.label);
|
this.positionLabel(this.label);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -15,7 +15,7 @@ export default _.extend({}, Base, {
|
|||||||
render() {
|
render() {
|
||||||
this.container.addClass('escape');
|
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({
|
this.label.select('rect').attr({
|
||||||
rx: 3,
|
rx: 3,
|
||||||
|
@ -7,7 +7,7 @@ export default _.extend({}, Base, {
|
|||||||
render() {
|
render() {
|
||||||
this.container.addClass('literal');
|
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({
|
this.label.select('rect').attr({
|
||||||
rx: 3,
|
rx: 3,
|
||||||
|
@ -9,8 +9,8 @@ export default _.extend({}, Base, {
|
|||||||
|
|
||||||
this.contents = {};
|
this.contents = {};
|
||||||
|
|
||||||
if (this.anchor_start()) {
|
if (this.anchorStart()) {
|
||||||
this.contents.anchor_start = this.render_label(this.container, 'Start of line')
|
this.contents.anchor_start = this.renderLabel(this.container, 'Start of line')
|
||||||
.addClass('anchor');
|
.addClass('anchor');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,8 +20,8 @@ export default _.extend({}, Base, {
|
|||||||
return part;
|
return part;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.anchor_end()) {
|
if (this.anchorEnd()) {
|
||||||
this.contents.anchor_end = this.render_label(this.container, 'End of line')
|
this.contents.anchor_end = this.renderLabel(this.container, 'End of line')
|
||||||
.addClass('anchor');
|
.addClass('anchor');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -30,8 +30,8 @@ export default _.extend({}, Base, {
|
|||||||
var offset = 0,
|
var offset = 0,
|
||||||
path = [];
|
path = [];
|
||||||
|
|
||||||
if (this.anchor_start()) {
|
if (this.anchorStart()) {
|
||||||
this.position_label(this.contents.anchor_start);
|
this.positionLabel(this.contents.anchor_start);
|
||||||
offset += this.contents.anchor_start.getBBox().width + 10;
|
offset += this.contents.anchor_start.getBBox().width + 10;
|
||||||
path.push(Snap.format('M{x2},{cy}h10', this.contents.anchor_start.getBBox()));
|
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()));
|
path.push(Snap.format('M{x2},{cy}h10', part.container.getBBox()));
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.anchor_end()) {
|
if (this.anchorEnd()) {
|
||||||
this.position_label(this.contents.anchor_end);
|
this.positionLabel(this.contents.anchor_end);
|
||||||
this.contents.anchor_end.transform(Snap.matrix()
|
this.contents.anchor_end.transform(Snap.matrix()
|
||||||
.translate(offset, 0));
|
.translate(offset, 0));
|
||||||
} else {
|
} else {
|
||||||
@ -57,11 +57,11 @@ export default _.extend({}, Base, {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
anchor_start() {
|
anchorStart() {
|
||||||
return this._anchor_start.textValue !== '';
|
return this._anchor_start.textValue !== '';
|
||||||
},
|
},
|
||||||
|
|
||||||
anchor_end() {
|
anchorEnd() {
|
||||||
return this._anchor_end.textValue !== '';
|
return this._anchor_end.textValue !== '';
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -15,24 +15,24 @@ export default _.extend({}, Base, {
|
|||||||
this._content.position();
|
this._content.position();
|
||||||
|
|
||||||
if (this._repeat.textValue !== '') {
|
if (this._repeat.textValue !== '') {
|
||||||
this._content.container.transform(this._repeat.content_position());
|
this._content.container.transform(this._repeat.contentPosition());
|
||||||
|
|
||||||
box = this._content.container.getBBox();
|
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({
|
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,
|
vert: box.height / 2 - 10,
|
||||||
horiz: box.width - 10
|
horiz: box.width - 10
|
||||||
}, box)));
|
}, 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({
|
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
|
vert: box.height / 2 - 10
|
||||||
}, box)));
|
}, 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));
|
paths.push(Snap.format('M0,{cy}h15M{x2},{cy}h15', box));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,22 +11,22 @@ export default {
|
|||||||
return (this._greedy.textValue !== '');
|
return (this._greedy.textValue !== '');
|
||||||
},
|
},
|
||||||
|
|
||||||
has_skip() {
|
hasSkip() {
|
||||||
return this.minimum() === 0;
|
return this.minimum() === 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
has_loop() {
|
hasLoop() {
|
||||||
return this.maximum() === -1 || this.maximum() > 1;
|
return this.maximum() === -1 || this.maximum() > 1;
|
||||||
},
|
},
|
||||||
|
|
||||||
content_position() {
|
contentPosition() {
|
||||||
var x = 0, y = 0;
|
var x = 0, y = 0;
|
||||||
|
|
||||||
if (this.has_skip()) {
|
if (this.hasSkip()) {
|
||||||
y = 10;
|
y = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.has_skip() || this.has_loop()) {
|
if (this.hasSkip() || this.hasLoop()) {
|
||||||
x = 15;
|
x = 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user