yunseok

한글 splited

1 import ComponentInterface from "./ComponentInterface" 1 import ComponentInterface from "./ComponentInterface"
2 import Color from "./Color" 2 import Color from "./Color"
3 +import Hangul from "hangul-js"
3 4
4 class Text extends ComponentInterface { 5 class Text extends ComponentInterface {
5 constructor(fabricObj) { 6 constructor(fabricObj) {
6 super(); 7 super();
7 this.color = new Color(fabricObj.fill); 8 this.color = new Color(fabricObj.fill);
8 - this.text = fabricObj.text; 9 + this.text = {
10 + plain:fabricObj.text,
11 + splited:Hangul.disassemble(fabricObj.text)
12 + };
9 this.position = { 13 this.position = {
10 top:fabricObj.top, 14 top:fabricObj.top,
11 left:fabricObj.left 15 left:fabricObj.left
......
1 +{
2 + "requires": true,
3 + "lockfileVersion": 1,
4 + "dependencies": {
5 + "hangul-js": {
6 + "version": "0.2.6",
7 + "resolved": "https://registry.npmjs.org/hangul-js/-/hangul-js-0.2.6.tgz",
8 + "integrity": "sha512-48axU8LgjCD30FEs66Xc04/8knxMwCMQw0f67l67rlttW7VXT3qRJgQeHmhiuGwWXGvSbk6YM0fhQlcjE1JFQA=="
9 + }
10 + }
11 +}