2014-11-30 19:10:27 +00:00
|
|
|
import _ from 'lodash';
|
|
|
|
import Base from './base.js';
|
2014-11-30 15:48:33 +00:00
|
|
|
|
2014-11-30 19:10:27 +00:00
|
|
|
export default _.extend({}, Base, {
|
2014-12-03 01:10:56 +00:00
|
|
|
type: 'root',
|
|
|
|
|
2014-12-03 23:59:59 +00:00
|
|
|
render() {
|
|
|
|
this.regexp.container = this.container.group();
|
|
|
|
this.regexp.render();
|
2014-11-30 20:36:53 +00:00
|
|
|
|
2014-12-03 23:59:59 +00:00
|
|
|
this.start = this.container.circle().attr({
|
2014-11-30 20:36:53 +00:00
|
|
|
r: 5,
|
|
|
|
'class': 'anchor'
|
|
|
|
});
|
2014-12-03 23:59:59 +00:00
|
|
|
this.end = this.container.circle().attr({
|
2014-11-30 20:36:53 +00:00
|
|
|
r: 5,
|
|
|
|
'class': 'anchor'
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
position() {
|
|
|
|
var contentBox;
|
|
|
|
|
|
|
|
this.regexp.position();
|
|
|
|
|
2014-12-03 23:59:59 +00:00
|
|
|
contentBox = this.regexp.container.getBBox();
|
2014-11-30 20:36:53 +00:00
|
|
|
|
|
|
|
this.start.transform(Snap.matrix()
|
|
|
|
.translate(contentBox.x, contentBox.cy));
|
|
|
|
this.end.transform(Snap.matrix()
|
|
|
|
.translate(contentBox.x2, contentBox.cy));
|
|
|
|
},
|
|
|
|
|
2014-11-26 23:24:40 +00:00
|
|
|
flags() {
|
|
|
|
var flags;
|
|
|
|
|
2014-12-03 00:59:10 +00:00
|
|
|
if (this._flags) {
|
|
|
|
flags = this._flags.textValue;
|
2014-11-26 23:24:40 +00:00
|
|
|
} else {
|
|
|
|
flags = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
global: /g/.test(flags),
|
|
|
|
ignore_case: /i/.test(flags),
|
|
|
|
multiline: /m/.test(flags)
|
|
|
|
};
|
|
|
|
}
|
2014-11-30 19:10:27 +00:00
|
|
|
});
|