Skip to content

Commit

Permalink
chore: update ThreeJS to 158 and don't cancel 360 camera movement whe…
Browse files Browse the repository at this point in the history
…n pointer leaves canvas (#3869)

* chore: update ThreeJS to 158

* chore: don't cancel camera movement when pointer leaves canvas
  • Loading branch information
haakonflatval-cognite authored Nov 7, 2023
1 parent c654793 commit 09fc239
Show file tree
Hide file tree
Showing 16 changed files with 72 additions and 218 deletions.
7 changes: 3 additions & 4 deletions examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"stats.js": "0.17.0",
"styled-components": "5.3.10",
"three-stdlib": "2.23.10"
"styled-components": "5.3.10"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.11.5",
Expand All @@ -40,12 +39,12 @@
"@types/react-dom": "18.2.4",
"@types/stats.js": "^0.17.0",
"@types/styled-components": "^5.1.26",
"@types/three": "0.155.1",
"@types/three": "0.158.1",
"css-loader": "^6.7.1",
"dotenv-webpack": "^7.1.0",
"html-webpack-plugin": "^5.5.0",
"prettier": "^2.8.4",
"three": "0.155.0",
"three": "0.158.0",
"ts-loader": "9.4.4",
"typescript": "^5.0.4",
"webpack": "^5.76.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/src/utils/CustomCameraManager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as THREE from 'three';
import { OrbitControls } from 'three-stdlib';
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';
import pull from 'lodash/pull';

import {
Expand Down
2 changes: 1 addition & 1 deletion examples/src/utils/InspectNodeUi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { CogniteClient, Node3D } from '@cognite/sdk';
import { TreeIndexNodeCollection } from '@cognite/reveal';
import { NumericRange } from '@cognite/reveal';
import { DefaultNodeAppearance } from '@cognite/reveal';
import { TransformControls } from 'three-stdlib';
import { TransformControls } from 'three/examples/jsm/controls/TransformControls.js';

export class InspectNodeUI {
private readonly _uiFolder: dat.GUI;
Expand Down
3 changes: 2 additions & 1 deletion examples/src/utils/LoadGltfUi.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as THREE from 'three';
import dat from 'dat.gui';
import { Cognite3DViewer } from '@cognite/reveal';
import { GLTFLoader, GLTF, TransformControls } from 'three-stdlib';
import { GLTFLoader, GLTF } from 'three/examples/jsm/loaders/GLTFLoader.js';
import { TransformControls } from 'three/examples/jsm/controls/TransformControls.js';

export class LoadGltfUi {
private readonly _gizmos: TransformControls[] = [];
Expand Down
6 changes: 3 additions & 3 deletions examples/src/utils/NodeTransformUI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as THREE from 'three';
import { CadIntersection, Cognite3DViewer, CogniteCadModel, NumericRange } from '@cognite/reveal';

import * as dat from 'dat.gui';
import { TransformControls } from 'three-stdlib';
import { TransformControls } from 'three/examples/jsm/controls/TransformControls.js';

export class NodeTransformUI {
private viewer: Cognite3DViewer;
Expand Down Expand Up @@ -35,7 +35,7 @@ export class NodeTransformUI {

private attachTransformControls = {
attach: false,
mode: 'translate'
mode: 'translate' as const
};

constructor(viewer: Cognite3DViewer, gui: dat.GUI, model: CogniteCadModel) {
Expand Down Expand Up @@ -66,7 +66,7 @@ export class NodeTransformUI {
const toolTransform = gui.addFolder('Tool node transform');
toolTransform.add(this.attachTransformControls, 'attach').name('Attach transform controls');
toolTransform
.add(this.attachTransformControls, 'mode', ['translate', 'rotate'])
.add(this.attachTransformControls, 'mode', ['translate', 'rotate'] as const)
.onChange(() => transformControls.setMode(this.attachTransformControls.mode));
}

Expand Down
148 changes: 11 additions & 137 deletions examples/yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions react-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"@types/react": "18.2.7",
"@types/react-dom": "^18.2.7",
"@types/styled-components": "5.1.29",
"@types/three": "0.155.1",
"@types/three": "0.158.1",
"@typescript-eslint/eslint-plugin": "^6.7.0",
"@vitejs/plugin-react": "^4.0.4",
"eslint": "^8.0.1",
Expand All @@ -82,7 +82,7 @@
"storybook": "7.4.3",
"style-loader": "^3.3.3",
"styled-components": "5.3.11",
"three": "0.155.0",
"three": "0.158.0",
"ts-loader": "9.5.0",
"typescript": "5.2.2",
"vite": "^4.4.9",
Expand Down
Loading

0 comments on commit 09fc239

Please sign in to comment.