Skip to content

Commit 8b3a4ac

Browse files
authored
text-tool.js -- more debug calls
1 parent bff8fb8 commit 8b3a4ac

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/helper/tools/text-tool.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,19 +180,20 @@ class TextTool extends paper.Tool {
180180
// edge. We need to correct for this in order for the element to overlap the object in paper.
181181
let tx = 0;
182182
if ((this.alignment === "right") && this.element.parentElement) {
183-
if (window.test) tx = window.test({}, this, textBoxMtx);
183+
if (window.test) tx = window.test({}, this, textBoxMtx, viewMtx);
184184
else tx = -this.element.parentElement.clientWidth;
185185
}
186186
if ((this.alignment === "center") && this.element.parentElement) {
187187
const bounds = this.textBox.getBounds();
188-
if (window.test) tx = window.test(bounds, this, textBoxMtx);
188+
if (window.test) tx = window.test(bounds, this, textBoxMtx, viewMtx);
189189
else tx = bounds.x / (1 + paper.view.zoom * 0.5);
190190
}
191191
// The transform origin in paper is x at justification side, y at the baseline of the text.
192192
// The offset from (0, 0) to the upper left corner is recorded by internalBounds
193193
// (so this.textBox.internalBounds.y is negative).
194194
// Move the transform origin down to the text baseline to match paper
195195
this.element.style.transformOrigin = `${-this.textBox.internalBounds.x}px ${-this.textBox.internalBounds.y}px`;
196+
if (window.test2) window.test2();
196197
// Start by translating the element up so that its (0, 0) is now at the text baseline, like in paper
197198
calculated.translate(tx, this.textBox.internalBounds.y);
198199
calculated.append(viewMtx);

0 commit comments

Comments
 (0)