|
|
@ -231,7 +231,7 @@ Core.prototype._create = function (container) { |
|
|
|
} |
|
|
|
|
|
|
|
// make sure your target is a vis element
|
|
|
|
if (!event.target.className.includes('vis')) return; |
|
|
|
if (!event.target.className.indexOf("vis") > -1) return; |
|
|
|
|
|
|
|
// make sure only one item is added every time you're over the timeline
|
|
|
|
if (itemAddedToTimeline) return; |
|
|
@ -244,7 +244,7 @@ Core.prototype._create = function (container) { |
|
|
|
function handleDrop(event) { |
|
|
|
// return when dropping non-vis items
|
|
|
|
try { |
|
|
|
var itemData = JSON.parse(event.dataTransfer.getData("text/plain")) |
|
|
|
var itemData = JSON.parse(event.dataTransfer.getData("text")) |
|
|
|
if (!itemData.content) return |
|
|
|
} catch (err) { |
|
|
|
return false; |
|
|
@ -252,8 +252,8 @@ Core.prototype._create = function (container) { |
|
|
|
|
|
|
|
itemAddedToTimeline = false; |
|
|
|
event.center = { |
|
|
|
x: event.x, |
|
|
|
y: event.y |
|
|
|
x: event.clientX, |
|
|
|
y: event.clientY |
|
|
|
} |
|
|
|
me.itemSet._onAddItem(event); |
|
|
|
|
|
|
|