Skip to content

Commit c64ea1a

Browse files
authored
Update text-tool.js
1 parent c2109ed commit c64ea1a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/helper/tools/text-tool.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ class TextTool extends paper.Tool {
183183
tx = -this.element.parentElement.clientWidth;
184184
}
185185
if ((this.alignment === "center") && this.element.parentElement) {
186-
tx = -this.element.parentElement.clientWidth / 2;
186+
const bounds = this.textBox.getBounds();
187+
tx = bounds.x / (1 + paper.view.zoom * 0.5);
187188
}
188189
// The transform origin in paper is x at justification side, y at the baseline of the text.
189190
// The offset from (0, 0) to the upper left corner is recorded by internalBounds

0 commit comments

Comments
 (0)