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

37 lines
837 B
JavaScript
Raw Normal View History

import _ from 'lodash';
import Q from 'q';
import Base from './base.js';
export default _.extend({}, Base, {
2014-12-07 22:38:24 +00:00
type: 'charset',
_render() {
2014-12-15 00:08:14 +00:00
this.partContainer = this.container.group();
2014-12-07 22:38:24 +00:00
2014-12-15 00:08:14 +00:00
return Q.all(_.map(this.parts.elements, (part => {
return part.render(this.partContainer.group());
}).bind(this)))
.then((() => {
this.spaceVertically(this.parts.elements, {
padding: 5
});
2014-12-07 22:38:24 +00:00
2014-12-15 00:08:14 +00:00
return this.renderLabeledBox(this.invert() ? 'None of:' : 'One of:', this.partContainer, {
padding: 5
});
}).bind(this));
2014-12-07 22:38:24 +00:00
},
2014-12-15 00:08:14 +00:00
_getAnchor() {
var matrix = this.transform().localMatrix;
return _.extend(Base._getAnchor.call(this), {
ay: matrix.y(0, this.partContainer.getBBox().cy)
});
},
2014-12-07 22:38:24 +00:00
invert() {
return this._invert.textValue !== '';
}
});