Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix): Update recalculateBoundingBox in Cognite3DViewer #4715

Merged
merged 12 commits into from
Aug 29, 2024

Conversation

nilscognite
Copy link
Contributor

@nilscognite nilscognite commented Aug 21, 2024

Type of change

Bug

Description 📝

the function fitCameraToModels only take all the models, even invisible and doesn't use the customobject at all. In order not to break the code, I made an alternative which is fitCameraToSceneBoundingBox. This uses the getSceneBoundingBox.

I also change the recalculateBoundingBox to use only visible object. See comment in that function. I believe that was the intension of the original code. It might break the code.... An alternative would be to make another function for doing this.

I saw this bug during a demo today. The user had many models, but only one was visible. The navigation was pretty hard and the fit all button didn't work as expected.

@nilscognite nilscognite requested a review from a team as a code owner August 21, 2024 12:19
@nilscognite nilscognite changed the title (chore): Update Cognite3DViewer.ts (fix): Update Cognite3DViewer.ts Aug 21, 2024
Copy link
Contributor

@haakonflatval-cognite haakonflatval-cognite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 Just one question

sceneBoundingBox.union(temporaryBox);
});
this._sceneHandler.customObjects.forEach(customObject => {
if (!customObject.object.visible) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to have the pass === 0-check here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It didn't have that from before. It always used the visible object in these cases.

@nilscognite nilscognite changed the title (fix): Update Cognite3DViewer.ts (fix): Update recalculateBoundingBox in Cognite3DViewer Aug 21, 2024
@nilscognite nilscognite merged commit 99deb03 into master Aug 29, 2024
14 checks passed
@nilscognite nilscognite deleted the np/cropping-fixes branch August 29, 2024 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants