mirror of
https://github.com/photonstorm/phaser
synced 2025-02-17 06:28:30 +00:00
Don't draw text only when width or height is 0
It can fix this issue: Text is empty string '', but have fixedWidth and fixedHeight, with backgroundColor setting.
This commit is contained in:
parent
cc7870906b
commit
9a958631fc
3 changed files with 6 additions and 4 deletions
|
@ -185,7 +185,7 @@ var Text = new Class({
|
|||
* @private
|
||||
* @since 3.12.0
|
||||
*/
|
||||
this._text = '';
|
||||
this._text = undefined;
|
||||
|
||||
/**
|
||||
* Specify a padding value which is added to the line width and height when calculating the Text size.
|
||||
|
|
|
@ -21,10 +21,12 @@
|
|||
*/
|
||||
var TextCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||
{
|
||||
if (src.text !== '')
|
||||
if ((src.width === 0) || (src.height === 0))
|
||||
{
|
||||
renderer.batchSprite(src, src.frame, camera, parentMatrix);
|
||||
return;
|
||||
}
|
||||
|
||||
renderer.batchSprite(src, src.frame, camera, parentMatrix);
|
||||
};
|
||||
|
||||
module.exports = TextCanvasRenderer;
|
||||
|
|
|
@ -23,7 +23,7 @@ var Utils = require('../../../renderer/webgl/Utils');
|
|||
*/
|
||||
var TextWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||
{
|
||||
if (src.text === '')
|
||||
if ((src.width === 0) || (src.height === 0))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue