Rendering CharsetRange

This commit is contained in:
Jeff Avallone 2014-12-07 17:51:13 -05:00
parent fadfaee440
commit e99c284216
1 changed files with 32 additions and 1 deletions

View File

@ -2,5 +2,36 @@ import _ from 'lodash';
import Base from './base.js';
export default _.extend({}, Base, {
type: 'charset_range'
type: 'charset_range',
render() {
this.first.container = this.container.group();
this.first.render();
this.last.container = this.container.group();
this.last.render();
this.hyphen = this.container.text()
.attr({
text: '-'
});
},
position() {
var box;
this.first.position();
this.last.position();
this.first.container.transform(Snap.matrix()
.translate(0, 0));
box = this.first.container.getBBox();
this.hyphen.transform(Snap.matrix()
.translate(box.x2 + 5, box.cy - this.hyphen.getBBox().cy));
box = this.hyphen.getBBox();
this.last.container.transform(Snap.matrix()
.translate(box.x2 + 5, 0));
}
});