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 画布文本编辑


- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- addEventListener 在 IE 11 中不起作用 2022-01-01
- 失败的 Canvas 360 jquery 插件 2022-01-01