From e99c284216c54fdc061285f200a1a414906aba94 Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Sun, 7 Dec 2014 17:51:13 -0500 Subject: [PATCH] Rendering CharsetRange --- src/js/parser/javascript/charset_range.js | 33 ++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/js/parser/javascript/charset_range.js b/src/js/parser/javascript/charset_range.js index 160983c..cf42498 100644 --- a/src/js/parser/javascript/charset_range.js +++ b/src/js/parser/javascript/charset_range.js @@ -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)); + } });