@@ -125,13 +125,14 @@ module.exports = function plot(gd, calcData) {
125125
126126 var linkHoverFollow = function ( element , d ) {
127127
128+ var rootBBox = gd . getBoundingClientRect ( ) ;
128129 var boundingBox = element . getBoundingClientRect ( ) ;
129130 var hoverCenterX = boundingBox . left + boundingBox . width / 2 ;
130131 var hoverCenterY = boundingBox . top + boundingBox . height / 2 ;
131132
132133 var tooltip = Fx . loneHover ( {
133- x : hoverCenterX + window . scrollX ,
134- y : hoverCenterY + window . scrollY ,
134+ x : hoverCenterX - rootBBox . left ,
135+ y : hoverCenterY - rootBBox . top ,
135136 name : d3 . format ( d . valueFormat ) ( d . link . value ) + d . valueSuffix ,
136137 text : [
137138 d . link . label ,
@@ -173,15 +174,16 @@ module.exports = function plot(gd, calcData) {
173174 var nodeHoverFollow = function ( element , d ) {
174175
175176 var nodeRect = d3 . select ( element ) . select ( '.nodeRect' ) ;
177+ var rootBBox = gd . getBoundingClientRect ( ) ;
176178 var boundingBox = nodeRect . node ( ) . getBoundingClientRect ( ) ;
177- var hoverCenterX0 = boundingBox . left - 2 ;
178- var hoverCenterX1 = boundingBox . right + 2 ;
179- var hoverCenterY = boundingBox . top + boundingBox . height / 4 ;
179+ var hoverCenterX0 = boundingBox . left - 2 - rootBBox . left ;
180+ var hoverCenterX1 = boundingBox . right + 2 - rootBBox . left ;
181+ var hoverCenterY = boundingBox . top + boundingBox . height / 4 - rootBBox . top ;
180182
181183 var tooltip = Fx . loneHover ( {
182- x0 : hoverCenterX0 + window . scrollX ,
183- x1 : hoverCenterX1 + window . scrollX ,
184- y : hoverCenterY + window . scrollY ,
184+ x0 : hoverCenterX0 ,
185+ x1 : hoverCenterX1 ,
186+ y : hoverCenterY ,
185187 name : d3 . format ( d . valueFormat ) ( d . node . value ) + d . valueSuffix ,
186188 text : [
187189 d . node . label ,
0 commit comments