@@ -575,13 +575,19 @@ describe('Test gl3d modebar handlers - perspective case', function() {
575
575
buttonDefault . click ( ) ;
576
576
} ) ;
577
577
578
- it ( '@gl button resetCameraDefault3d should reset to initial aspectratios' , function ( done ) {
578
+ it ( '@gl button resetCameraDefault3d should reset to initial aspectmode & aspectratios' , function ( done ) {
579
579
var buttonDefault = selectButton ( modeBar , 'resetCameraDefault3d' ) ;
580
580
581
+ expect ( gd . _fullLayout . scene . _scene . viewInitial . aspectmode ) . toEqual ( 'auto' ) ;
582
+ expect ( gd . _fullLayout . scene2 . _scene . viewInitial . aspectmode ) . toEqual ( 'manual' ) ;
583
+
581
584
expect ( gd . _fullLayout . scene . _scene . viewInitial . aspectratio ) . toEqual ( { x : 1 , y : 1 , z : 1 } ) ;
582
585
expect ( gd . _fullLayout . scene2 . _scene . viewInitial . aspectratio ) . toEqual ( { x : 3 , y : 2 , z : 1 } ) ;
583
586
584
587
gd . once ( 'plotly_relayout' , function ( ) {
588
+ expect ( gd . _fullLayout . scene . _scene . fullSceneLayout . aspectmode ) . toBe ( 'auto' ) ;
589
+ expect ( gd . _fullLayout . scene2 . _scene . fullSceneLayout . aspectmode ) . toBe ( 'manual' ) ;
590
+
585
591
expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . x ) . toBeCloseTo ( 1 ) ;
586
592
expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . y ) . toBeCloseTo ( 1 ) ;
587
593
expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . z ) . toBeCloseTo ( 1 ) ;
@@ -595,9 +601,12 @@ describe('Test gl3d modebar handlers - perspective case', function() {
595
601
buttonDefault . click ( ) ;
596
602
} ) ;
597
603
598
- it ( '@gl button resetCameraLastSave3d should reset to initial aspectratios' , function ( done ) {
604
+ it ( '@gl button resetCameraLastSave3d should reset to initial aspectmode & aspectratios' , function ( done ) {
599
605
var buttonDefault = selectButton ( modeBar , 'resetCameraDefault3d' ) ;
600
606
607
+ expect ( gd . _fullLayout . scene . _scene . viewInitial . aspectmode ) . toEqual ( 'auto' ) ;
608
+ expect ( gd . _fullLayout . scene2 . _scene . viewInitial . aspectmode ) . toEqual ( 'manual' ) ;
609
+
601
610
expect ( gd . _fullLayout . scene . _scene . viewInitial . aspectratio ) . toEqual ( { x : 1 , y : 1 , z : 1 } ) ;
602
611
expect ( gd . _fullLayout . scene2 . _scene . viewInitial . aspectratio ) . toEqual ( { x : 3 , y : 2 , z : 1 } ) ;
603
612
@@ -771,13 +780,19 @@ describe('Test gl3d modebar handlers - orthographic case', function() {
771
780
buttonDefault . click ( ) ;
772
781
} ) ;
773
782
774
- it ( '@gl button resetCameraDefault3d should reset to initial aspectratios' , function ( done ) {
783
+ it ( '@gl button resetCameraDefault3d should reset to initial aspectmode & aspectratios' , function ( done ) {
775
784
var buttonDefault = selectButton ( modeBar , 'resetCameraDefault3d' ) ;
776
785
786
+ expect ( gd . _fullLayout . scene . _scene . viewInitial . aspectmode ) . toEqual ( 'auto' ) ;
787
+ expect ( gd . _fullLayout . scene2 . _scene . viewInitial . aspectmode ) . toEqual ( 'manual' ) ;
788
+
777
789
expect ( gd . _fullLayout . scene . _scene . viewInitial . aspectratio ) . toEqual ( { x : 1 , y : 1 , z : 1 } ) ;
778
790
expect ( gd . _fullLayout . scene2 . _scene . viewInitial . aspectratio ) . toEqual ( { x : 3 , y : 2 , z : 1 } ) ;
779
791
780
792
gd . once ( 'plotly_relayout' , function ( ) {
793
+ expect ( gd . _fullLayout . scene . _scene . aspectmode ) . toEqual ( undefined ) ;
794
+ expect ( gd . _fullLayout . scene2 . _scene . aspectmode ) . toEqual ( undefined ) ;
795
+
781
796
expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . x ) . toBeCloseTo ( 1 ) ;
782
797
expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . y ) . toBeCloseTo ( 1 ) ;
783
798
expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . z ) . toBeCloseTo ( 1 ) ;
@@ -791,13 +806,19 @@ describe('Test gl3d modebar handlers - orthographic case', function() {
791
806
buttonDefault . click ( ) ;
792
807
} ) ;
793
808
794
- it ( '@gl button resetCameraLastSave3d should reset to initial aspectratios' , function ( done ) {
809
+ it ( '@gl button resetCameraLastSave3d should reset to initial aspectmode & aspectratios' , function ( done ) {
795
810
var buttonDefault = selectButton ( modeBar , 'resetCameraDefault3d' ) ;
796
811
812
+ expect ( gd . _fullLayout . scene . _scene . viewInitial . aspectmode ) . toEqual ( 'auto' ) ;
813
+ expect ( gd . _fullLayout . scene2 . _scene . viewInitial . aspectmode ) . toEqual ( 'manual' ) ;
814
+
797
815
expect ( gd . _fullLayout . scene . _scene . viewInitial . aspectratio ) . toEqual ( { x : 1 , y : 1 , z : 1 } ) ;
798
816
expect ( gd . _fullLayout . scene2 . _scene . viewInitial . aspectratio ) . toEqual ( { x : 3 , y : 2 , z : 1 } ) ;
799
817
800
818
gd . once ( 'plotly_relayout' , function ( ) {
819
+ expect ( gd . _fullLayout . scene . _scene . fullSceneLayout . aspectmode ) . toBe ( 'auto' ) ;
820
+ expect ( gd . _fullLayout . scene2 . _scene . fullSceneLayout . aspectmode ) . toBe ( 'manual' ) ;
821
+
801
822
expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . x ) . toBeCloseTo ( 1 ) ;
802
823
expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . y ) . toBeCloseTo ( 1 ) ;
803
824
expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . z ) . toBeCloseTo ( 1 ) ;
@@ -1175,7 +1196,7 @@ describe('Test gl3d drag and wheel interactions', function() {
1175
1196
. then ( done ) ;
1176
1197
} ) ;
1177
1198
1178
- it ( '@gl should update the scene aspectratio when zooming with scroll wheel i.e. orthographic case' , function ( done ) {
1199
+ it ( '@gl should update the scene aspectmode & aspectratio when zooming with scroll wheel i.e. orthographic case' , function ( done ) {
1179
1200
var sceneLayout , sceneLayout2 , sceneTarget , sceneTarget2 ;
1180
1201
1181
1202
var mock = {
@@ -1192,8 +1213,13 @@ describe('Test gl3d drag and wheel interactions', function() {
1192
1213
var aspectratio ;
1193
1214
var relayoutEvent ;
1194
1215
var relayoutCnt = 0 ;
1216
+ var modeBar ;
1195
1217
1196
1218
Plotly . plot ( gd , mock )
1219
+ . then ( delay ( 20 ) )
1220
+ . then ( function ( ) {
1221
+ modeBar = gd . _fullLayout . _modeBar ;
1222
+ } )
1197
1223
. then ( function ( ) {
1198
1224
gd . on ( 'plotly_relayout' , function ( e ) {
1199
1225
relayoutCnt ++ ;
@@ -1220,6 +1246,7 @@ describe('Test gl3d drag and wheel interactions', function() {
1220
1246
expect ( aspectratio . z ) . toBeCloseTo ( 0.909 , 3 , 'aspectratio.z' ) ;
1221
1247
1222
1248
expect ( relayoutEvent [ 'scene.aspectmode' ] ) . toBe ( 'manual' ) ;
1249
+ expect ( gd . _fullLayout . scene . _scene . fullSceneLayout . aspectmode ) . toBe ( 'manual' ) ;
1223
1250
} )
1224
1251
. then ( function ( ) {
1225
1252
return scroll ( sceneTarget2 ) ;
@@ -1232,7 +1259,24 @@ describe('Test gl3d drag and wheel interactions', function() {
1232
1259
expect ( aspectratio . y ) . toBeCloseTo ( 1.818 , 3 , 'aspectratio.y' ) ;
1233
1260
expect ( aspectratio . z ) . toBeCloseTo ( 0.909 , 3 , 'aspectratio.z' ) ;
1234
1261
1235
- expect ( relayoutEvent [ 'scene.aspectmode' ] ) . not . toBe ( 'manual' ) ;
1262
+ expect ( relayoutEvent [ 'scene2.aspectmode' ] ) . toBe ( 'manual' ) ;
1263
+ expect ( gd . _fullLayout . scene2 . _scene . fullSceneLayout . aspectmode ) . toBe ( 'manual' ) ;
1264
+ } )
1265
+ . then ( function ( ) {
1266
+ var buttonDefault = selectButton ( modeBar , 'resetCameraDefault3d' ) ;
1267
+
1268
+ buttonDefault . click ( ) ;
1269
+ } )
1270
+ . then ( function ( ) {
1271
+ expect ( gd . _fullLayout . scene . _scene . aspectmode ) . toEqual ( undefined ) ;
1272
+ expect ( gd . _fullLayout . scene2 . _scene . aspectmode ) . toEqual ( undefined ) ;
1273
+
1274
+ expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . x ) . toBeCloseTo ( 1 ) ;
1275
+ expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . y ) . toBeCloseTo ( 1 ) ;
1276
+ expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . z ) . toBeCloseTo ( 1 ) ;
1277
+ expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . x ) . toBeCloseTo ( 3 ) ;
1278
+ expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . y ) . toBeCloseTo ( 2 ) ;
1279
+ expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . z ) . toBeCloseTo ( 1 ) ;
1236
1280
} )
1237
1281
. catch ( failTest )
1238
1282
. then ( done ) ;
@@ -1464,6 +1508,7 @@ describe('Test gl3d drag and wheel interactions', function() {
1464
1508
expect ( aspectratio . z ) . toBeCloseTo ( 1.269 , 3 , 'aspectratio.z' ) ;
1465
1509
1466
1510
expect ( relayoutEvent [ 'scene.aspectmode' ] ) . toBe ( 'manual' ) ;
1511
+ expect ( gd . _fullLayout . scene . _scene . fullSceneLayout . aspectmode ) . toBe ( 'manual' ) ;
1467
1512
} )
1468
1513
. then ( function ( ) {
1469
1514
// select a point
0 commit comments