Skip to content

Commit 53889cb

Browse files
committed
Fix updateHeight callbacks
1 parent 598bda5 commit 53889cb

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

packages/engine/Source/Scene/Cesium3DTileset.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2677,10 +2677,11 @@ function processUpdateHeight(tileset, tile, frameState) {
26772677
Cartesian3.distance(position, boundingSphere.center) <=
26782678
boundingSphere.radius
26792679
) {
2680+
callbackData.invoked = true;
26802681
frameState.afterRender.push(() => {
26812682
// Callback can be removed before it actually invoked at the end of the frame
26822683
if (defined(callbackData.callback)) {
2683-
callbackData.callback(positionCartographic);
2684+
callbackData.callback();
26842685
}
26852686
callbackData.invoked = false;
26862687
});

packages/engine/Source/Scene/Scene.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3885,7 +3885,6 @@ Scene.prototype.getHeight = function (cartographic, heightReference) {
38853885
};
38863886

38873887
const updateHeightScratchCartographic = new Cartographic();
3888-
const updateClampedScratchCartographic = new Cartographic();
38893888
/**
38903889
* Calls the callback when a new tile is rendered that contains the given cartographic. The only parameter
38913890
* is the cartesian position on the tile.
@@ -3907,18 +3906,12 @@ Scene.prototype.updateHeight = function (
39073906
//>>includeEnd('debug');
39083907

39093908
const ellipsoid = this._ellipsoid;
3910-
const callbackWrapper = (clampedPosition) => {
3909+
const callbackWrapper = (clampedCartographic) => {
39113910
Cartographic.clone(cartographic, updateHeightScratchCartographic);
39123911

39133912
let height;
3914-
if (defined(clampedPosition)) {
3915-
const updatedClampedPosition = ellipsoid.cartesianToCartographic(
3916-
clampedPosition,
3917-
updateClampedScratchCartographic,
3918-
);
3919-
if (defined(updatedClampedPosition)) {
3920-
height = updatedClampedPosition.height;
3921-
}
3913+
if (defined(clampedCartographic)) {
3914+
height = clampedCartographic.height;
39223915
}
39233916
if (!defined(height)) {
39243917
height = this.getHeight(cartographic, heightReference);

0 commit comments

Comments
 (0)