From 0fcd5cc4b9466cb8c3848f61a2c86200239127ed Mon Sep 17 00:00:00 2001 From: Dimitris - Rafail Katsampas Date: Sat, 30 Nov 2024 18:42:41 +0200 Subject: [PATCH] fix(Input): Cursor should inherit text fill color of multiple formats --- src/Input.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Input.ts b/src/Input.ts index 572bfafd..19539d50 100644 --- a/src/Input.ts +++ b/src/Input.ts @@ -179,14 +179,22 @@ export class Input extends Container this.inputField = new this.options.TextClass('', textStyle); this._cursor = new Sprite(Texture.WHITE); + if ('tint' in options.textStyle) { this._cursor.tint = options.textStyle.tint; } + else if ('fill' in options.textStyle) + { + const fill = options.textStyle.fill; + + this._cursor.tint = typeof fill === 'string' || typeof fill === 'number' ? fill : 0x000000; + } else { - this._cursor.tint = Number((options.textStyle as TextStyle).fill) || 0x000000; + this._cursor.tint = 0x000000; } + this._cursor.anchor.set(0.5); this._cursor.width = 2; this._cursor.height = this.inputField.height * 0.8;