regexper-static/src/js/parser/javascript/base.js

51 lines
902 B
JavaScript
Raw Normal View History

export default {
2014-12-09 23:08:40 +00:00
renderLabel(container, text) {
var group = container.group();
group.rect();
group.text().attr({
text: text
});
return group;
},
2014-12-09 23:08:40 +00:00
positionLabel(group) {
var text = group.select('text'),
rect = group.select('rect'),
box = text.getBBox(),
margin = 5;
text.transform(Snap.matrix()
.translate(margin, box.height + margin));
rect.attr({
width: box.width + 2 * margin,
height: box.height + 2 * margin
});
},
render_bbox(container, box) {
container.path(box.path)
2014-12-04 01:20:08 +00:00
.addClass('bounding-box');
},
render() {
console.log(this);
2014-12-04 01:20:08 +00:00
this.container.addClass('placeholder');
2014-12-09 23:08:40 +00:00
this.label = this.renderLabel(this.container, this.textValue);
this.label.select('rect').attr({
rx: 10,
ry: 10
});
},
position() {
2014-12-09 23:08:40 +00:00
this.positionLabel(this.label);
}
};