@@ -370,13 +370,13 @@ function drawOne(gd, index, opt, value) {
370
370
*/
371
371
if ( ax ) {
372
372
/*
373
- * hide the annotation if it's pointing
374
- * outside the visible plot ( as long as the axis
375
- * isn't autoranged - then we need to draw it
376
- * anyway to get its bounding box)
373
+ * hide the annotation if it's pointing outside the visible plot
374
+ * as long as the axis isn't autoranged - then we need to draw it
375
+ * anyway to get its bounding box. When we're dragging, an axis can
376
+ * still look autoranged even though it won't be when the drag finishes.
377
377
*/
378
378
var posFraction = ax . r2fraction ( options [ axLetter ] ) ;
379
- if ( ! ax . autorange && ( posFraction < 0 || posFraction > 1 ) ) {
379
+ if ( ( gd . _dragging || ! ax . autorange ) && ( posFraction < 0 || posFraction > 1 ) ) {
380
380
if ( tailRef === axRef ) {
381
381
posFraction = ax . r2fraction ( options [ 'a' + axLetter ] ) ;
382
382
if ( posFraction < 0 || posFraction > 1 ) {
@@ -484,6 +484,15 @@ function drawOne(gd, index, opt, value) {
484
484
Math . round ( annPosPx . x . text - outerwidth / 2 ) ,
485
485
Math . round ( annPosPx . y . text - outerheight / 2 ) ) ;
486
486
487
+ /*
488
+ * rotate text and background
489
+ * we already calculated the text center position *as rotated*
490
+ * because we needed that for autoranging anyway, so now whether
491
+ * we have an arrow or not, we rotate about the text center.
492
+ */
493
+ annTextGroup . attr ( { transform : 'rotate(' + textangle + ',' +
494
+ annPosPx . x . text + ',' + annPosPx . y . text + ')' } ) ;
495
+
487
496
var annbase = 'annotations[' + index + ']' ;
488
497
489
498
/*
@@ -742,10 +751,6 @@ function drawOne(gd, index, opt, value) {
742
751
} ) ;
743
752
}
744
753
else annText . call ( textLayout ) ;
745
-
746
- // rotate and position text and background
747
- annTextGroup . attr ( { transform : 'rotate(' + textangle + ',' +
748
- annPosPx . x . text + ',' + annPosPx . y . text + ')' } ) ;
749
754
}
750
755
751
756
// look for intersection of two line segments
0 commit comments