9
9
'use strict' ;
10
10
11
11
var Lib = require ( '../../lib' ) ;
12
+ var Axes = require ( '../../plots/cartesian/axes' ) ;
12
13
var handleArrayContainerDefaults = require ( '../../plots/array_container_defaults' ) ;
13
14
var handleAnnotationCommonDefaults = require ( '../annotations/common_defaults' ) ;
14
15
var attributes = require ( './attributes' ) ;
@@ -26,16 +27,25 @@ function handleAnnotationDefaults(annIn, annOut, sceneLayout, opts, itemOpts) {
26
27
return Lib . coerce ( annIn , annOut , attributes , attr , dflt ) ;
27
28
}
28
29
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
+
29
41
var visible = coerce ( 'visible' , ! itemOpts . itemIsNotPlainObject ) ;
30
42
if ( ! visible ) return annOut ;
31
43
32
44
handleAnnotationCommonDefaults ( annIn , annOut , opts . fullLayout , coerce ) ;
33
45
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' ) ;
39
49
40
50
// if you have one coordinate you should all three
41
51
Lib . noneOrAll ( annIn , annOut , [ 'x' , 'y' , 'z' ] ) ;
0 commit comments