yunseok

한글 split

...@@ -2930,6 +2930,11 @@ ...@@ -2930,6 +2930,11 @@
2930 "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==", 2930 "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==",
2931 "dev": true 2931 "dev": true
2932 }, 2932 },
2933 + "hangul-js": {
2934 + "version": "0.2.6",
2935 + "resolved": "https://registry.npmjs.org/hangul-js/-/hangul-js-0.2.6.tgz",
2936 + "integrity": "sha512-48axU8LgjCD30FEs66Xc04/8knxMwCMQw0f67l67rlttW7VXT3qRJgQeHmhiuGwWXGvSbk6YM0fhQlcjE1JFQA=="
2937 + },
2933 "har-schema": { 2938 "har-schema": {
2934 "version": "2.0.0", 2939 "version": "2.0.0",
2935 "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", 2940 "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
21 "dependencies": { 21 "dependencies": {
22 "@babel/plugin-proposal-class-properties": "^7.13.0", 22 "@babel/plugin-proposal-class-properties": "^7.13.0",
23 "gifencoder": "^2.0.1", 23 "gifencoder": "^2.0.1",
24 + "hangul-js": "^0.2.6",
24 "stream": "0.0.2" 25 "stream": "0.0.2"
25 } 26 }
26 } 27 }
......
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
......