Skip to content

Commit

Permalink
Just update UI in the examples (#4169)
Browse files Browse the repository at this point in the history
* Fix 360 images camera

* Update StationaryCameraManager.ts
  • Loading branch information
nilscognite authored Feb 13, 2024
1 parent 5136fab commit 3c58212
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions examples/src/utils/Image360UI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class Image360UI {
}

private params = {
siteId: getSiteIdFromUrl() ?? '',
siteId: getSiteIdFromUrl() ?? '', // For instance: helideck-site-2-jpeg
space: getSpaceFromUrl() ?? '',
add: () => this.add360ImageSet(),
remove: () => this.remove360ImageSet(),
Expand All @@ -56,7 +56,7 @@ export class Image360UI {
};

private dataSource: { type: 'events' | 'dataModels' } = {
type: getSiteIdFromUrl() !== null && getSpaceFromUrl() === null ? 'events' : 'dataModels'
type: getSpaceFromUrl() !== null && getSpaceFromUrl() !== '' ? 'dataModels' : 'events'
};

private rotation = {
Expand Down Expand Up @@ -85,9 +85,6 @@ export class Image360UI {
this.viewer = viewer;
this.gui = gui;

const optionsFolder = this.gui.addFolder('Add Options (Events)');
optionsFolder.hide();
const optionsFolderFdm = this.gui.addFolder('Add Options (Data Models)');
this.gui
.add(this.dataSource, 'type', ['events', 'dataModels'])
.name('Data source')
Expand All @@ -101,6 +98,9 @@ export class Image360UI {
}
});

const optionsFolder = this.gui.addFolder('Add Options (Events)');
optionsFolder.hide();
const optionsFolderFdm = this.gui.addFolder('Add Options (Data Models)');
// events
optionsFolder.add(this.params, 'siteId').name('Site ID');

Expand Down
4 changes: 2 additions & 2 deletions viewer/packages/camera-manager/src/StationaryCameraManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ export class StationaryCameraManager implements CameraManager {

const euler = new Euler().setFromQuaternion(this._camera.quaternion, 'YXZ');

euler.x -= -deltaY * sensitivityScaler * (this._camera.fov / this._defaultFOV);
euler.y -= -deltaX * sensitivityScaler * (this._camera.fov / this._defaultFOV);
euler.x += deltaY * sensitivityScaler * (this._camera.fov / this._defaultFOV);
euler.y += deltaX * sensitivityScaler * (this._camera.fov / this._defaultFOV);
euler.x = Math.max(-Math.PI / 2, Math.min(Math.PI / 2, euler.x));
this._camera.quaternion.setFromEuler(euler);

Expand Down

0 comments on commit 3c58212

Please sign in to comment.