Skip to content

Commit

Permalink
Merge branch 'master' into np/tree
Browse files Browse the repository at this point in the history
  • Loading branch information
nilscognite committed Oct 22, 2024
2 parents b7d0f5a + f1c4587 commit 4f7dd37
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion viewer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cognite/reveal",
"version": "4.19.0",
"version": "4.19.1",
"description": "WebGL based 3D viewer for CAD and point clouds processed in Cognite Data Fusion.",
"homepage": "https://github.com/cognitedata/reveal/tree/master/viewer",
"repository": {
Expand Down
15 changes: 13 additions & 2 deletions viewer/packages/api/src/api-helpers/Image360ApiHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import {
import { MetricsLogger } from '@reveal/metrics';
import debounce from 'lodash/debounce';
import { Image360WithCollection } from '../public/types';
import { DEFAULT_IMAGE_360_OPACITY } from '@reveal/360-images/src/entity/Image360VisualizationBox';

export class Image360ApiHelper {
private readonly _image360Facade: Image360Facade<Metadata | Image360DataModelIdentifier>;
Expand Down Expand Up @@ -273,6 +274,9 @@ export class Image360ApiHelper {

image360Entity.icon.setVisible(false);
image360Entity.image360Visualization.visible = true;

const currentOpacity = this.getImageOpacity();

this._image360Facade.allIconCullingScheme = 'proximity';

// Only do transition if we are switching between entities.
Expand All @@ -292,12 +296,12 @@ export class Image360ApiHelper {
if (flexibleCameraManager) {
await Promise.all([
moveCameraPositionTo(flexibleCameraManager, position, transitionDuration),
this.tweenVisualizationAlpha(image360Entity, 0, 1, transitionDuration)
this.tweenVisualizationAlpha(image360Entity, 0, currentOpacity, transitionDuration)
]);
} else if (this._stationaryCameraManager) {
await Promise.all([
this._stationaryCameraManager.moveTo(position, transitionDuration),
this.tweenVisualizationAlpha(image360Entity, 0, 1, transitionDuration)
this.tweenVisualizationAlpha(image360Entity, 0, currentOpacity, transitionDuration)
]);
}
image360Entity.activateAnnotations();
Expand Down Expand Up @@ -593,6 +597,13 @@ export class Image360ApiHelper {
}
this.exit360Image();
}

private getImageOpacity(): number {
for (const image360Collection of this._image360Facade.collections) {
return image360Collection.getImagesOpacity();
}
return DEFAULT_IMAGE_360_OPACITY;
}
}

//================================================
Expand Down

0 comments on commit 4f7dd37

Please sign in to comment.