99'use strict' ;
1010
1111var Lib = require ( '../../lib' ) ;
12+ var Axes = require ( '../../plots/cartesian/axes' ) ;
1213var handleArrayContainerDefaults = require ( '../../plots/array_container_defaults' ) ;
1314var handleAnnotationCommonDefaults = require ( '../annotations/common_defaults' ) ;
1415var attributes = require ( './attributes' ) ;
@@ -26,16 +27,25 @@ function handleAnnotationDefaults(annIn, annOut, sceneLayout, opts, itemOpts) {
2627 return Lib . coerce ( annIn , annOut , attributes , attr , dflt ) ;
2728 }
2829
30+ function coercePosition ( axLetter ) {
31+ var axName = axLetter + 'axis' ;
32+
33+ // mock in such way that getFromId grabs correct 3D axis
34+ var gdMock = { _fullLayout : { } } ;
35+ gdMock . _fullLayout [ axName ] = sceneLayout [ axName ] ;
36+
37+ return Axes . coercePosition ( annOut , gdMock , coerce , axLetter , axLetter , 0.5 ) ;
38+ }
39+
40+
2941 var visible = coerce ( 'visible' , ! itemOpts . itemIsNotPlainObject ) ;
3042 if ( ! visible ) return annOut ;
3143
3244 handleAnnotationCommonDefaults ( annIn , annOut , opts . fullLayout , coerce ) ;
3345
34- // do not use Axes.coercePosition here
35- // as ax._categories aren't filled in at this stage
36- coerce ( 'x' ) ;
37- coerce ( 'y' ) ;
38- coerce ( 'z' ) ;
46+ coercePosition ( 'x' ) ;
47+ coercePosition ( 'y' ) ;
48+ coercePosition ( 'z' ) ;
3949
4050 // if you have one coordinate you should all three
4151 Lib . noneOrAll ( annIn , annOut , [ 'x' , 'y' , 'z' ] ) ;
0 commit comments