Mwni / pixi-text-input

Plugin for pixi.js which provides a convenient way of adding a text input to the pixijs-stage.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiline

Aiysen opened this issue · comments

Hello.

Is option to make multiline input form?

commented

No, not at the moment. It would be required to swap out the input with a textarea. And textareas have their own set of complexities (scrolling, resizing, line height, word wrapping).

If there's enough demand for it Ill do it.

For now you can try to change the sourcecode to instantiate a textarea instead of an input. (function _createDOMInput() on line 119.

I think multiline text form does not need scroll, for me.
PIXI.TextStyle already supports line height and word wrapping

commented

Yes it does support it, however it will probably render differently on pixi. Same goes for line height.
Nevertheless, there's some research to be done...

Could you add multiline in any simple mode?

commented

Try the new version with the option:

new PIXI.TextInput({
	input: {
		multiline: true,
		fontFamily: 'Arial',
		fontSize: '36px',
		...
	},
	box: ...
})

Might want to turn off textSubstitution, as there is a positional jump when focusing the input, due to the discrepancy of the html input text rendering and the canvas text rendering. There's unfortunately no way of determining the native font height.

I think, its okay for now.
Big thank you!