Skip to content

Visualize Your Ideas With Code

fix(2d): fix height when tweening text (#905)

Jacob1c6a7965be13
diff --git a/packages/2d/src/lib/components/Txt.ts b/packages/2d/src/lib/components/Txt.ts
index a9b850b6..e3d9cf3b 100644
--- a/packages/2d/src/lib/components/Txt.ts
+++ b/packages/2d/src/lib/components/Txt.ts
@@ -116,6 +116,10 @@ export class Txt extends Shape {
const newSize = this.size();
leaf.text(oldText ?? DEFAULT);
+ if (this.height() === 0) {
+ this.height(newSize.height);
+ }
+
yield* all(
this.size(newSize, time, timingFunction),
leaf.text(value, time, timingFunction, interpolationFunction),