1
0
Fork 0

Fixes false positioning of edge #894. Tested in FF, Chrome, Safari, IE11 (all newest versions)

This commit is contained in:
Michael Hackstein 2014-07-09 12:19:22 +02:00
parent 5ccc4cb2c0
commit 74c8752d97
1 changed files with 15 additions and 3 deletions

View File

@ -126,10 +126,22 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, start, dispatcher
},
getCursorPositionInSVG = function (ev) {
var pos = getCursorPosition(ev),
off = $('svg#graphViewerSVG').offset();
off = $('svg#graphViewerSVG').offset(),
svg, bBox, bCR;
svg = d3.select("svg#graphViewerSVG").node();
// Normal case. SVG has no clipped view box.
bCR = svg.getBoundingClientRect();
if ($("svg#graphViewerSVG").height() <= bCR.height ) {
return {
x: pos.x - off.left,
y: pos.y - off.top
};
}
// Firefox case. SVG has a clipped view box.
bBox = svg.getBBox();
return {
x: pos.x - off.left,
y: pos.y - off.top
x: pos.x - (bCR.left - bBox.x),
y: pos.y - (bCR.top - bBox.y)
};
},
callbacks = {