Skip to content

Commit 96363d8

Browse files
committed
Merge pull request #1426 from AnalyticalGraphicsInc/viewExtent
View Extent
2 parents 8a11c4e + c1a9a96 commit 96363d8

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Source/Scene/CameraController.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,9 +1023,19 @@ define([
10231023
result = new Cartesian3();
10241024
}
10251025

1026-
var scalar = Cartesian3.magnitude(center) + d;
1027-
Cartesian3.negate(direction, result);
1028-
return Cartesian3.multiplyByScalar(result, scalar, result);
1026+
var mag = Cartesian3.magnitude(center);
1027+
var scalar = mag + d;
1028+
1029+
if (mag < CesiumMath.EPSILON6) {
1030+
cart.longitude = (east + west) * 0.5;
1031+
cart.latitude = (north + south) * 0.5;
1032+
ellipsoid.cartographicToCartesian(cart, center);
1033+
Cartesian3.normalize(center, center);
1034+
} else {
1035+
Cartesian3.normalize(center, center);
1036+
}
1037+
1038+
return Cartesian3.multiplyByScalar(center, scalar, result);
10291039
}
10301040

10311041
var viewExtentCVCartographic = new Cartographic();

0 commit comments

Comments
 (0)