将带有画布的 div 元素拖到另一个元素上
我第一次获得了开发 html5 应用程序的经验。我的问题是制定房间计划。在页面顶部,我有一些元素可以拖动到底部地图区域(它们被复制)。在地图区域中,我可以移动元素,但不能复制。
我在图像元素的帮助下构建了拖放功能。但现在我想使用画布来更新图像上的数字。我想使用画布文本函数来更新图像。
问题是当我从顶部复制canvas元素时,html插入得很好,但由于某些原因没有绘制。
请在此处观看代码 http://jsfiddle.net/InsideZ/MuGnv/2/。 代码是为 Google Chrome 编写的。
I'm having my first experience in developing html5 applications. My issue is to make room plan. In the top of the page I have elements to drag to the bottom map area (they are copied). In the map area I can move elements, but not copy.
I've built drag'n'drop with help of image elements. But now I want to use canvas for updating numbers on images. I want to use canvas text functions for updating images.
The problem is when I copy canvas element from the top, html inserts well, but it is not drawn in some reasons.
Please, watch code here http://jsfiddle.net/InsideZ/MuGnv/2/. Code was written for Google Chrome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编辑:
我在这里做了一些小调整: http://jsfiddle.net/MuGnv/5/
请注意对drawImg 函数所做的更改:
每当处理放置事件时,都会再次绘制图像。这是缺少的组件,因为图像只被绘制一次。
EDIT:
I made a few small tweaks here: http://jsfiddle.net/MuGnv/5/
Note the changes made to the drawImg function:
Anytime a drop event is handled, the images are drawn again. This was the missing component as the image was only being drawn once.