@@ -1043,8 +1043,8 @@ describe('Test gl3d modebar handlers', function() {
10431043 it ( '@gl button resetCameraDefault3d should reset camera to default' , function ( done ) {
10441044 var buttonDefault = selectButton ( modeBar , 'resetCameraDefault3d' ) ;
10451045
1046- expect ( gd . _fullLayout . scene . _scene . cameraInitial . eye ) . toEqual ( { x : 0.1 , y : 0.1 , z : 1 } ) ;
1047- expect ( gd . _fullLayout . scene2 . _scene . cameraInitial . eye ) . toEqual ( { x : 2.5 , y : 2.5 , z : 2.5 } ) ;
1046+ expect ( gd . _fullLayout . scene . _scene . viewInitial . eye ) . toEqual ( { x : 0.1 , y : 0.1 , z : 1 } ) ;
1047+ expect ( gd . _fullLayout . scene2 . _scene . viewInitial . eye ) . toEqual ( { x : 2.5 , y : 2.5 , z : 2.5 } ) ;
10481048
10491049 gd . once ( 'plotly_relayout' , function ( ) {
10501050 assertScenes ( gd . _fullLayout , 'camera.eye.x' , 1.25 ) ;
@@ -1099,8 +1099,8 @@ describe('Test gl3d modebar handlers', function() {
10991099 assertCameraEye ( gd . _fullLayout . scene , 0.1 , 0.1 , 1 ) ;
11001100 assertCameraEye ( gd . _fullLayout . scene2 , 2.5 , 2.5 , 2.5 ) ;
11011101
1102- delete gd . _fullLayout . scene . _scene . cameraInitial ;
1103- delete gd . _fullLayout . scene2 . _scene . cameraInitial ;
1102+ delete gd . _fullLayout . scene . _scene . viewInitial ;
1103+ delete gd . _fullLayout . scene2 . _scene . viewInitial ;
11041104
11051105 Plotly . relayout ( gd , {
11061106 'scene.bgcolor' : '#d3d3d3' ,
@@ -1489,6 +1489,103 @@ describe('Test gl3d relayout calls', function() {
14891489 . catch ( failTest )
14901490 . then ( done ) ;
14911491 } ) ;
1492+
1493+ it ( '@gl should maintain projection type when resetCamera buttons clicked after switching projection type from perspective to orthographic' , function ( done ) {
1494+ Plotly . plot ( gd , {
1495+ data : [ {
1496+ type : 'surface' ,
1497+ x : [ 0 , 1 ] ,
1498+ y : [ 0 , 1 ] ,
1499+ z : [ [ 0 , 1 ] , [ 1 , 0 ] ]
1500+ } ] ,
1501+ layout : {
1502+ width : 300 ,
1503+ height : 200 ,
1504+ scene : {
1505+ camera : {
1506+ eye : {
1507+ x : 2 ,
1508+ y : 1 ,
1509+ z : 0.5
1510+ }
1511+ }
1512+ }
1513+ }
1514+ } )
1515+ . then ( function ( ) {
1516+ expect ( gd . _fullLayout . scene . _scene . camera . _ortho ) . toEqual ( false , 'perspective' ) ;
1517+ } )
1518+ . then ( function ( ) {
1519+ return Plotly . relayout ( gd , 'scene.camera.projection.type' , 'orthographic' ) ;
1520+ } )
1521+ . then ( function ( ) {
1522+ expect ( gd . _fullLayout . scene . _scene . camera . _ortho ) . toEqual ( true , 'orthographic' ) ;
1523+ } )
1524+ . then ( function ( ) {
1525+ return selectButton ( gd . _fullLayout . _modeBar , 'resetCameraLastSave3d' ) . click ( ) ;
1526+ } )
1527+ . then ( function ( ) {
1528+ expect ( gd . _fullLayout . scene . _scene . camera . _ortho ) . toEqual ( true , 'orthographic' ) ;
1529+ } )
1530+ . then ( function ( ) {
1531+ return selectButton ( gd . _fullLayout . _modeBar , 'resetCameraDefault3d' ) . click ( ) ;
1532+ } )
1533+ . then ( function ( ) {
1534+ expect ( gd . _fullLayout . scene . _scene . camera . _ortho ) . toEqual ( true , 'orthographic' ) ;
1535+ } )
1536+ . catch ( failTest )
1537+ . then ( done ) ;
1538+ } ) ;
1539+
1540+ it ( '@gl should maintain projection type when resetCamera buttons clicked after switching projection type from orthographic to perspective' , function ( done ) {
1541+ Plotly . plot ( gd , {
1542+ data : [ {
1543+ type : 'surface' ,
1544+ x : [ 0 , 1 ] ,
1545+ y : [ 0 , 1 ] ,
1546+ z : [ [ 0 , 1 ] , [ 1 , 0 ] ]
1547+ } ] ,
1548+ layout : {
1549+ width : 300 ,
1550+ height : 200 ,
1551+ scene : {
1552+ camera : {
1553+ eye : {
1554+ x : 2 ,
1555+ y : 1 ,
1556+ z : 0.5
1557+ } ,
1558+ projection : {
1559+ type : 'orthographic'
1560+ }
1561+ }
1562+ }
1563+ }
1564+ } )
1565+ . then ( function ( ) {
1566+ expect ( gd . _fullLayout . scene . _scene . camera . _ortho ) . toEqual ( true , 'orthographic' ) ;
1567+ } )
1568+ . then ( function ( ) {
1569+ return Plotly . relayout ( gd , 'scene.camera.projection.type' , 'perspective' ) ;
1570+ } )
1571+ . then ( function ( ) {
1572+ expect ( gd . _fullLayout . scene . _scene . camera . _ortho ) . toEqual ( false , 'perspective' ) ;
1573+ } )
1574+ . then ( function ( ) {
1575+ return selectButton ( gd . _fullLayout . _modeBar , 'resetCameraLastSave3d' ) . click ( ) ;
1576+ } )
1577+ . then ( function ( ) {
1578+ expect ( gd . _fullLayout . scene . _scene . camera . _ortho ) . toEqual ( false , 'perspective' ) ;
1579+ } )
1580+ . then ( function ( ) {
1581+ return selectButton ( gd . _fullLayout . _modeBar , 'resetCameraDefault3d' ) . click ( ) ;
1582+ } )
1583+ . then ( function ( ) {
1584+ expect ( gd . _fullLayout . scene . _scene . camera . _ortho ) . toEqual ( false , 'perspective' ) ;
1585+ } )
1586+ . catch ( failTest )
1587+ . then ( done ) ;
1588+ } ) ;
14921589} ) ;
14931590
14941591describe ( 'Test gl3d annotations' , function ( ) {
0 commit comments