I have no clue of what is going on. The code is pretty same of the demo I've linked above. There is no calculations over the coordinates or anything.
Thanks in advance.
mxDragSource.prototype.getDropTarget = function(graph, x, y, evt)
{
var scrollTop = document.getElementById("WorkflowEditTabStrip-1").scrollTop;
y-= scrollTop;
return old_DragSource_getDropTarget.call(this, graph, x, y, evt);
};mxGraph.prototype.getDropTarget = function(cells, evt, cell, clone)
{
var scrollTop = document.getElementById("WorkflowEditTabStrip-1").scrollTop,
result = null,
oldPanDy = this.panDy;
this.panDy = scrollTop;
var result = old_mxGraph_getDropTarget.call(this, cells, evt, cell, clone);
this.panDy = oldPanDy;
return result;
};var origin = new mxPoint(graph.container.scrollLeft, graph.container.scrollTop);
var origin2 = mxUtils.getDocumentScrollOrigin(document);
origin.x += origin2.x;
origin.y += origin2.y;
mxDragSource.prototype.drop = function(graph, evt, dropTarget, x, y)
{
var scrollTop = document.getElementById("WorkflowEditTabStrip-1").scrollTop;
y-= dropTarget.getGeometry().y + scrollTop;
this.dropHandler(graph, evt, dropTarget, x, y);
if (graph.container.style.visibility != 'hidden')
{
graph.container.focus();
}
};mxUtils.getScrollOrigin = function(node, includeAncestors, includeDocument)
{
includeAncestors = (includeAncestors != null) ? includeAncestors : false;
includeDocument = (includeDocument != null) ? includeDocument : true;
var doc = (node != null) ? node.ownerDocument : document;
var b = doc.body;
var d = doc.documentElement;
var result = new mxPoint();
var fixed = false;
while (node != null && node != b && node != d)
{
if (!isNaN(node.scrollLeft) && !isNaN(node.scrollTop))
{
result.x += node.scrollLeft;
result.y += node.scrollTop;
}
var style = mxUtils.getCurrentStyle(node);
if (style != null)
{
fixed = fixed || style.position == 'fixed';
}
node = (includeAncestors) ? node.parentNode : null;
}
if (!fixed && includeDocument)
{
var origin = mxUtils.getDocumentScrollOrigin(doc);
result.x += origin.x;
result.y += origin.y;
}
return result;
};
mxDragSource.prototype.drop = function(graph, evt, dropTarget, x, y)
{
// My fix
y-= dropTarget.getGeometry().y;
// Original code
this.dropHandler(graph, evt, dropTarget, x, y);
if (graph.container.style.visibility != 'hidden')
{
graph.container.focus();
}
};