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