A bug on FireFox creates a situation where an <svg> element has a boundingRect.top of -180000 (or some really big number). Added some defensive code in tooltip.js to prevent the tooltip from being positioned at the very bottom.
This commit is contained in:
parent
9315679dc7
commit
3b83d8380a
@ -152,7 +152,16 @@ window.nv.tooltip.* also has various helper methods.
|
||||
if (svgComp) {
|
||||
var svgBound = svgComp.getBoundingClientRect();
|
||||
var chartBound = chartContainer.getBoundingClientRect();
|
||||
svgOffset.top = Math.abs(svgBound.top - chartBound.top);
|
||||
var svgBoundTop = svgBound.top;
|
||||
|
||||
//Defensive code. Sometimes, svgBoundTop can be a really negative
|
||||
// number, like -134254. That's a bug.
|
||||
// If such a number is found, use zero instead. FireFox bug only
|
||||
if (svgBoundTop < 0) {
|
||||
var containerBound = chartContainer.getBoundingClientRect();
|
||||
svgBoundTop = (Math.abs(svgBoundTop) > containerBound.height) ? 0 : svgBoundTop;
|
||||
}
|
||||
svgOffset.top = Math.abs(svgBoundTop - chartBound.top);
|
||||
svgOffset.left = Math.abs(svgBound.left - chartBound.left);
|
||||
}
|
||||
//If the parent container is an overflow <div> with scrollbars, subtract the scroll offsets.
|
||||
|
Loading…
Reference in New Issue
Block a user