From 63234a2add566f12e4dcf6569fc6e4850d8a0c5d Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Fri, 21 Jul 2023 16:00:25 +0100 Subject: [PATCH] `Text.setRTL` is a new method that allows you to set a Text Game Object as being rendered from right-to-left, instead of the default left to right (thanks @rexrainbow) --- src/gameobjects/text/Text.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/gameobjects/text/Text.js b/src/gameobjects/text/Text.js index 61896a73ea..f12dc5ff00 100644 --- a/src/gameobjects/text/Text.js +++ b/src/gameobjects/text/Text.js @@ -1139,18 +1139,15 @@ var Text = new Class({ * Render text from right-to-left or left-to-right. * * @method Phaser.GameObjects.Text#setRTL - * @since 3.60.1 + * @since 3.61.0 * * @param {boolean} [rtl=true] - Set to `true` to render from right-to-left. * * @return {this} This Text object. */ - setRTL: function(rtl) + setRTL: function (rtl) { - if (rtl === undefined) - { - rtl = true; - } + if (rtl === undefined) { rtl = true; } var style = this.style; @@ -1166,6 +1163,7 @@ var Text = new Class({ this.canvas.dir = 'rtl'; this.context.direction = 'rtl'; this.canvas.style.display = 'none'; + AddToDOM(this.canvas, this.scene.sys.canvas); } else