我们可以将复合形状从一个画布拖放到另一个画布 [英] Can we drag and drop Composite shapes from one canvas to another

查看:140
本文介绍了我们可以将复合形状从一个画布拖放到另一个画布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 HTML5 的新手,因为我只知道这方面的基础知识。如果有人能帮助我,这对我来说很棒。

I am new to HTML5, as I know only basics about this. If anyone could help me in this that would be great for me.

我需要设计差异形状并从div拖放到画布。我在画布中使用 globalcomposite 操作创建了不同的形状,现在我需要从画布拖动到另一个画布。

I need to design diff shapes and drag and drop from div to canvas. I created different shapes using globalcomposite operation in canvas, now I need to drag from canvas to another canvas.

I希望有人理解我的观点,任何帮助都会很棒。
jsfiddle.net/rGUma/5/#有些像这样,我需要保留我的设计形状的三个图像是可能的。

I hope some one understood my point any help would be great. jsfiddle.net/rGUma/5/# some what like this,in place those three images i need to keep my design shapes is that possible.

那是不是我的jfiddle它的一个例子,我想要那个
感谢您的回复

That's not my jfiddle its an example,i want like that Thanks for ur response

推荐答案

一旦你画了一个将图像移到画布上,它不再是一个连贯的图像对象,而是成为图形缓冲区中的一堆像素。如果要与这些像素进行交互,则需要以编程方式执行此操作。我认为你不会通过在两个画布上捕捉mousedown,mousemove,mouseout,mouseover和mouseup事件以及绘制用户移动鼠标时用鼠标光标点击的形状来实现自己的拖放功能。

As soon as you draw an image to a canvas, it stops being a coherent image object and becomes a bunch of pixels in a graphic buffer. When you want to interact with these pixels, you need to do this programmatically. I think you won't get around implementing your own drag&drop functionality by catching mousedown, mousemove, mouseout, mouseover and mouseup events on both canvases and drawing the shape the users clicked on at their mouse cursor while they move the mouse.

这篇关于我们可以将复合形状从一个画布拖放到另一个画布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆