M
M
Maxim2016-10-12 22:05:41
Canvas
Maxim, 2016-10-12 22:05:41

Is it possible to set a "wrapper" for the text?

Is it possible to somehow set the positions from which the text will be positioned in the canvas using textAlign?
Something like a wrapper for text.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Александр Коротаев, 2016-10-12
@lekzd

Это попытка пересоздать html для canvas, думаю тут инструмент не располагает необходимыми возможностями.
Но можно их эмулировать, тогда придется писать функцию, которая сможет вывести текст как в блоке - с переносами и выравниванием (measureText() в цикле и прочие алгоритмы). Но если речь про игровой рендер, то игра не стоит свеч - это будет довольно медленно.

X
xmoonlight, 2016-10-12
@xmoonlight

Alexander Korotaev is right: you need to write your own lib with anchor points for manipulating objects by type, as it is implemented in the same Unity3D.
UPD: There is a similar one in the form of a plugin for Crafty.js (DOM, Canvas, WegGL) I work in it, so I know what I'm talking about...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question