Skip to content

Commit

Permalink
Text.setRTL is a new method that allows you to set a Text Game Obje…
Browse files Browse the repository at this point in the history
…ct as being rendered from right-to-left, instead of the default left to right (thanks @rexrainbow)
  • Loading branch information
photonstorm committed Jul 21, 2023
1 parent 36d658e commit 63234a2
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/gameobjects/text/Text.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
Expand Down

0 comments on commit 63234a2

Please sign in to comment.