@@ -276,9 +276,9 @@ function getTransformToMoveInsideBar(x0, x1, y0, y1, textBB) {
276276 textX = ( textBB . left + textBB . right ) / 2 ,
277277 textY = ( textBB . top + textBB . bottom ) / 2 ;
278278
279- // apply target padding
280- var targetWidth = 0.95 * barWidth ,
281- targetHeight = 0.95 * barHeight ;
279+ // apply 3px target padding
280+ var targetWidth = barWidth - 6 ,
281+ targetHeight = barHeight - 6 ;
282282
283283 return getTransform (
284284 textX , textY , textWidth , textHeight ,
@@ -298,14 +298,14 @@ function getTransformToMoveOutsideBar(x0, x1, y0, y1, textBB, orientation) {
298298 if ( orientation === 'h' ) {
299299 if ( x1 < x0 ) {
300300 // bar end is on the left hand side
301- targetWidth = 2 + textWidth ; // padding included
302- targetHeight = Math . abs ( y1 - y0 ) ;
301+ targetWidth = textWidth + 6 ; // 3px padding included
302+ targetHeight = Math . abs ( y1 - y0 ) - 6 ;
303303 targetX = x1 - targetWidth / 2 ;
304304 targetY = ( y0 + y1 ) / 2 ;
305305 }
306306 else {
307- targetWidth = 2 + textWidth ; // padding included
308- targetHeight = Math . abs ( y1 - y0 ) ;
307+ targetWidth = textWidth + 6 ; // padding included
308+ targetHeight = Math . abs ( y1 - y0 ) - 6 ;
309309 targetX = x1 + targetWidth / 2 ;
310310 targetY = ( y0 + y1 ) / 2 ;
311311 }
0 commit comments