Explorar o código

fixed calcMaxWidth with inputWidth defined

ncannasse %!s(int64=8) %!d(string=hai) anos
pai
achega
e22e314ab6
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      h2d/TextInput.hx

+ 4 - 1
h2d/TextInput.hx

@@ -257,7 +257,10 @@ class TextInput extends Text {
 
 
 	override function initGlyphs(text:hxd.UString, rebuild = true, handleAlign = true, lines:Array<Int> = null):Void {
 	override function initGlyphs(text:hxd.UString, rebuild = true, handleAlign = true, lines:Array<Int> = null):Void {
 		super.initGlyphs(text, rebuild, handleAlign, lines);
 		super.initGlyphs(text, rebuild, handleAlign, lines);
-		if( rebuild ) this.calcWidth += cursorTile.width; // cursor end pos
+		if( rebuild ) {
+			this.calcWidth += cursorTile.width; // cursor end pos
+			if( inputWidth != null && this.calcWidth > inputWidth ) this.calcWidth = inputWidth;
+		}
 	}
 	}
 
 
 	function textPos( x : Float, y : Float ) {
 	function textPos( x : Float, y : Float ) {