@@ -459,13 +459,28 @@ proto.plot = function(sceneData, fullLayout, layout) {
459459 if ( axis . autorange ) {
460460 sceneBounds [ 0 ] [ i ] = Infinity ;
461461 sceneBounds [ 1 ] [ i ] = - Infinity ;
462- for ( j = 0 ; j < this . glplot . objects . length ; ++ j ) {
463- var objBounds = this . glplot . objects [ j ] . bounds ;
464- sceneBounds [ 0 ] [ i ] = Math . min ( sceneBounds [ 0 ] [ i ] ,
465- objBounds [ 0 ] [ i ] / dataScale [ i ] ) ;
466- sceneBounds [ 1 ] [ i ] = Math . max ( sceneBounds [ 1 ] [ i ] ,
467- objBounds [ 1 ] [ i ] / dataScale [ i ] ) ;
462+
463+ var objects = this . glplot . objects ;
464+ var annotations = this . fullSceneLayout . annotations || [ ] ;
465+ var axLetter = axis . _name . charAt ( 0 ) ;
466+
467+ for ( j = 0 ; j < objects . length ; j ++ ) {
468+ var objBounds = objects [ j ] . bounds ;
469+ sceneBounds [ 0 ] [ i ] = Math . min ( sceneBounds [ 0 ] [ i ] , objBounds [ 0 ] [ i ] / dataScale [ i ] ) ;
470+ sceneBounds [ 1 ] [ i ] = Math . max ( sceneBounds [ 1 ] [ i ] , objBounds [ 1 ] [ i ] / dataScale [ i ] ) ;
471+ }
472+
473+ for ( j = 0 ; j < annotations . length ; j ++ ) {
474+ var ann = annotations [ j ] ;
475+
476+ // N.B. not taking into consideration the arrowhead
477+ if ( ann . visible ) {
478+ var pos = axis . r2l ( ann [ axLetter ] ) ;
479+ sceneBounds [ 0 ] [ i ] = Math . min ( sceneBounds [ 0 ] [ i ] , pos ) ;
480+ sceneBounds [ 1 ] [ i ] = Math . max ( sceneBounds [ 1 ] [ i ] , pos ) ;
481+ }
468482 }
483+
469484 if ( 'rangemode' in axis && axis . rangemode === 'tozero' ) {
470485 sceneBounds [ 0 ] [ i ] = Math . min ( sceneBounds [ 0 ] [ i ] , 0 ) ;
471486 sceneBounds [ 1 ] [ i ] = Math . max ( sceneBounds [ 1 ] [ i ] , 0 ) ;
@@ -793,6 +808,9 @@ function mockAnnAxes(ann, scene) {
793808 // to get setConvert to not execute cleanly
794809 type : 'linear' ,
795810
811+ // don't try to update them on `editable: true`
812+ autorange : false ,
813+
796814 // set infinite range so that annotation draw routine
797815 // does not try to remove 'outside-range' annotations,
798816 // this case is handled in the render loop
0 commit comments