From 09fc239944f2f8e2c689544efaf7ae18da5eac13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Flatval?= <70905152+haakonflatval-cognite@users.noreply.github.com> Date: Tue, 7 Nov 2023 10:31:36 +0100 Subject: [PATCH] chore: update ThreeJS to 158 and don't cancel 360 camera movement when pointer leaves canvas (#3869) * chore: update ThreeJS to 158 * chore: don't cancel camera movement when pointer leaves canvas --- examples/package.json | 7 +- examples/src/utils/CustomCameraManager.ts | 2 +- examples/src/utils/InspectNodeUi.ts | 2 +- examples/src/utils/LoadGltfUi.ts | 3 +- examples/src/utils/NodeTransformUI.ts | 6 +- examples/yarn.lock | 148 ++---------------- react-components/package.json | 4 +- react-components/yarn.lock | 40 ++--- viewer/api-entry-points/core.ts | 1 + viewer/package.json | 6 +- viewer/packages/camera-manager/index.ts | 2 +- .../camera-manager/src/ComboControls.ts | 7 +- .../src/StationaryCameraManager.ts | 4 - .../rendering/src/CadMaterialManager.test.ts | 4 +- viewer/reveal.api.md | 12 +- viewer/yarn.lock | 42 ++--- 16 files changed, 72 insertions(+), 218 deletions(-) diff --git a/examples/package.json b/examples/package.json index 7667d02674c..1e916212023 100644 --- a/examples/package.json +++ b/examples/package.json @@ -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", @@ -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", diff --git a/examples/src/utils/CustomCameraManager.ts b/examples/src/utils/CustomCameraManager.ts index 4c98bc240e0..35971f08fbe 100644 --- a/examples/src/utils/CustomCameraManager.ts +++ b/examples/src/utils/CustomCameraManager.ts @@ -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 { diff --git a/examples/src/utils/InspectNodeUi.ts b/examples/src/utils/InspectNodeUi.ts index b6b935e5456..8d8af9a3524 100644 --- a/examples/src/utils/InspectNodeUi.ts +++ b/examples/src/utils/InspectNodeUi.ts @@ -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; diff --git a/examples/src/utils/LoadGltfUi.ts b/examples/src/utils/LoadGltfUi.ts index 8ab466d1486..a9a6bdb0210 100644 --- a/examples/src/utils/LoadGltfUi.ts +++ b/examples/src/utils/LoadGltfUi.ts @@ -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[] = []; diff --git a/examples/src/utils/NodeTransformUI.ts b/examples/src/utils/NodeTransformUI.ts index f3123369dea..eef922e0196 100644 --- a/examples/src/utils/NodeTransformUI.ts +++ b/examples/src/utils/NodeTransformUI.ts @@ -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; @@ -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) { @@ -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)); } diff --git a/examples/yarn.lock b/examples/yarn.lock index ad570ce951d..2f5c43c5eed 100644 --- a/examples/yarn.lock +++ b/examples/yarn.lock @@ -167,33 +167,6 @@ "@babel/helper-validator-identifier" "^7.22.20" to-fast-properties "^2.0.0" -"@chevrotain/cst-dts-gen@10.5.0": - version "10.5.0" - resolved "https://registry.yarnpkg.com/@chevrotain/cst-dts-gen/-/cst-dts-gen-10.5.0.tgz#922ebd8cc59d97241bb01b1b17561a5c1ae0124e" - integrity sha512-lhmC/FyqQ2o7pGK4Om+hzuDrm9rhFYIJ/AXoQBeongmn870Xeb0L6oGEiuR8nohFNL5sMaQEJWCxr1oIVIVXrw== - dependencies: - "@chevrotain/gast" "10.5.0" - "@chevrotain/types" "10.5.0" - lodash "4.17.21" - -"@chevrotain/gast@10.5.0": - version "10.5.0" - resolved "https://registry.yarnpkg.com/@chevrotain/gast/-/gast-10.5.0.tgz#e4e614bc46d17a8892742f38e56cd33f1f3ad162" - integrity sha512-pXdMJ9XeDAbgOWKuD1Fldz4ieCs6+nLNmyVhe2gZVqoO7v8HXuHYs5OV2EzUtbuai37TlOAQHrTDvxMnvMJz3A== - dependencies: - "@chevrotain/types" "10.5.0" - lodash "4.17.21" - -"@chevrotain/types@10.5.0": - version "10.5.0" - resolved "https://registry.yarnpkg.com/@chevrotain/types/-/types-10.5.0.tgz#52a97d74a8cfbc197f054636d93ecd8912d33d21" - integrity sha512-f1MAia0x/pAVPWH/T73BJVyO2XU5tI4/iE7cnxb7tqdNTNhQI3Uq3XkqcoteTmD4t1aM0LbHCJOhgIDn07kl2A== - -"@chevrotain/utils@10.5.0": - version "10.5.0" - resolved "https://registry.yarnpkg.com/@chevrotain/utils/-/utils-10.5.0.tgz#0ee36f65b49b447fbac71b9e5af5c5c6c98ac057" - integrity sha512-hBzuU5+JjB2cqNZyszkDHZgOSrUUT8V3dhgRl8Q9Gp6dAj/H5+KILGjbhDpc3Iy9qmqlm/akuOI2ut9VUtzJxQ== - "@choojs/findup@^0.2.0": version "0.2.1" resolved "https://registry.yarnpkg.com/@choojs/findup/-/findup-0.2.1.tgz#ac13c59ae7be6e1da64de0779a0a7f03d75615a3" @@ -348,11 +321,6 @@ resolved "https://registry.yarnpkg.com/@tweenjs/tween.js/-/tween.js-19.0.0.tgz#93d3169f665ddc184c3b1b7a1910bf7df3dfb5da" integrity sha512-QVbvSlnP7FcjKr1edg460BbUlpdGzmIOfvpsvHCj3JPIVZ9S9KeQLk9mB24VlDzPIl/a/ehAZPE95xFsmqm+pQ== -"@tweenjs/tween.js@~18.6.4": - version "18.6.4" - resolved "https://registry.yarnpkg.com/@tweenjs/tween.js/-/tween.js-18.6.4.tgz#40a3d0a93647124872dec8e0fd1bd5926695b6ca" - integrity sha512-lB9lMjuqjtuJrx7/kOkqQBtllspPIN+96OvTCeJ2j5FEzinoAXTdAMFnDAQT1KVPRlnYfBrqxtqP66vDM40xxQ== - "@types/body-parser@*": version "1.19.2" resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.19.2.tgz#aea2059e28b7658639081347ac4fab3de166e6f0" @@ -388,11 +356,6 @@ resolved "https://registry.yarnpkg.com/@types/dat.gui/-/dat.gui-0.7.7.tgz#2125aedfaa190364c5a50b0447858a7e159aea2e" integrity sha512-CxLCme0He5Jk3uQwfO/fGZMyNhb/ypANzqX0yU9lviBQMlen5SOvQTBQ/Cd9x5mFlUAK5Tk8RgvTyLj1nYkz+w== -"@types/draco3d@^1.4.0": - version "1.4.2" - resolved "https://registry.yarnpkg.com/@types/draco3d/-/draco3d-1.4.2.tgz#7faccb809db2a5e19b9efb97c5f2eb9d64d527ea" - integrity sha512-goh23EGr6CLV6aKPwN1p8kBD/7tT5V/bLpToSbarKrwVejqNrspVrv8DhliteYkkhZYrlq/fwKZRRUzH4XN88w== - "@types/eslint-scope@^3.7.3": version "3.7.3" resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.3.tgz#125b88504b61e3c8bc6f870882003253005c3224" @@ -510,11 +473,6 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-20.2.5.tgz#26d295f3570323b2837d322180dfbf1ba156fefb" integrity sha512-JJulVEQXmiY9Px5axXHeYGLSjhkZEnD+MDPDGbCbIAbMslkKwmygtZFy1X6s/075Yo94sf8GuSlFfPzysQrWZQ== -"@types/offscreencanvas@^2019.6.4": - version "2019.7.0" - resolved "https://registry.yarnpkg.com/@types/offscreencanvas/-/offscreencanvas-2019.7.0.tgz#e4a932069db47bb3eabeb0b305502d01586fa90d" - integrity sha512-PGcyveRIpL1XIqK8eBsmRBt76eFgtzuPiSTyKHZxnGemp2yzGzWpjYKAfK3wIMiU7eH+851yEpiuP8JZerTmWg== - "@types/prop-types@*": version "15.7.4" resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.4.tgz#fcf7205c25dff795ee79af1e30da2c9790808f11" @@ -599,19 +557,17 @@ dependencies: "@types/jest" "*" -"@types/three@0.155.1": - version "0.155.1" - resolved "https://registry.yarnpkg.com/@types/three/-/three-0.155.1.tgz#03e1cc9bf7132f50606254611ff5f68ccd682b05" - integrity sha512-uNUwnz/wWRxahjIqTtDYQ1qdE1R1py21obxfuILkT+kKrjocMwRLQQA1l8nMxfQU7VXb7CXu04ucMo8OqZt4ZA== +"@types/three@0.158.1": + version "0.158.1" + resolved "https://registry.yarnpkg.com/@types/three/-/three-0.158.1.tgz#b1b96752ebb3a27b462251489938ee0fb03a18e2" + integrity sha512-U7SimpoMrlpY2TjYedb9sQeOVHdRWJEiaNQxywJETMGMoEhWEfpP0sywRADR/xOQbaixZ6lk5Hv+3IOFriprkw== dependencies: - "@tweenjs/tween.js" "~18.6.4" "@types/stats.js" "*" "@types/webxr" "*" - fflate "~0.6.9" - lil-gui "~0.17.0" + fflate "~0.6.10" meshoptimizer "~0.18.1" -"@types/webxr@*", "@types/webxr@^0.5.2": +"@types/webxr@*": version "0.5.2" resolved "https://registry.yarnpkg.com/@types/webxr/-/webxr-0.5.2.tgz#5d9627b0ffe223aa3b166de7112ac8a9460dc54f" integrity sha512-szL74BnIcok9m7QwYtVmQ+EdIKwbjPANudfuvDrAF8Cljg9MKUlIoc1w5tjj9PMpeSH3U1Xnx//czQybJ0EfSw== @@ -1105,18 +1061,6 @@ chalk@^4.0.0, chalk@^4.1.0: ansi-styles "^4.1.0" supports-color "^7.1.0" -chevrotain@^10.1.2: - version "10.5.0" - resolved "https://registry.yarnpkg.com/chevrotain/-/chevrotain-10.5.0.tgz#9c1dc62ef0753bb562dbe521b5f72d041bad624e" - integrity sha512-Pkv5rBY3+CsHOYfV5g/Vs5JY9WTHHDEKOlohI2XeygaZhUeqhAlldZ8Hz9cRmxu709bvS08YzxHdTPHhffc13A== - dependencies: - "@chevrotain/cst-dts-gen" "10.5.0" - "@chevrotain/gast" "10.5.0" - "@chevrotain/types" "10.5.0" - "@chevrotain/utils" "10.5.0" - lodash "4.17.21" - regexp-to-ast "0.5.0" - chokidar@^3.5.3: version "3.5.3" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" @@ -1515,11 +1459,6 @@ dotenv@^8.2.0: resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.6.0.tgz#061af664d19f7f4d8fc6e4ff9b584ce237adcb8b" integrity sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g== -draco3d@^1.4.1: - version "1.5.6" - resolved "https://registry.yarnpkg.com/draco3d/-/draco3d-1.5.6.tgz#0d570a9792e3a3a9fafbfea065b692940441c626" - integrity sha512-+3NaRjWktb5r61ZFoDejlykPEFKT5N/LkbXsaddlw6xNSXBanUYpFc2AXXpbJDilPHazcSreU/DpQIaxfX0NfQ== - duplexify@^3.4.5: version "3.7.1" resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-3.7.1.tgz#2a4df5317f6ccfd91f86d6fd25d8d8a103b88309" @@ -1777,7 +1716,7 @@ faye-websocket@^0.11.3: dependencies: websocket-driver ">=0.5.1" -fflate@^0.6.9, fflate@~0.6.9: +fflate@~0.6.10: version "0.6.10" resolved "https://registry.yarnpkg.com/fflate/-/fflate-0.6.10.tgz#5f40f9659205936a2d18abf88b2e7781662b6d43" integrity sha512-IQrh3lEPM93wVCEczc9SaAOvkmcoQn/G8Bo1e8ZPlY3X3bnAxWaBdvTdvM1hP62iZp0BXWDy4vTAy4fF0+Dlpg== @@ -2592,11 +2531,6 @@ kind-of@^6.0.2: resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== -ktx-parse@^0.4.5: - version "0.4.5" - resolved "https://registry.yarnpkg.com/ktx-parse/-/ktx-parse-0.4.5.tgz#79905e22281a9d3e602b2ff522df1ee7d1813aa6" - integrity sha512-MK3FOody4TXbFf8Yqv7EBbySw7aPvEcPX++Ipt6Sox+/YMFvR5xaTyhfNSk1AEmMy+RYIw81ctN4IMxCB8OAlg== - launch-editor@^2.6.0: version "2.6.0" resolved "https://registry.yarnpkg.com/launch-editor/-/launch-editor-2.6.0.tgz#4c0c1a6ac126c572bd9ff9a30da1d2cae66defd7" @@ -2613,11 +2547,6 @@ levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" -lil-gui@~0.17.0: - version "0.17.0" - resolved "https://registry.yarnpkg.com/lil-gui/-/lil-gui-0.17.0.tgz#b41ae55d0023fcd9185f7395a218db0f58189663" - integrity sha512-MVBHmgY+uEbmJNApAaPbtvNh1RCAeMnKym82SBjtp5rODTYKWtM+MXHCifLe2H2Ti1HuBGBtK/5SyG4ShQ3pUQ== - loader-runner@^4.2.0: version "4.3.0" resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.0.tgz#c1b4a163b99f614830353b16755e7149ac2314e1" @@ -2762,11 +2691,6 @@ mixpanel-browser@2.47.0: resolved "https://registry.yarnpkg.com/mixpanel-browser/-/mixpanel-browser-2.47.0.tgz#4e7fd3bb660c6f63443efbd169d1cd327db71ed4" integrity sha512-Ldrva0fRBEIFWmEibBQO1PulfpJVF3pf28Guk09lDirDaSQqqU/xs9zQLwN2rL5VwVtsP1aD3JaCgaa98EjojQ== -mmd-parser@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/mmd-parser/-/mmd-parser-1.0.4.tgz#87cc05782cb5974ca854f0303fc5147bc9d690e7" - integrity sha512-Qi0VCU46t2IwfGv5KF0+D/t9cizcDug7qnNoy9Ggk7aucp0tssV8IwTMkBlDbm+VqAf3cdQHTCARKSsuS2MYFg== - ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" @@ -2944,14 +2868,6 @@ open@^8.0.9: is-docker "^2.1.1" is-wsl "^2.2.0" -opentype.js@^1.3.3: - version "1.3.4" - resolved "https://registry.yarnpkg.com/opentype.js/-/opentype.js-1.3.4.tgz#1c0e72e46288473cc4a4c6a2dc60fd7fe6020d77" - integrity sha512-d2JE9RP/6uagpQAVtJoF0pJJA/fgai89Cc50Yp0EJHk+eLp6QQ7gBoblsnubRULNY132I0J1QKMJ+JTbMqz4sw== - dependencies: - string.prototype.codepointat "^0.2.1" - tiny-inflate "^1.0.3" - optionator@^0.8.1: version "0.8.3" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" @@ -3114,11 +3030,6 @@ postcss@^8.4.7: picocolors "^1.0.0" source-map-js "^1.0.2" -potpack@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/potpack/-/potpack-1.0.2.tgz#23b99e64eb74f5741ffe7656b5b5c4ddce8dfc14" - integrity sha512-choctRBIV9EMT9WGAZHn3V7t0Z2pMQyl0EZE6pFc/6ml3ssw7Dlf/oAOvFwjm1HVsqfQN8GfeFyJ+d8tRzqueQ== - prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" @@ -3306,11 +3217,6 @@ regenerator-runtime@^0.13.4: resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz#8925742a98ffd90814988d7566ad30ca3b263b52" integrity sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA== -regexp-to-ast@0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/regexp-to-ast/-/regexp-to-ast-0.5.0.tgz#56c73856bee5e1fef7f73a00f1473452ab712a24" - integrity sha512-tlbJqcMHnPKI9zSrystikWKwHkBqu2a/Sgw01h3zFjvYrMxEDYHzzoMZnUrbIfpTFEsoRnnviOXNCzFiSc54Qw== - regexp.prototype.flags@^1.4.3: version "1.4.3" resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz#87cab30f80f66660181a3bb7bf5981a872b367ac" @@ -3663,11 +3569,6 @@ strict-uri-encode@^1.0.0: resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" integrity sha512-R3f198pcvnB+5IpnBlRkphuE9n46WyVl8I39W/ZUTZLz4nqSP/oLYUrcnJrw462Ds8he4YKMov2efsTIw1BDGQ== -string.prototype.codepointat@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/string.prototype.codepointat/-/string.prototype.codepointat-0.2.1.tgz#004ad44c8afc727527b108cd462b4d971cd469bc" - integrity sha512-2cBVCj6I4IOvEnjgO/hWqXjqBGsY+zwPmHl12Srk9IXSZ56Jwwmy+66XO5Iut/oQVR7t5ihYdLB0GMa4alEUcg== - string.prototype.trimend@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz#914a65baaab25fbdd4ee291ca7dde57e869cb8d0" @@ -3799,27 +3700,10 @@ text-segmentation@^1.0.3: dependencies: utrie "^1.0.2" -three-stdlib@2.23.10: - version "2.23.10" - resolved "https://registry.yarnpkg.com/three-stdlib/-/three-stdlib-2.23.10.tgz#94907a558a00da327bd74308c92078fea72f77fc" - integrity sha512-y0DlxaN5HZXI9hKjEtqO2xlCEt7XyDCOMvD2M3JJFBmYjwbU+PbJ1n3Z+7Hr/6BeVGE6KZYcqPMnfKrTK5WTJg== - dependencies: - "@types/draco3d" "^1.4.0" - "@types/offscreencanvas" "^2019.6.4" - "@types/webxr" "^0.5.2" - chevrotain "^10.1.2" - draco3d "^1.4.1" - fflate "^0.6.9" - ktx-parse "^0.4.5" - mmd-parser "^1.0.4" - opentype.js "^1.3.3" - potpack "^1.0.1" - zstddec "^0.0.2" - -three@0.155.0: - version "0.155.0" - resolved "https://registry.yarnpkg.com/three/-/three-0.155.0.tgz#cca9b8ad817830c8b4fdd8f0d9a12a2e413a2672" - integrity sha512-sNgCYmDijnIqkD/bMfk+1pHg3YzsxW7V2ChpuP6HCQ8NiZr3RufsXQr8M3SSUMjW4hG+sUk7YbyuY0DncaDTJQ== +three@0.158.0: + version "0.158.0" + resolved "https://registry.yarnpkg.com/three/-/three-0.158.0.tgz#03ddd5b60ce9c31be8fb69f27a6d9efd49908ac3" + integrity sha512-TALj4EOpdDPF1henk2Q+s17K61uEAAWQ7TJB68nr7FKxqwyDr3msOt5IWdbGm4TaWKjrtWS8DJJWe9JnvsWOhQ== through2@^0.6.3: version "0.6.5" @@ -3842,11 +3726,6 @@ thunky@^1.0.2: resolved "https://registry.yarnpkg.com/thunky/-/thunky-1.1.0.tgz#5abaf714a9405db0504732bbccd2cedd9ef9537d" integrity sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA== -tiny-inflate@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/tiny-inflate/-/tiny-inflate-1.0.3.tgz#122715494913a1805166aaf7c93467933eea26c4" - integrity sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw== - to-fast-properties@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" @@ -4205,8 +4084,3 @@ yallist@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== - -zstddec@^0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/zstddec/-/zstddec-0.0.2.tgz#57e2f28dd1ff56b750e07d158a43f0611ad9eeb4" - integrity sha512-DCo0oxvcvOTGP/f5FA6tz2Z6wF+FIcEApSTu0zV5sQgn9hoT5lZ9YRAKUraxt9oP7l4e8TnNdi8IZTCX6WCkwA== diff --git a/react-components/package.json b/react-components/package.json index 34faf76d642..b723027a793 100644 --- a/react-components/package.json +++ b/react-components/package.json @@ -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", @@ -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", diff --git a/react-components/yarn.lock b/react-components/yarn.lock index 95c4aeb73c4..fa2a50b0a10 100644 --- a/react-components/yarn.lock +++ b/react-components/yarn.lock @@ -1841,7 +1841,7 @@ __metadata: "@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 assert: ^2.0.0 @@ -1866,7 +1866,7 @@ __metadata: 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 @@ -5133,13 +5133,6 @@ __metadata: languageName: node linkType: hard -"@tweenjs/tween.js@npm:~18.6.4": - version: 18.6.4 - resolution: "@tweenjs/tween.js@npm:18.6.4" - checksum: 47208db3f6c32cde80284a852d0fca016284f90c4798eb4ebb2ebfc2e379504007bf0c031c2c33044df8a0878fd1942ebc4e0b7f5b8bcccf812b532ea1ee73eb - languageName: node - linkType: hard - "@types/argparse@npm:1.0.38": version: 1.0.38 resolution: "@types/argparse@npm:1.0.38" @@ -5611,17 +5604,15 @@ __metadata: languageName: node linkType: hard -"@types/three@npm:0.155.1": - version: 0.155.1 - resolution: "@types/three@npm:0.155.1" +"@types/three@npm:0.158.1": + version: 0.158.1 + resolution: "@types/three@npm:0.158.1" dependencies: - "@tweenjs/tween.js": ~18.6.4 "@types/stats.js": "*" "@types/webxr": "*" - fflate: ~0.6.9 - lil-gui: ~0.17.0 + fflate: ~0.6.10 meshoptimizer: ~0.18.1 - checksum: dbe682fed53b59776d09140eec755677aedb49df6a16333a507f87a4ade2cbd4ea0fa46984e28425f3c3026d5eb9a8568e75a1a362fb4f1889427e4c6df4b640 + checksum: 72041d9b50622f2b077cb506a51cac616f3b9addd022a9654c638a4d7bb59edeca6a099f339d25429d18f690be39494d0900e8c025960d8944d1d8d2bd04cf7c languageName: node linkType: hard @@ -9125,7 +9116,7 @@ __metadata: languageName: node linkType: hard -"fflate@npm:~0.6.9": +"fflate@npm:~0.6.10": version: 0.6.10 resolution: "fflate@npm:0.6.10" checksum: 96384bc4090987fe565c0de8204e3830f538144ec950576fea50aee1b42adbe9fc3ed5e7905dfa7979faaa20979def330dbebce548f3dcafc3e118cc9838526d @@ -11228,13 +11219,6 @@ __metadata: languageName: node linkType: hard -"lil-gui@npm:~0.17.0": - version: 0.17.0 - resolution: "lil-gui@npm:0.17.0" - checksum: a6f33e90748ea98477f1f7af6d6cbdc4a1b38ce9da86d674d73f7b0bbdc7f3e947d81edee04c32f33fb28c69a108ba04c24270a8398064ffcc56ffeabc0a916e - languageName: node - linkType: hard - "lines-and-columns@npm:^1.1.6": version: 1.2.4 resolution: "lines-and-columns@npm:1.2.4" @@ -15474,10 +15458,10 @@ __metadata: languageName: node linkType: hard -"three@npm:0.155.0": - version: 0.155.0 - resolution: "three@npm:0.155.0" - checksum: 55de8af716686be2159b2ff407501ce2e6418b7d16a8dc57f3dcf9f08c4a6bedf0623fa8ddb67c1ae6f679d7ca53cfa0c64bab6b0577d6c467618389d5561211 +"three@npm:0.158.0": + version: 0.158.0 + resolution: "three@npm:0.158.0" + checksum: 30decfb78125732ffc287946208d11b3ba8b6d765d7e806c1e0149f6edc3671e69e2cc680082486858bcd123a1ba24f6dbc8222e88b6edb9e17d9487ae4ed821 languageName: node linkType: hard diff --git a/viewer/api-entry-points/core.ts b/viewer/api-entry-points/core.ts index 329cca7ed9b..1e3926d7a31 100644 --- a/viewer/api-entry-points/core.ts +++ b/viewer/api-entry-points/core.ts @@ -19,6 +19,7 @@ export { CameraState, ComboControls, ComboControlsOptions, + ComboControlsEventType, CameraEventDelegate, CameraChangeDelegate, CameraStopDelegate diff --git a/viewer/package.json b/viewer/package.json index 292c328d5a7..6b79aa859b1 100644 --- a/viewer/package.json +++ b/viewer/package.json @@ -94,7 +94,7 @@ "@types/random-seed": "0.3.4", "@types/skmeans": "0.11.6", "@types/stats": "0.16.30", - "@types/three": "0.155.1", + "@types/three": "0.158.1", "@types/tween.js": "18.5.1", "@typescript-eslint/eslint-plugin": "6.7.0", "@typescript-eslint/parser": "6.7.0", @@ -131,7 +131,7 @@ "resize-observer-polyfill": "1.5.1", "shx": "0.3.4", "stats.js": "0.17.0", - "three": "0.155.0", + "three": "0.158.0", "ts-jest": "29.1.1", "ts-loader": "9.5.0", "tsc-alias": "1.8.8", @@ -146,7 +146,7 @@ }, "peerDependencies": { "@cognite/sdk": "^7.16.0 || ^8.0.0", - "three": "0.155.0" + "three": "0.158.0" }, "glslify": { "transform": [ diff --git a/viewer/packages/camera-manager/index.ts b/viewer/packages/camera-manager/index.ts index 069db5c1696..4a8a54fc831 100644 --- a/viewer/packages/camera-manager/index.ts +++ b/viewer/packages/camera-manager/index.ts @@ -6,7 +6,7 @@ export { ProxyCameraManager } from './src/ProxyCameraManager'; export { StationaryCameraManager } from './src/StationaryCameraManager'; export { CameraManagerHelper } from './src/CameraManagerHelper'; export { CameraManager } from './src/CameraManager'; -export { ComboControls, ComboControlsOptions } from './src/ComboControls'; +export { ComboControls, ComboControlsOptions, ComboControlsEventType } from './src/ComboControls'; export { DebouncedCameraStopEventTrigger } from './src/utils/DebouncedCameraStopEventTrigger'; export * from './src/types'; diff --git a/viewer/packages/camera-manager/src/ComboControls.ts b/viewer/packages/camera-manager/src/ComboControls.ts index 642cd4a39cc..958ad108208 100644 --- a/viewer/packages/camera-manager/src/ComboControls.ts +++ b/viewer/packages/camera-manager/src/ComboControls.ts @@ -112,7 +112,12 @@ export type ComboControlsOptions = { const defaultPointerRotationSpeed = Math.PI / 360; // half degree per pixel const defaultKeyboardRotationSpeed = defaultPointerRotationSpeed * 10; -export class ComboControls extends EventDispatcher { +/** + * The event type for events emitted by {@link ComboControls}. + */ +export type ComboControlsEventType = { cameraChange: { camera: { position: Vector3; target: Vector3 } } }; + +export class ComboControls extends EventDispatcher { public dispose: () => void; private _temporarilyDisableDamping: boolean = false; diff --git a/viewer/packages/camera-manager/src/StationaryCameraManager.ts b/viewer/packages/camera-manager/src/StationaryCameraManager.ts index 0690a049b9b..5fa48597f95 100644 --- a/viewer/packages/camera-manager/src/StationaryCameraManager.ts +++ b/viewer/packages/camera-manager/src/StationaryCameraManager.ts @@ -82,18 +82,14 @@ export class StationaryCameraManager implements CameraManager { // The handler for pointerup is used for the pointercancel, pointerout // and pointerleave events, as these have the same semantics. this._domElement.addEventListener('pointerup', this.onPointerUp); - this._domElement.addEventListener('pointerout', this.onPointerUp); this._domElement.addEventListener('pointercancel', this.onPointerUp); - this._domElement.addEventListener('pointerleave', this.onPointerUp); } deactivate(): void { this._domElement.removeEventListener('pointerdown', this.onPointerDown); this._domElement.removeEventListener('pointermove', this.onPointerMove); this._domElement.removeEventListener('pointerup', this.onPointerUp); - this._domElement.removeEventListener('pointerout', this.onPointerUp); this._domElement.removeEventListener('pointercancel', this.onPointerUp); - this._domElement.removeEventListener('pointerleave', this.onPointerUp); this._domElement.removeEventListener('wheel', this.zoomCamera); } diff --git a/viewer/packages/rendering/src/CadMaterialManager.test.ts b/viewer/packages/rendering/src/CadMaterialManager.test.ts index a56dc2b926d..54739a30790 100644 --- a/viewer/packages/rendering/src/CadMaterialManager.test.ts +++ b/viewer/packages/rendering/src/CadMaterialManager.test.ts @@ -105,12 +105,12 @@ describe('CadMaterialManager', () => { for (const material of iterateMaterials(manager.getModelMaterials('1'))) { expect(material.clipIntersection).toBeFalse(); expect(material.clipping).toBeTrue(); - expect(material.clippingPlanes.length).toBe(4); + expect(material.clippingPlanes?.length).toBe(4); } for (const material of iterateMaterials(manager.getModelMaterials('2'))) { expect(material.clipIntersection).toBeFalse(); expect(material.clipping).toBeTrue(); - expect(material.clippingPlanes.length).toBe(3); + expect(material.clippingPlanes?.length).toBe(3); } }); }); diff --git a/viewer/reveal.api.md b/viewer/reveal.api.md index 4c6f8344d2c..80d8931c26e 100644 --- a/viewer/reveal.api.md +++ b/viewer/reveal.api.md @@ -570,7 +570,7 @@ export abstract class CombineNodeCollectionBase extends NodeCollection { } // @public (undocumented) -export class ComboControls extends EventDispatcher { +export class ComboControls extends EventDispatcher { constructor(camera: PerspectiveCamera | OrthographicCamera, domElement: HTMLElement); get cameraRawRotation(): Quaternion; // (undocumented) @@ -598,6 +598,16 @@ export class ComboControls extends EventDispatcher { update: (deltaTimeS: number, forceUpdate?: boolean) => boolean; } +// @public +export type ComboControlsEventType = { + cameraChange: { + camera: { + position: Vector3; + target: Vector3; + }; + }; +}; + // @public export type ComboControlsOptions = { enableDamping: boolean; diff --git a/viewer/yarn.lock b/viewer/yarn.lock index e53c7a0f906..050a63e3d73 100644 --- a/viewer/yarn.lock +++ b/viewer/yarn.lock @@ -551,7 +551,7 @@ __metadata: "@types/random-seed": 0.3.4 "@types/skmeans": 0.11.6 "@types/stats": 0.16.30 - "@types/three": 0.155.1 + "@types/three": 0.158.1 "@types/tween.js": 18.5.1 "@typescript-eslint/eslint-plugin": 6.7.0 "@typescript-eslint/parser": 6.7.0 @@ -600,7 +600,7 @@ __metadata: skmeans: 0.11.3 sparse-octree: 7.1.8 stats.js: 0.17.0 - three: 0.155.0 + three: 0.158.0 ts-jest: 29.1.1 ts-loader: 9.5.0 tsc-alias: 1.8.8 @@ -614,7 +614,7 @@ __metadata: workerize-loader: 2.0.2 peerDependencies: "@cognite/sdk": ^7.16.0 || ^8.0.0 - three: 0.155.0 + three: 0.158.0 languageName: unknown linkType: soft @@ -1650,13 +1650,6 @@ __metadata: languageName: node linkType: hard -"@tweenjs/tween.js@npm:~18.6.4": - version: 18.6.4 - resolution: "@tweenjs/tween.js@npm:18.6.4" - checksum: 47208db3f6c32cde80284a852d0fca016284f90c4798eb4ebb2ebfc2e379504007bf0c031c2c33044df8a0878fd1942ebc4e0b7f5b8bcccf812b532ea1ee73eb - languageName: node - linkType: hard - "@types/argparse@npm:1.0.38": version: 1.0.38 resolution: "@types/argparse@npm:1.0.38" @@ -2098,17 +2091,15 @@ __metadata: languageName: node linkType: hard -"@types/three@npm:0.155.1": - version: 0.155.1 - resolution: "@types/three@npm:0.155.1" +"@types/three@npm:0.158.1": + version: 0.158.1 + resolution: "@types/three@npm:0.158.1" dependencies: - "@tweenjs/tween.js": ~18.6.4 "@types/stats.js": "*" "@types/webxr": "*" - fflate: ~0.6.9 - lil-gui: ~0.17.0 + fflate: ~0.6.10 meshoptimizer: ~0.18.1 - checksum: dbe682fed53b59776d09140eec755677aedb49df6a16333a507f87a4ade2cbd4ea0fa46984e28425f3c3026d5eb9a8568e75a1a362fb4f1889427e4c6df4b640 + checksum: 72041d9b50622f2b077cb506a51cac616f3b9addd022a9654c638a4d7bb59edeca6a099f339d25429d18f690be39494d0900e8c025960d8944d1d8d2bd04cf7c languageName: node linkType: hard @@ -5048,7 +5039,7 @@ __metadata: languageName: node linkType: hard -"fflate@npm:~0.6.9": +"fflate@npm:~0.6.10": version: 0.6.10 resolution: "fflate@npm:0.6.10" checksum: 96384bc4090987fe565c0de8204e3830f538144ec950576fea50aee1b42adbe9fc3ed5e7905dfa7979faaa20979def330dbebce548f3dcafc3e118cc9838526d @@ -7574,13 +7565,6 @@ __metadata: languageName: node linkType: hard -"lil-gui@npm:~0.17.0": - version: 0.17.0 - resolution: "lil-gui@npm:0.17.0" - checksum: a6f33e90748ea98477f1f7af6d6cbdc4a1b38ce9da86d674d73f7b0bbdc7f3e947d81edee04c32f33fb28c69a108ba04c24270a8398064ffcc56ffeabc0a916e - languageName: node - linkType: hard - "lines-and-columns@npm:^1.1.6": version: 1.1.6 resolution: "lines-and-columns@npm:1.1.6" @@ -10516,10 +10500,10 @@ resolve@~1.19.0: languageName: node linkType: hard -"three@npm:0.155.0": - version: 0.155.0 - resolution: "three@npm:0.155.0" - checksum: 55de8af716686be2159b2ff407501ce2e6418b7d16a8dc57f3dcf9f08c4a6bedf0623fa8ddb67c1ae6f679d7ca53cfa0c64bab6b0577d6c467618389d5561211 +"three@npm:0.158.0": + version: 0.158.0 + resolution: "three@npm:0.158.0" + checksum: 30decfb78125732ffc287946208d11b3ba8b6d765d7e806c1e0149f6edc3671e69e2cc680082486858bcd123a1ba24f6dbc8222e88b6edb9e17d9487ae4ed821 languageName: node linkType: hard