EasyUI Forum
September 14, 2025, 01:01:24 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Trouble dragging to a canvas?  (Read 12111 times)
jenn.bohm
Newbie
*
Posts: 2


View Profile Email
« on: May 23, 2012, 02:04:12 PM »

I'm not able to drop a cloned item onto a canvas. When I make the target element a div, it drops there just fine, and when I turn it into a canvas, the dropped item just disappears.

http://jsfiddle.net/fb8gt/1/

droppable is #wall
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: May 28, 2012, 06:08:41 PM »

When dragging an element to HTML5 canvas, the 'onDrop' can be triggered but you cannot add elements into canvas. Please rewrite the 'onDrop' code to draw some text on canvas:
Code:
$('.drop').droppable({
onDragEnter:function(){
$(this).addClass('over');
},
onDragLeave:function(){
$(this).removeClass('over');
},
onDrop:function(e,source){
var s = $(source).find('img').attr('title');  // get the source item text
var ctx = document.getElementById("wall").getContext("2d");
ctx.fillText(s, 10, 10);
}
 });
Logged
jenn.bohm
Newbie
*
Posts: 2


View Profile Email
« Reply #2 on: June 01, 2012, 07:06:00 AM »

Thanks for your help. I thought it was going to be something like that, and it looks like canvas will not work for our application. Fortunately, I have now convinced those who decided to use a canvas of that fact. Smiley
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!