HTML5 Canvas Text Edit(HTML5 画布文本编辑)
问题描述
我在 HTML5 画布中使用 fillText(); 填充了一个文本如何使其可编辑并将值读入变量?文本必须在画布内,因为它会写在一些复杂的多边形内.
无法从画布中获取文本.您需要做的是在使用 fillText(); 并渲染画布之前将文本保存在变量中.当你想编辑画布中的文本时,你必须重新绘制画布,当你想用
.p>fillText();
渲染编辑的文本时,你必须再次从变量中读取文本.
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 be written inside some complex polygon shape.
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();
.
这篇关于HTML5 画布文本编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:HTML5 画布文本编辑


基础教程推荐
- 如何在特定日期之前获取消息? 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01