简体   繁体   English

双击从Canvas网格中删除图像

[英]Removing an Image from Canvas Grid on Double Click

I'm Dragging and Drooping an image from a toolbar onto a canvas and then moving it around in the canvas.Currently I'm able to load multiple images onto a canvas multiple times from the toolbar and delete them on double click as shown in the link below. 我将图像从工具栏拖放到画布上,然后在画布中四处移动。目前,我可以从工具栏中多次加载多个图像到画布上,并双击删除它们,如图所示。下方链接。

http://jsfiddle.net/gkefk/33/ http://jsfiddle.net/gkefk/33/

I want to add the same functionality on a grid of deleting a particular copy of the image from the canvas grid when the user double clicks on that particular image.For this I'm triggering the same jQuery event on double click which i used in the 1st link. 我想在用户双击画布上的特定图像时从画布网格中删除该图像的特定副本的网格上添加相同的功能。为此,我在双击时触发了相同的jQuery事件。第一个链接。

$("#image").dblclick(function(){
layer.remove();
});

Even though I'm double clicking on a particular copy the image,that particular copy is not getting deleted from the grid.I can't understand what I'm doing wrong..Please Help 即使我双击某个特定副本的图像,该特定副本也不会从网格中删除。我无法理解我做错了什么。请帮助

The link to the fiddle containing the jQuery event 包含jQuery事件的小提琴的链接

http://jsfiddle.net/Lucy1/wQ8YA/31/ http://jsfiddle.net/Lucy1/wQ8YA/31/

Remove the clone instead of the image 删除克隆而不是映像

$clone.on('dblclick', function () {
    $clone.remove();
    layer.draw();
});

jsFiddle demo jsFiddle演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM