@@ -357,13 +357,10 @@ Phaser.Text.prototype.updateText = function () {
357357
358358 for ( var c = 0 ; c < line . length ; c ++ )
359359 {
360- var section = Math . ceil ( this . context . measureText ( line [ c ] ) . width ) ;
361-
362360 // How far to the next tab?
363- lineWidth += section ;
361+ lineWidth += Math . ceil ( this . context . measureText ( line [ c ] ) . width ) ;
364362
365- var snap = this . game . math . snapToCeil ( lineWidth , tab ) ;
366- var diff = snap - lineWidth ;
363+ var diff = this . game . math . snapToCeil ( lineWidth , tab ) - lineWidth ;
367364
368365 lineWidth += diff ;
369366 }
@@ -467,7 +464,7 @@ Phaser.Text.prototype.updateText = function () {
467464 }
468465 else
469466 {
470- this . renderTabLine ( lines [ i ] , linePositionX , linePositionY ) ;
467+ this . renderTabLine ( lines [ i ] , linePositionX , linePositionY , false ) ;
471468 }
472469 }
473470
@@ -481,7 +478,7 @@ Phaser.Text.prototype.updateText = function () {
481478 }
482479 else
483480 {
484- this . renderTabLine ( lines [ i ] , linePositionX , linePositionY ) ;
481+ this . renderTabLine ( lines [ i ] , linePositionX , linePositionY , true ) ;
485482 }
486483 }
487484 }
@@ -500,28 +497,28 @@ Phaser.Text.prototype.updateText = function () {
500497* @param {string } line - The line of text to render.
501498* @param {integer } x - The x position to start rendering from.
502499* @param {integer } y - The y position to start rendering from.
500+ * @param {boolean } fill - If true uses fillText, if false uses strokeText.
503501*/
504- Phaser . Text . prototype . renderTabLine = function ( line , x , y ) {
502+ Phaser . Text . prototype . renderTabLine = function ( line , x , y , fill ) {
505503
506- // Complex layout (tabs)
507504 var text = line . split ( / (?: \t ) / ) ;
508- var w = 0 ;
509505
510506 for ( var c = 0 ; c < text . length ; c ++ )
511507 {
512508 var section = Math . ceil ( this . context . measureText ( text [ c ] ) . width ) ;
513509
514510 // How far to the next tab?
515511
516- console . log ( text [ c ] , '=' , section ) ;
517-
518- // w += section;
519-
520512 var snap = this . game . math . snapToCeil ( x , this . style . tab ) ;
521513
522- this . context . fillText ( text [ c ] , snap , y ) ;
523-
524- console . log ( 'x' , snap ) ;
514+ if ( fill )
515+ {
516+ this . context . fillText ( text [ c ] , snap , y ) ;
517+ }
518+ else
519+ {
520+ this . context . strokeText ( text [ c ] , snap , y ) ;
521+ }
525522
526523 x = snap + section ;
527524 }
0 commit comments