Skip to content

Commit 06f024b

Browse files
obiotclaude
andcommitted
Mark standalone Text.draw() backward compat as deprecated since 10.6.0
The draw() method has a special path for when Text is used without a parent container (ancestor === undefined). This was a backward compatibility patch from the TextMetrics refactor in 10.6.0. Marked as deprecated for future removal. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 42738d0 commit 06f024b

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

  • packages/melonjs/src/renderable/text

packages/melonjs/src/renderable/text/text.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,8 @@ export default class Text extends Renderable {
326326
* @param {number} [y]
327327
*/
328328
draw(renderer, text, x = this.pos.x, y = this.pos.y) {
329-
// "hacky patch" for backward compatibilty
329+
// @deprecated since 10.6.0 — standalone draw without a parent container
330+
// will be removed in a future version. Add the Text to a container instead.
330331
if (typeof this.ancestor === "undefined") {
331332
// update position if changed
332333
if (this.pos.x !== x || this.pos.y !== y) {
@@ -358,7 +359,7 @@ export default class Text extends Renderable {
358359
// draw the text
359360
renderer.drawImage(this.canvasTexture.canvas, x, y);
360361

361-
// for backward compatibilty
362+
// @deprecated since 10.6.0 — standalone draw restore
362363
if (typeof this.ancestor === "undefined") {
363364
// restore previous context
364365
renderer.restore();

0 commit comments

Comments
 (0)