@@ -399,6 +399,29 @@ function computeTraceBounds(scene, trace, bounds) {
399
399
}
400
400
}
401
401
402
+ function computeAnnotationBounds ( scene , bounds ) {
403
+ var sceneLayout = scene . fullSceneLayout ;
404
+ var annotations = sceneLayout . annotations || [ ] ;
405
+
406
+ for ( var d = 0 ; d < 3 ; d ++ ) {
407
+ var axisName = axisProperties [ d ] ;
408
+ var axLetter = axisName . charAt ( 0 ) ;
409
+ var ax = sceneLayout [ axisName ] ;
410
+
411
+ for ( var j = 0 ; j < annotations . length ; j ++ ) {
412
+ var ann = annotations [ j ] ;
413
+
414
+ if ( ann . visible ) {
415
+ var pos = ax . r2l ( ann [ axLetter ] ) ;
416
+ if ( ! isNaN ( pos ) && isFinite ( pos ) ) {
417
+ bounds [ 0 ] [ d ] = Math . min ( bounds [ 0 ] [ d ] , pos ) ;
418
+ bounds [ 1 ] [ d ] = Math . max ( bounds [ 1 ] [ d ] , pos ) ;
419
+ }
420
+ }
421
+ }
422
+ }
423
+ }
424
+
402
425
proto . plot = function ( sceneData , fullLayout , layout ) {
403
426
// Save parameters
404
427
this . plotArgs = [ sceneData , fullLayout , layout ] ;
@@ -443,18 +466,20 @@ proto.plot = function(sceneData, fullLayout, layout) {
443
466
[ Infinity , Infinity , Infinity ] ,
444
467
[ - Infinity , - Infinity , - Infinity ]
445
468
] ;
469
+
446
470
for ( i = 0 ; i < sceneData . length ; ++ i ) {
447
471
data = sceneData [ i ] ;
448
472
if ( data . visible !== true ) continue ;
449
473
450
474
computeTraceBounds ( this , data , dataBounds ) ;
451
475
}
476
+ computeAnnotationBounds ( this , dataBounds ) ;
477
+
452
478
var dataScale = [ 1 , 1 , 1 ] ;
453
479
for ( j = 0 ; j < 3 ; ++ j ) {
454
480
if ( dataBounds [ 1 ] [ j ] === dataBounds [ 0 ] [ j ] ) {
455
481
dataScale [ j ] = 1.0 ;
456
- }
457
- else {
482
+ } else {
458
483
dataScale [ j ] = 1.0 / ( dataBounds [ 1 ] [ j ] - dataBounds [ 0 ] [ j ] ) ;
459
484
}
460
485
}
0 commit comments