@@ -300,7 +300,7 @@ function getTransformToMoveInsideBar(x0, x1, y0, y1, textBB, orientation) {
300300 scale = Math . min ( barHeight / textWidth , barWidth / textHeight ) ;
301301 }
302302
303- if ( rotate ) rotate = - 90 ; // rotate counter- clockwise
303+ if ( rotate ) rotate = 90 ; // rotate clockwise
304304
305305 // compute text and target positions
306306 if ( rotate ) {
@@ -388,6 +388,8 @@ function getTransformToMoveOutsideBar(x0, x1, y0, y1, textBB, orientation) {
388388 scale = barWidth / textHeight ;
389389 }
390390
391+ if ( rotate ) rotate = 90 ; // rotate clockwise
392+
391393 // compute text and target positions
392394 var textX = ( textBB . left + textBB . right ) / 2 ,
393395 textY = ( textBB . top + textBB . bottom ) / 2 ,
@@ -409,25 +411,21 @@ function getTransformToMoveOutsideBar(x0, x1, y0, y1, textBB, orientation) {
409411 // bar end is on the left hand side
410412 targetX = x1 - textpad - targetWidth / 2 ;
411413 targetY = ( y0 + y1 ) / 2 ;
412- if ( rotate ) rotate = - 90 ; // rotate counter-clockwise
413414 }
414415 else {
415416 targetX = x1 + textpad + targetWidth / 2 ;
416417 targetY = ( y0 + y1 ) / 2 ;
417- if ( rotate ) rotate = 90 ; // rotate clockwise
418418 }
419419 }
420420 else {
421421 if ( y1 > y0 ) {
422422 // bar end is on the bottom
423423 targetX = ( x0 + x1 ) / 2 ;
424424 targetY = y1 + textpad + targetHeight / 2 ;
425- if ( rotate ) rotate = - 90 ; // rotate counter-clockwise
426425 }
427426 else {
428427 targetX = ( x0 + x1 ) / 2 ;
429428 targetY = y1 - textpad - targetHeight / 2 ;
430- if ( rotate ) rotate = 90 ; // rotate clockwise
431429 }
432430 }
433431
0 commit comments