Skip to content

Commit

Permalink
fix(Input): Cursor should inherit text fill color of multiple formats
Browse files Browse the repository at this point in the history
  • Loading branch information
CatchABus committed Dec 1, 2024
1 parent 5812116 commit fd61743
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit fd61743

Please sign in to comment.