Browse Source

small fix

Royi Bernthal 8 years ago
parent
commit
5728218769
1 changed files with 4 additions and 2 deletions
  1. 4 2
      gui/src/controls/textBlock.ts

+ 4 - 2
gui/src/controls/textBlock.ts

@@ -131,9 +131,11 @@ module BABYLON.GUI {
 
             this._fontSize.ignoreAdaptiveScaling = false;
             
+            var _lines = this.text.split("\n");
+            
             var maxLineWidth: number = 0;
 
-            var _lines = this.text.split("\n").forEach(_line => {
+            _lines.forEach(_line => {
                 //can't get context here? if so, have 2 calculations in _additionalProcessing instead? one for with idealWidth and one without
                 var lineWidth: number = this._parseLine(_line, context).width;
 
@@ -148,7 +150,7 @@ module BABYLON.GUI {
 
             return {
                 width: maxLineWidth,
-                height: this._fontOffset.height * this._lines.length + 'px'
+                height: this._fontOffset.height * _lines.length + 'px'
             }
         }