Skip to content

Commit

Permalink
add canvas support
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Christofersen authored and Michael Christofersen committed Jan 3, 2019
1 parent a8b85a5 commit d22ed2f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions dragula.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,14 @@ function dragula (initialContainers, options) {
touchy(documentElement, 'add', 'mousemove', drag);
classes.add(o.mirrorContainer, 'gu-unselectable');
drake.emit('cloned', _mirror, _item, 'mirror');

// Canvas Support
var mirrorCanvases = _mirror.querySelectorAll('canvas');
if(!mirrorCanvases.length) { return; }
_item.querySelectorAll('canvas').forEach(function(sourceCanvas, idx) {
var mirrorContext = mirrorCanvases[idx].getContext('2d');
mirrorContext.drawImage(sourceCanvas, 0, 0);
});
}

function removeMirrorImage () {
Expand Down

0 comments on commit d22ed2f

Please sign in to comment.