Skip to content

Commit

Permalink
fix: unnormalized world-to-screen only returns null (#3533)
Browse files Browse the repository at this point in the history
Co-authored-by: cognite-bulldozer[bot] <51074376+cognite-bulldozer[bot]@users.noreply.github.com>
  • Loading branch information
christjt and cognite-bulldozer[bot] authored Jul 31, 2023
1 parent 1ceeb6b commit de76b7f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions viewer/packages/api/src/public/migration/Cognite3DViewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1214,13 +1214,15 @@ export class Cognite3DViewer {
worldToViewportCoordinates(this.canvas, camera, point, screenPosition);
}

//TODO: Remove this for Reveal 5.0, getting the position "outside" of the frustum is relevant UI elements that partially clips the frustum.
if (
screenPosition.x < 0 ||
screenPosition.x > 1 ||
screenPosition.y < 0 ||
screenPosition.y > 1 ||
screenPosition.z < 0 ||
screenPosition.z > 1
normalize &&
(screenPosition.x < 0 ||
screenPosition.x > 1 ||
screenPosition.y < 0 ||
screenPosition.y > 1 ||
screenPosition.z < -1 ||
screenPosition.z > 1)
) {
// Return null if point is outside camera frustum.
return null;
Expand Down

0 comments on commit de76b7f

Please sign in to comment.