Skip to content

Commit

Permalink
fix(Label): catch no data elevation.
Browse files Browse the repository at this point in the history
  • Loading branch information
gchoqueux committed Mar 27, 2023
1 parent 9d509da commit e1e3b1d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Core/Label.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,17 @@ class Label extends THREE.Object3D {
}

updateElevationFromLayer(layer, nodes) {
const elevation = Math.max(0, DEMUtils.getElevationValueAt(layer, this.coordinates, DEMUtils.FAST_READ_Z, nodes));
if (elevation && elevation != this.coordinates.z) {
if (layer.attachedLayers.filter(l => l.isElevationLayer).length == 0) {
return;
}

let elevation = Math.max(0, DEMUtils.getElevationValueAt(layer, this.coordinates, DEMUtils.FAST_READ_Z, nodes));

if (isNaN(elevation)) {
elevation = Math.max(0, DEMUtils.getElevationValueAt(layer, this.coordinates, DEMUtils.FAST_READ_Z));
}

if (!isNaN(elevation) && elevation != this.coordinates.z) {
this.coordinates.z = elevation;
this.updateHorizonCullingPoint();
return true;
Expand Down

0 comments on commit e1e3b1d

Please sign in to comment.