@@ -75,6 +75,74 @@ describe('Test gl3d plots', function() {
75
75
destroyGraphDiv ( ) ;
76
76
} ) ;
77
77
78
+ it ( '@gl should not rotate camera on the very first click before scene is complete and modebar setup' , function ( done ) {
79
+ var _mock = Lib . extendDeep (
80
+ {
81
+ layout : {
82
+ scene : {
83
+ camera : {
84
+ up : {
85
+ x : 0 ,
86
+ y : 0 ,
87
+ z : 1
88
+ } ,
89
+ eye : {
90
+ x : 1.2 ,
91
+ y : 1.2 ,
92
+ z : 1.2
93
+ } ,
94
+ center : {
95
+ x : 0 ,
96
+ y : 0 ,
97
+ z : 0
98
+ }
99
+ }
100
+ }
101
+ }
102
+ } ,
103
+ mock2
104
+ ) ;
105
+
106
+ // N.B. gl3d click events are 'mouseover' events
107
+ // with button 1 pressed
108
+ function _click ( ) {
109
+ mouseEvent ( 'mouseover' , 605 , 271 , { buttons : 1 } ) ;
110
+ return delay ( 20 ) ( ) ;
111
+ }
112
+
113
+ Plotly . plot ( gd , _mock )
114
+ . then ( delay ( 20 ) )
115
+ . then ( function ( ) {
116
+ gd . on ( 'plotly_click' , function ( eventData ) {
117
+ ptData = eventData . points [ 0 ] ;
118
+ } ) ;
119
+ } )
120
+ . then ( _click )
121
+ . then ( delay ( 20 ) )
122
+ . then ( function ( ) {
123
+ expect ( gd . _fullLayout . scene . camera . up . x ) . toEqual ( 0 , 'camera.up.x' ) ;
124
+ expect ( gd . _fullLayout . scene . camera . up . y ) . toEqual ( 0 , 'camera.up.y' ) ;
125
+ expect ( gd . _fullLayout . scene . camera . up . z ) . toEqual ( 1 , 'camera.up.z' ) ;
126
+ expect ( gd . _fullLayout . scene . camera . eye . x ) . toEqual ( 1.2 , 'camera.eye.x' ) ;
127
+ expect ( gd . _fullLayout . scene . camera . eye . y ) . toEqual ( 1.2 , 'camera.eye.y' ) ;
128
+ expect ( gd . _fullLayout . scene . camera . eye . z ) . toEqual ( 1.2 , 'camera.eye.z' ) ;
129
+ expect ( gd . _fullLayout . scene . camera . center . x ) . toEqual ( 0 , 'camera.center.x' ) ;
130
+ expect ( gd . _fullLayout . scene . camera . center . y ) . toEqual ( 0 , 'camera.center.y' ) ;
131
+ expect ( gd . _fullLayout . scene . camera . center . z ) . toEqual ( 0 , 'camera.center.z' ) ;
132
+
133
+ expect ( gd . _fullLayout . scene . _scene . glplot . camera . up [ 0 ] ) . toEqual ( 0 , 'camera.up[0]' ) ;
134
+ expect ( gd . _fullLayout . scene . _scene . glplot . camera . up [ 1 ] ) . toEqual ( 0 , 'camera.up[1]' ) ;
135
+ expect ( gd . _fullLayout . scene . _scene . glplot . camera . up [ 2 ] ) . toEqual ( 1 , 'camera.up[2]' ) ;
136
+ expect ( gd . _fullLayout . scene . _scene . glplot . camera . eye [ 0 ] ) . toBeCloseTo ( 1.2 , 6 , 'camera.eye[0]' ) ;
137
+ expect ( gd . _fullLayout . scene . _scene . glplot . camera . eye [ 1 ] ) . toBeCloseTo ( 1.2 , 6 , 'camera.eye[1]' ) ;
138
+ expect ( gd . _fullLayout . scene . _scene . glplot . camera . eye [ 2 ] ) . toBeCloseTo ( 1.2 , 6 , 'camera.eye[2]' ) ;
139
+ expect ( gd . _fullLayout . scene . _scene . glplot . camera . center [ 0 ] ) . toEqual ( 0 , 'camera.center[0]' ) ;
140
+ expect ( gd . _fullLayout . scene . _scene . glplot . camera . center [ 1 ] ) . toEqual ( 0 , 'camera.center[1]' ) ;
141
+ expect ( gd . _fullLayout . scene . _scene . glplot . camera . center [ 2 ] ) . toEqual ( 0 , 'camera.center[2]' ) ;
142
+ } )
143
+ . then ( done ) ;
144
+ } ) ;
145
+
78
146
it ( '@noCI @gl should display correct hover labels of the second point of the very first scatter3d trace' , function ( done ) {
79
147
var _mock = Lib . extendDeep ( { } , multipleScatter3dMock ) ;
80
148
0 commit comments