@@ -276,9 +276,9 @@ function getTransformToMoveInsideBar(x0, x1, y0, y1, textBB) {
276
276
textX = ( textBB . left + textBB . right ) / 2 ,
277
277
textY = ( textBB . top + textBB . bottom ) / 2 ;
278
278
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 ;
282
282
283
283
return getTransform (
284
284
textX , textY , textWidth , textHeight ,
@@ -298,14 +298,14 @@ function getTransformToMoveOutsideBar(x0, x1, y0, y1, textBB, orientation) {
298
298
if ( orientation === 'h' ) {
299
299
if ( x1 < x0 ) {
300
300
// 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 ;
303
303
targetX = x1 - targetWidth / 2 ;
304
304
targetY = ( y0 + y1 ) / 2 ;
305
305
}
306
306
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 ;
309
309
targetX = x1 + targetWidth / 2 ;
310
310
targetY = ( y0 + y1 ) / 2 ;
311
311
}
0 commit comments