Skip to content

Commit 0c52b93

Browse files
committed
Text with lineSpacing set wouldn't apply the lineSpacing to the final line of text in the Text string, or to text with just single lines. This could lead to incorrect height calculations for further layout and unwanted padding at the bottom of Text objects (thanks @Lopdo phaserjs#2137)
1 parent 15411f1 commit 0c52b93

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/
379379
* If the Mouse was over a Sprite and you then clicked it, it would dispatch another Over event. This is now surpressed if the Over event has already been dispatched previously (thanks @McFarts #2133)
380380
* InputHandler.pointerOver could fail to return anything in some instances, now always returns a boolean.
381381
* Tween.onLoop would be fired when a Tween repeated and Tween.onRepeat would be fired when a Tween looped. These are now reversed to fire correctly (thanks @vladkens #2024)
382+
* Text with lineSpacing set wouldn't apply the lineSpacing to the final line of text in the Text string, or to text with just single lines. This could lead to incorrect height calculations for further layout and unwanted padding at the bottom of Text objects (thanks @Lopdo #2137)
382383

383384
### Pixi Updates
384385

src/gameobjects/Text.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,7 @@ Phaser.Text.prototype.updateText = function () {
439439
// Adjust for line spacing
440440
if (lineSpacing !== 0)
441441
{
442-
var diff = lineSpacing * (lines.length - 1);
443-
height += diff;
442+
height += lineSpacing * lines.length;
444443
}
445444

446445
this.canvas.height = height * this._res;

0 commit comments

Comments
 (0)