Skip to content
Snippets Groups Projects
Commit cd12544d authored by bbaer's avatar bbaer
Browse files

drag and drop is now working

parent 96999d88
No related branches found
No related tags found
1 merge request!27Punktetool
......@@ -224,19 +224,16 @@ $(function (n) {
this.emojis.forEach(function (o) {
$img = $("<img>", {
class: o.class,
src: o.url
src: o.url,
draggable: true
});
$emojiField.append($img);
$img.on("mousedown", function(e) {
$img.on("dragstart", function(e) {
console.log(o.name + " mouseDown");
that.qFabric.dragAndDrop = true;
that.qFabric.dndData = o.url;
$("window").mousedown();
});
$img.on("mouseout", function(e) {
console.log("Mouse Out Event");
that.qFabric.dndMouseOutEvent(e);
})
})
};
......@@ -267,6 +264,7 @@ $(function (n) {
n.Fabric.prototype.generateCanvas = function() {
var canvas = document.createElement('canvas');
canvas.setAttribute('draggable', true);
var controlElement = $('<div>', {
id: 'qfq-fabric-control'
});
......@@ -313,12 +311,11 @@ $(function (n) {
this.canvas.on('object:selected', function(e) { that.defaultSelectionCreateHandler(e) });
this.canvas.on('selection:cleared', function(e) { that.defaultSelectionClearHandler(e) });
window.addEventListener('keydown', function(e) { that.defaultKeyStrokeHandler(e) });
window.addEventListener('mouseup', function(e) { that.windowMouseUpEvent(e) });
$('.canvas').on('contextmenu', function(e) { that.defaultRightClickEvent(e) });
window.addEventListener('dragend', function(e) { that.dragEndEvent(e) });
$(window).resize(function() { that.resizeCanvas(); });
};
n.Fabric.prototype.windowMouseUpEvent = function(e) {
n.Fabric.prototype.dragEndEvent = function(e) {
if (this.dragAndDrop) {
this.emojiAdd(this.dndData, e);
this.dndData = '';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment