Showing
1 changed file
with
10 additions
and
2 deletions
... | @@ -14,8 +14,14 @@ class Text extends ComponentInterface { | ... | @@ -14,8 +14,14 @@ class Text extends ComponentInterface { |
14 | splited: textSplited, | 14 | splited: textSplited, |
15 | }; | 15 | }; |
16 | this.position = { | 16 | this.position = { |
17 | - top: fabricObj.top, | 17 | + top: |
18 | - left: fabricObj.left, | 18 | + fabricObj.originY == "center" |
19 | + ? fabricObj.top - fabricObj.height / 2 | ||
20 | + : fabricObj.top, | ||
21 | + left: | ||
22 | + fabricObj.originX == "center" | ||
23 | + ? fabricObj.left - fabricObj.width / 2 | ||
24 | + : fabricObj.left, | ||
19 | }; | 25 | }; |
20 | this.font = { | 26 | this.font = { |
21 | size: fabricObj.fontSize, | 27 | size: fabricObj.fontSize, |
... | @@ -33,6 +39,8 @@ class Text extends ComponentInterface { | ... | @@ -33,6 +39,8 @@ class Text extends ComponentInterface { |
33 | { | 39 | { |
34 | top: this.position.top, | 40 | top: this.position.top, |
35 | left: this.position.left, | 41 | left: this.position.left, |
42 | + originX: "left", | ||
43 | + originY: "top", | ||
36 | fontFamily: this.font.family, | 44 | fontFamily: this.font.family, |
37 | fontSize: this.font.size, | 45 | fontSize: this.font.size, |
38 | fontWeight: this.font.weight, | 46 | fontWeight: this.font.weight, | ... | ... |
-
Please register or login to post a comment