@@ -1024,18 +1024,18 @@ describe('Scene/ScreenSpaceCameraController', function() {
1024
1024
moveMouse ( MouseButtons . LEFT , startPosition , endPosition ) ;
1025
1025
updateController ( ) ;
1026
1026
1027
- expect ( camera . position ) . toEqual ( position ) ;
1028
- expect ( camera . direction ) . toEqual ( direction ) ;
1029
- expect ( camera . up ) . toEqual ( up ) ;
1030
- expect ( camera . right ) . toEqual ( right ) ;
1027
+ expect ( camera . position ) . toEqualEpsilon ( position , CesiumMath . EPSILON7 ) ;
1028
+ expect ( camera . direction ) . toEqualEpsilon ( direction , CesiumMath . EPSILON7 ) ;
1029
+ expect ( camera . up ) . toEqualEpsilon ( up , CesiumMath . EPSILON7 ) ;
1030
+ expect ( camera . right ) . toEqualEpsilon ( right , CesiumMath . EPSILON7 ) ;
1031
1031
1032
1032
controller . enableRotate = true ;
1033
1033
updateController ( ) ;
1034
1034
1035
- expect ( camera . position ) . toEqual ( position ) ;
1036
- expect ( camera . direction ) . toEqual ( direction ) ;
1037
- expect ( camera . up ) . toEqual ( up ) ;
1038
- expect ( camera . right ) . toEqual ( right ) ;
1035
+ expect ( camera . position ) . toEqualEpsilon ( position , CesiumMath . EPSILON7 ) ;
1036
+ expect ( camera . direction ) . toEqualEpsilon ( direction , CesiumMath . EPSILON7 ) ;
1037
+ expect ( camera . up ) . toEqualEpsilon ( up , CesiumMath . EPSILON7 ) ;
1038
+ expect ( camera . right ) . toEqualEpsilon ( right , CesiumMath . EPSILON7 ) ;
1039
1039
} ) ;
1040
1040
1041
1041
it ( 'can set input type to undefined' , function ( ) {
@@ -1101,12 +1101,17 @@ describe('Scene/ScreenSpaceCameraController', function() {
1101
1101
updateController ( ) ;
1102
1102
1103
1103
camera . setView ( {
1104
- destination : Cartesian3 . fromDegrees ( - 72.0 , 40.0 , 1 .0)
1104
+ destination : Cartesian3 . fromDegrees ( - 72.0 , 40.0 , - 10 .0)
1105
1105
} ) ;
1106
1106
1107
+ // Trigger terrain adjustment with a small mouse movement
1108
+ var startPosition = new Cartesian2 ( canvas . clientWidth / 2 , canvas . clientHeight / 4 ) ;
1109
+ var endPosition = new Cartesian2 ( canvas . clientWidth / 2 , canvas . clientHeight / 2 ) ;
1110
+ moveMouse ( MouseButtons . RIGHT , startPosition , endPosition ) ;
1111
+
1107
1112
updateController ( ) ;
1108
1113
1109
- expect ( camera . positionCartographic . height ) . toEqualEpsilon ( controller . minimumZoomDistance , CesiumMath . EPSILON7 ) ;
1114
+ expect ( camera . positionCartographic . height ) . toEqualEpsilon ( controller . minimumZoomDistance , CesiumMath . EPSILON5 ) ;
1110
1115
} ) ;
1111
1116
1112
1117
it ( 'camera does not go below the terrain in CV' , function ( ) {
@@ -1116,9 +1121,14 @@ describe('Scene/ScreenSpaceCameraController', function() {
1116
1121
updateController ( ) ;
1117
1122
1118
1123
camera . setView ( {
1119
- destination : Cartesian3 . fromDegrees ( - 72.0 , 40.0 , 1 .0)
1124
+ destination : Cartesian3 . fromDegrees ( - 72.0 , 40.0 , - 10 .0)
1120
1125
} ) ;
1121
1126
1127
+ // Trigger terrain adjustment with a small mouse movement
1128
+ var startPosition = new Cartesian2 ( canvas . clientWidth / 2 , canvas . clientHeight / 4 ) ;
1129
+ var endPosition = new Cartesian2 ( canvas . clientWidth / 2 , canvas . clientHeight / 2 ) ;
1130
+ moveMouse ( MouseButtons . RIGHT , startPosition , endPosition ) ;
1131
+
1122
1132
updateController ( ) ;
1123
1133
1124
1134
expect ( camera . position . z ) . toEqualEpsilon ( controller . minimumZoomDistance , CesiumMath . EPSILON7 ) ;
@@ -1135,6 +1145,11 @@ describe('Scene/ScreenSpaceCameraController', function() {
1135
1145
destination : Cartesian3 . fromDegrees ( - 72.0 , 40.0 , - 10.0 )
1136
1146
} ) ;
1137
1147
1148
+ // Trigger terrain adjustment with a small mouse movement
1149
+ var startPosition = new Cartesian2 ( canvas . clientWidth / 2 , canvas . clientHeight / 4 ) ;
1150
+ var endPosition = new Cartesian2 ( canvas . clientWidth / 2 , canvas . clientHeight / 2 ) ;
1151
+ moveMouse ( MouseButtons . RIGHT , startPosition , endPosition ) ;
1152
+
1138
1153
updateController ( ) ;
1139
1154
1140
1155
expect ( camera . positionCartographic . height ) . toBeLessThan ( controller . minimumZoomDistance ) ;
@@ -1151,6 +1166,11 @@ describe('Scene/ScreenSpaceCameraController', function() {
1151
1166
destination : Cartesian3 . fromDegrees ( - 72.0 , 40.0 , - 10.0 )
1152
1167
} ) ;
1153
1168
1169
+ // Trigger terrain adjustment with a small mouse movement
1170
+ var startPosition = new Cartesian2 ( canvas . clientWidth / 2 , canvas . clientHeight / 4 ) ;
1171
+ var endPosition = new Cartesian2 ( canvas . clientWidth / 2 , canvas . clientHeight / 2 ) ;
1172
+ moveMouse ( MouseButtons . RIGHT , startPosition , endPosition ) ;
1173
+
1154
1174
updateController ( ) ;
1155
1175
1156
1176
expect ( camera . position . z ) . toBeLessThan ( controller . minimumZoomDistance ) ;
@@ -1164,6 +1184,11 @@ describe('Scene/ScreenSpaceCameraController', function() {
1164
1184
1165
1185
camera . lookAt ( Cartesian3 . fromDegrees ( - 72.0 , 40.0 , 1.0 ) , new Cartesian3 ( 1.0 , 1.0 , - 10.0 ) ) ;
1166
1186
1187
+ // Trigger terrain adjustment with a small mouse movement
1188
+ var startPosition = new Cartesian2 ( canvas . clientWidth / 2 , canvas . clientHeight / 4 ) ;
1189
+ var endPosition = new Cartesian2 ( canvas . clientWidth / 2 , canvas . clientHeight / 2 ) ;
1190
+ moveMouse ( MouseButtons . RIGHT , startPosition , endPosition ) ;
1191
+
1167
1192
updateController ( ) ;
1168
1193
1169
1194
expect ( camera . positionCartographic . height ) . toBeGreaterThanOrEqualTo ( controller . minimumZoomDistance ) ;
@@ -1177,6 +1202,11 @@ describe('Scene/ScreenSpaceCameraController', function() {
1177
1202
1178
1203
camera . lookAt ( Cartesian3 . fromDegrees ( - 72.0 , 40.0 , 1.0 ) , new Cartesian3 ( 1.0 , 1.0 , - 10.0 ) ) ;
1179
1204
1205
+ // Trigger terrain adjustment with a small mouse movement
1206
+ var startPosition = new Cartesian2 ( canvas . clientWidth / 2 , canvas . clientHeight / 4 ) ;
1207
+ var endPosition = new Cartesian2 ( canvas . clientWidth / 2 , canvas . clientHeight / 2 ) ;
1208
+ moveMouse ( MouseButtons . RIGHT , startPosition , endPosition ) ;
1209
+
1180
1210
updateController ( ) ;
1181
1211
1182
1212
expect ( camera . positionWC . x ) . toEqualEpsilon ( controller . minimumZoomDistance , CesiumMath . EPSILON8 ) ;
0 commit comments