From 54ba09992ac2a6a01c34751d331b7a5fd8b594bd Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Wed, 14 Aug 2024 17:16:46 +0200 Subject: [PATCH] Controls: Move into core. --- docs/{examples/en/controls => api/en/extras}/Controls.html | 2 +- docs/{examples/zh/controls => api/zh/extras}/Controls.html | 2 +- docs/list.json | 4 ++-- examples/jsm/controls/ArcballControls.js | 2 +- examples/jsm/controls/DragControls.js | 2 +- examples/jsm/controls/FirstPersonControls.js | 2 +- examples/jsm/controls/FlyControls.js | 2 +- examples/jsm/controls/PointerLockControls.js | 2 +- examples/jsm/controls/TrackballControls.js | 2 +- src/Three.WebGPU.js | 1 + src/Three.js | 1 + {examples/jsm/controls => src/extras}/Controls.js | 2 +- 12 files changed, 13 insertions(+), 11 deletions(-) rename docs/{examples/en/controls => api/en/extras}/Controls.html (96%) rename docs/{examples/zh/controls => api/zh/extras}/Controls.html (95%) rename {examples/jsm/controls => src/extras}/Controls.js (87%) diff --git a/docs/examples/en/controls/Controls.html b/docs/api/en/extras/Controls.html similarity index 96% rename from docs/examples/en/controls/Controls.html rename to docs/api/en/extras/Controls.html index b8ed04b1dce8ab..71618143122473 100644 --- a/docs/examples/en/controls/Controls.html +++ b/docs/api/en/extras/Controls.html @@ -110,7 +110,7 @@

[method:undefined update] ( [param:Number delta] )

Source

- [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/controls/Controls.js examples/jsm/controls/Controls.js] + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

diff --git a/docs/examples/zh/controls/Controls.html b/docs/api/zh/extras/Controls.html similarity index 95% rename from docs/examples/zh/controls/Controls.html rename to docs/api/zh/extras/Controls.html index aa8ace45aa99f2..3c917ec638e495 100644 --- a/docs/examples/zh/controls/Controls.html +++ b/docs/api/zh/extras/Controls.html @@ -110,7 +110,7 @@

[method:undefined update] ( [param:Number delta] )

源代码

- [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/controls/Controls.js examples/jsm/controls/Controls.js] + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

diff --git a/docs/list.json b/docs/list.json index e55cea17ea106d..5148b6236018c2 100644 --- a/docs/list.json +++ b/docs/list.json @@ -99,6 +99,7 @@ }, "Extras": { + "Controls": "api/en/extras/Controls", "DataUtils": "api/en/extras/DataUtils", "Earcut": "api/en/extras/Earcut", "ImageUtils": "api/en/extras/ImageUtils", @@ -331,7 +332,6 @@ "Controls": { "ArcballControls": "examples/en/controls/ArcballControls", - "Controls": "examples/en/controls/Controls", "DragControls": "examples/en/controls/DragControls", "FirstPersonControls": "examples/en/controls/FirstPersonControls", "FlyControls": "examples/en/controls/FlyControls", @@ -854,6 +854,7 @@ }, "附件": { + "Controls": "api/zh/extras/Controls", "DataUtils": "api/zh/extras/DataUtils", "Earcut": "api/zh/extras/Earcut", "ImageUtils": "api/zh/extras/ImageUtils", @@ -1084,7 +1085,6 @@ "控制": { "ArcballControls": "examples/zh/controls/ArcballControls", - "Controls": "examples/zh/controls/Controls", "DragControls": "examples/zh/controls/DragControls", "FirstPersonControls": "examples/zh/controls/FirstPersonControls", "FlyControls": "examples/zh/controls/FlyControls", diff --git a/examples/jsm/controls/ArcballControls.js b/examples/jsm/controls/ArcballControls.js index 9cad76214ca835..59df94a4d3cfc9 100644 --- a/examples/jsm/controls/ArcballControls.js +++ b/examples/jsm/controls/ArcballControls.js @@ -1,4 +1,5 @@ import { + Controls, GridHelper, EllipseCurve, BufferGeometry, @@ -14,7 +15,6 @@ import { Matrix4, MathUtils } from 'three'; -import { Controls } from './Controls.js'; //trackball state const STATE = { diff --git a/examples/jsm/controls/DragControls.js b/examples/jsm/controls/DragControls.js index 9714426243588f..225544c7b0d0e8 100644 --- a/examples/jsm/controls/DragControls.js +++ b/examples/jsm/controls/DragControls.js @@ -1,4 +1,5 @@ import { + Controls, Matrix4, Plane, Raycaster, @@ -7,7 +8,6 @@ import { MOUSE, TOUCH } from 'three'; -import { Controls } from './Controls.js'; const _plane = new Plane(); diff --git a/examples/jsm/controls/FirstPersonControls.js b/examples/jsm/controls/FirstPersonControls.js index d7d80cc1f79919..9ca2fc57f91481 100644 --- a/examples/jsm/controls/FirstPersonControls.js +++ b/examples/jsm/controls/FirstPersonControls.js @@ -1,9 +1,9 @@ import { + Controls, MathUtils, Spherical, Vector3 } from 'three'; -import { Controls } from './Controls.js'; const _lookDirection = new Vector3(); const _spherical = new Spherical(); diff --git a/examples/jsm/controls/FlyControls.js b/examples/jsm/controls/FlyControls.js index b49153682fc740..81bcf1757b07e6 100644 --- a/examples/jsm/controls/FlyControls.js +++ b/examples/jsm/controls/FlyControls.js @@ -1,8 +1,8 @@ import { + Controls, Quaternion, Vector3 } from 'three'; -import { Controls } from './Controls.js'; const _changeEvent = { type: 'change' }; diff --git a/examples/jsm/controls/PointerLockControls.js b/examples/jsm/controls/PointerLockControls.js index 3160e881fb8477..184c43f60cbf4d 100644 --- a/examples/jsm/controls/PointerLockControls.js +++ b/examples/jsm/controls/PointerLockControls.js @@ -1,8 +1,8 @@ import { + Controls, Euler, Vector3 } from 'three'; -import { Controls } from './Controls.js'; const _euler = new Euler( 0, 0, 0, 'YXZ' ); const _vector = new Vector3(); diff --git a/examples/jsm/controls/TrackballControls.js b/examples/jsm/controls/TrackballControls.js index ff2ad5549d317b..dec8248f6bf514 100644 --- a/examples/jsm/controls/TrackballControls.js +++ b/examples/jsm/controls/TrackballControls.js @@ -1,11 +1,11 @@ import { + Controls, MathUtils, MOUSE, Quaternion, Vector2, Vector3 } from 'three'; -import { Controls } from './Controls.js'; const _changeEvent = { type: 'change' }; const _startEvent = { type: 'start' }; diff --git a/src/Three.WebGPU.js b/src/Three.WebGPU.js index c8ccdcf4df090a..22765d22cff4c9 100644 --- a/src/Three.WebGPU.js +++ b/src/Three.WebGPU.js @@ -152,6 +152,7 @@ export { Path } from './extras/core/Path.js'; export { ShapePath } from './extras/core/ShapePath.js'; export { CurvePath } from './extras/core/CurvePath.js'; export { Curve } from './extras/core/Curve.js'; +export { Controls } from './extras/Controls.js'; export { DataUtils } from './extras/DataUtils.js'; export { ImageUtils } from './extras/ImageUtils.js'; export { ShapeUtils } from './extras/ShapeUtils.js'; diff --git a/src/Three.js b/src/Three.js index 4eb1d2975e5bfe..df38bf82139a10 100644 --- a/src/Three.js +++ b/src/Three.js @@ -151,6 +151,7 @@ export { Path } from './extras/core/Path.js'; export { ShapePath } from './extras/core/ShapePath.js'; export { CurvePath } from './extras/core/CurvePath.js'; export { Curve } from './extras/core/Curve.js'; +export { Controls } from './extras/Controls.js'; export { DataUtils } from './extras/DataUtils.js'; export { ImageUtils } from './extras/ImageUtils.js'; export { ShapeUtils } from './extras/ShapeUtils.js'; diff --git a/examples/jsm/controls/Controls.js b/src/extras/Controls.js similarity index 87% rename from examples/jsm/controls/Controls.js rename to src/extras/Controls.js index d64d40a6863b94..a76b7c0e6cb1bb 100644 --- a/examples/jsm/controls/Controls.js +++ b/src/extras/Controls.js @@ -1,4 +1,4 @@ -import { EventDispatcher } from 'three'; +import { EventDispatcher } from '../core/EventDispatcher.js'; class Controls extends EventDispatcher {