HTML5 Canvas Text Edit

前端 未结 3 2009
谎友^
谎友^ 2021-01-13 17:18

I have a text filled in HTML5 canvas using fillText(); How to make it editable and read the value into a variable? The text must be inside canvas, as it will

3条回答
  •  旧时难觅i
    2021-01-13 18:08

    You can not get the text from the canvas. What you need to do is to keep the text in a variable before you use fillText(); and render the canvas. When you want to edit the text in the canvas, you have to paint the canvas again, and read the text from the variable again when you want to render the edited text with fillText();.

提交回复
热议问题