From dc4c63276bf29144ae29729c87967e64a9834678 Mon Sep 17 00:00:00 2001 From: Christopher Tannum Date: Mon, 31 Jul 2023 16:22:30 +0200 Subject: [PATCH] fix: unnormalized world-to-screen only returns null --- .../api/src/public/migration/Cognite3DViewer.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/viewer/packages/api/src/public/migration/Cognite3DViewer.ts b/viewer/packages/api/src/public/migration/Cognite3DViewer.ts index b9bbd067ecf..6c60ed49804 100644 --- a/viewer/packages/api/src/public/migration/Cognite3DViewer.ts +++ b/viewer/packages/api/src/public/migration/Cognite3DViewer.ts @@ -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;