Browse Source

Merge pull request #3336 from sebavan/master

Fixed #3334: Gui Cursor Position infinite loop.
David Catuhe 7 years ago
parent
commit
48ab445502
1 changed files with 1 additions and 1 deletions
  1. 1 1
      gui/src/controls/inputText.ts

+ 1 - 1
gui/src/controls/inputText.ts

@@ -380,7 +380,7 @@ module BABYLON.GUI {
                             this._cursorOffset++;
                             currentSize = context.measureText(text.substr(text.length - this._cursorOffset, this._cursorOffset)).width;
 
-                        } while (currentSize < absoluteCursorPosition);
+                        } while (currentSize < absoluteCursorPosition && (text.length >= this._cursorOffset));
 
                         // Find closest move
                         if (Math.abs(absoluteCursorPosition - currentSize) > previousDist) {