@shopware-ag/dive 1.19.1-beta.9 → 2.0.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/chunks/FileTypes-BjZ0rrIV.cjs +1 -0
- package/build/chunks/FileTypes-qgYnI0Jg.mjs +30 -0
- package/build/chunks/ModuleRegistry-NyNtjHb2.cjs +1 -0
- package/build/chunks/ModuleRegistry-RSub8W0G.mjs +13 -0
- package/build/chunks/PerspectiveCamera-BByyG5R4.cjs +1 -0
- package/build/chunks/PerspectiveCamera-sm4_81KJ.mjs +34 -0
- package/build/chunks/SelectTool-BRKko7uz.cjs +1 -0
- package/build/chunks/SelectTool-mTRiZYaC.mjs +712 -0
- package/build/chunks/{SystemInfo-DYq9x4Ch.mjs → SystemInfo-DPAQG-S5.mjs} +37 -40
- package/build/chunks/SystemInfo-oX-NNneO.cjs +1 -0
- package/build/chunks/VisibilityLayerMask-BI7jPKdx.cjs +1 -0
- package/build/chunks/VisibilityLayerMask-CXgt1fJc.mjs +8 -0
- package/build/chunks/findInterface-BEdL2iUQ.cjs +1 -0
- package/build/chunks/findInterface-OrXgmwxj.mjs +18 -0
- package/build/chunks/index-C_uFFwT2.mjs +5 -0
- package/build/chunks/index-DAwIH9xh.cjs +1 -0
- package/build/chunks/package-BFpY3sIj.cjs +1 -0
- package/build/chunks/package-BvoZkrge.mjs +39 -0
- package/build/chunks/{fflate.module-Chbb_O8w.cjs → parse-error-2f5qpXP5.cjs} +2 -3
- package/build/chunks/{fflate.module-BQhIETD7.mjs → parse-error-DRBVHL9E.mjs} +16 -17
- package/build/dive.cjs +30 -0
- package/build/dive.mjs +1757 -0
- package/build/src/components/gizmo/Gizmo.d.ts +4 -4
- package/build/src/components/gizmo/handles/AxisHandle.d.ts +4 -4
- package/build/src/components/gizmo/handles/RadialHandle.d.ts +4 -4
- package/build/src/components/gizmo/handles/ScaleHandle.d.ts +4 -4
- package/build/src/components/gizmo/plane/GizmoPlane.d.ts +1 -1
- package/build/src/components/gizmo/rotate/RotateGizmo.d.ts +4 -4
- package/build/src/components/gizmo/scale/ScaleGizmo.d.ts +5 -5
- package/build/src/components/gizmo/translate/TranslateGizmo.d.ts +4 -4
- package/build/src/components/light/PointLight.d.ts +3 -3
- package/build/src/components/model/Model.d.ts +2 -2
- package/build/src/components/node/Node.d.ts +4 -4
- package/build/src/components/primitive/Primitive.d.ts +1 -1
- package/build/src/components/root/Root.d.ts +2 -1
- package/build/src/core/Dive.d.ts +23 -11
- package/build/src/engine/Engine.d.ts +6 -6
- package/build/src/engine/clock/Clock.d.ts +4 -0
- package/build/src/engine/renderer/Renderer.d.ts +12 -8
- package/build/src/engine/resize/ResizeManager.d.ts +4 -2
- package/build/src/engine/scene/Scene.d.ts +4 -4
- package/build/src/engine/scene/xrroot/XRRoot.d.ts +5 -5
- package/build/src/engine/scene/xrroot/xrlightroot/XRLightRoot.d.ts +3 -3
- package/build/src/helpers/findSceneRecursive/findSceneRecursive.d.ts +1 -1
- package/build/src/helpers/isFileTypeSupported/isFileTypeSupported.d.ts +1 -1
- package/build/src/index.d.ts +6 -9
- package/build/src/interfaces/Draggable.d.ts +1 -1
- package/build/src/modules/ModuleRegistry.d.ts +19 -0
- package/build/src/modules/animation/AnimationSystem.cjs +1 -0
- package/build/src/modules/animation/AnimationSystem.d.ts +28 -4
- package/build/src/modules/animation/AnimationSystem.mjs +95 -0
- package/build/src/modules/animation/animator/Animator.d.ts +26 -0
- package/build/src/modules/animation/types/AnimatorParameters.d.ts +7 -0
- package/build/src/modules/ar/ARSystem.cjs +1 -2
- package/build/src/modules/ar/ARSystem.mjs +5 -5
- package/build/src/modules/ar/arquicklook/ARQuickLook.d.ts +1 -1
- package/build/src/modules/ar/sceneviewer/SceneViewer.d.ts +1 -1
- package/build/src/modules/ar/webxr/WebXR.d.ts +3 -3
- package/build/src/modules/ar/webxr/controller/WebXRController.d.ts +3 -3
- package/build/src/modules/ar/webxr/origin/WebXROrigin.d.ts +2 -2
- package/build/src/modules/ar/webxr/raycaster/WebXRRaycaster.d.ts +4 -4
- package/build/src/modules/ar/webxr/raycaster/ar/WebXRRaycasterAR.d.ts +3 -3
- package/build/src/modules/ar/webxr/raycaster/three/WebXRRaycasterTHREE.d.ts +4 -4
- package/build/src/modules/ar/webxr/touchscreencontrols/WebXRTouchscreenControls.d.ts +1 -1
- package/build/src/modules/asset/converter/AssetConverter.cjs +0 -1
- package/build/src/modules/asset/converter/AssetConverter.d.ts +3 -3
- package/build/src/modules/asset/converter/AssetConverter.mjs +0 -1
- package/build/src/modules/asset/exporter/AssetExporter.cjs +1 -2
- package/build/src/modules/asset/exporter/AssetExporter.d.ts +3 -3
- package/build/src/modules/asset/exporter/AssetExporter.mjs +1 -2
- package/build/src/modules/asset/loader/AssetLoader.cjs +2 -2
- package/build/src/modules/asset/loader/AssetLoader.mjs +1917 -5
- package/build/src/modules/axiscamera/AxisCamera.d.ts +8 -9
- package/build/src/modules/controller/orbit/OrbitController.d.ts +13 -24
- package/build/src/modules/mediacreator/MediaCreator.cjs +1 -2
- package/build/src/modules/mediacreator/MediaCreator.d.ts +4 -4
- package/build/src/modules/mediacreator/MediaCreator.mjs +28 -3
- package/build/src/modules/state/ActionRegistry.d.ts +26 -0
- package/build/src/modules/state/State.cjs +27 -0
- package/build/src/modules/state/State.d.ts +58 -0
- package/build/src/modules/state/State.mjs +4271 -0
- package/build/src/modules/state/actions/action.d.ts +36 -0
- package/build/src/modules/state/actions/ar/index.d.ts +1 -0
- package/build/src/modules/state/actions/ar/launchar.d.ts +15 -0
- package/build/src/modules/state/actions/camera/computeencompassingview.d.ts +12 -0
- package/build/src/modules/state/actions/camera/getcameratransform.d.ts +12 -0
- package/build/src/modules/state/actions/camera/index.d.ts +6 -0
- package/build/src/modules/state/actions/camera/lockcamera.d.ts +8 -0
- package/build/src/modules/state/actions/camera/movecamera.d.ts +29 -0
- package/build/src/modules/state/actions/camera/setcameralayer.d.ts +12 -0
- package/build/src/modules/state/actions/camera/setcameratransform.d.ts +15 -0
- package/build/src/modules/state/actions/camera/zoomcamera.d.ts +14 -0
- package/build/src/modules/state/actions/index.d.ts +7 -0
- package/build/src/modules/state/actions/media/generatemedia.d.ts +25 -0
- package/build/src/modules/state/actions/media/index.d.ts +1 -0
- package/build/src/modules/state/actions/object/addobject.d.ts +8 -0
- package/build/src/modules/state/actions/object/deleteobject.d.ts +12 -0
- package/build/src/modules/state/actions/object/deselectobject.d.ts +12 -0
- package/build/src/modules/state/actions/object/dropit.d.ts +12 -0
- package/build/src/modules/state/actions/object/getallobjects.d.ts +8 -0
- package/build/src/modules/state/actions/object/getobjects.d.ts +12 -0
- package/build/src/modules/state/actions/object/index.d.ts +11 -0
- package/build/src/modules/state/actions/object/modelloaded.d.ts +12 -0
- package/build/src/modules/state/actions/object/placeonfloor.d.ts +12 -0
- package/build/src/modules/state/actions/object/selectobject.d.ts +12 -0
- package/build/src/modules/state/actions/object/setparent.d.ts +22 -0
- package/build/src/modules/state/actions/object/updateobject.d.ts +12 -0
- package/build/src/modules/state/actions/renderer/index.d.ts +1 -0
- package/build/src/modules/state/actions/renderer/startrender.d.ts +8 -0
- package/build/src/modules/state/actions/scene/exportscene.d.ts +13 -0
- package/build/src/modules/state/actions/scene/getallscenedata.d.ts +9 -0
- package/build/src/modules/state/actions/scene/index.d.ts +4 -0
- package/build/src/modules/state/actions/scene/setbackground.d.ts +12 -0
- package/build/src/modules/state/actions/scene/updatescene.d.ts +20 -0
- package/build/src/modules/state/actions/toolbox/index.d.ts +4 -0
- package/build/src/modules/state/actions/toolbox/setgizmomode.d.ts +12 -0
- package/build/src/modules/state/actions/toolbox/setgizmoscalelinked.d.ts +8 -0
- package/build/src/modules/state/actions/toolbox/setgizmovisible.d.ts +8 -0
- package/build/src/modules/state/actions/toolbox/usetool.d.ts +13 -0
- package/build/src/modules/state/types/ActionTypes.d.ts +18 -0
- package/build/src/modules/{com → state}/types/COMBaseEntity.d.ts +1 -1
- package/build/src/modules/state/types/COMEntity.d.ts +6 -0
- package/build/src/modules/{com → state}/types/COMGeometry.d.ts +1 -1
- package/build/src/modules/{com → state}/types/COMGroup.d.ts +3 -1
- package/build/src/modules/{com → state}/types/COMLight.d.ts +3 -1
- package/build/src/modules/{com → state}/types/COMModel.d.ts +4 -2
- package/build/src/modules/state/types/COMPov.d.ts +9 -0
- package/build/src/modules/state/types/COMPrimitive.d.ts +13 -0
- package/build/src/modules/state/types/index.d.ts +11 -0
- package/build/src/modules/systeminfo/SystemInfo.cjs +1 -2
- package/build/src/modules/systeminfo/SystemInfo.d.ts +1 -1
- package/build/src/modules/systeminfo/SystemInfo.mjs +3 -3
- package/build/src/modules/toolbox/BaseTool.d.ts +6 -6
- package/build/src/modules/toolbox/Toolbox.cjs +1 -0
- package/build/src/modules/toolbox/Toolbox.d.ts +12 -8
- package/build/src/modules/toolbox/Toolbox.mjs +99 -0
- package/build/src/modules/toolbox/select/SelectTool.d.ts +6 -6
- package/build/src/modules/toolbox/transform/TransformTool.d.ts +6 -6
- package/build/src/types/SceneData.d.ts +1 -1
- package/build/src/types/SceneObjects.d.ts +6 -6
- package/build/src/types/SceneType.d.ts +1 -1
- package/build/src/types/UUID.d.ts +1 -0
- package/build/src/types/file/index.d.ts +1 -1
- package/build/src/types/index.d.ts +6 -6
- package/package.json +33 -23
- package/build/chunks/AssetLoader-BYhwzCxs.cjs +0 -3
- package/build/chunks/AssetLoader-BYhwzCxs.cjs.map +0 -1
- package/build/chunks/AssetLoader-Bmcx40wo.mjs +0 -1948
- package/build/chunks/AssetLoader-Bmcx40wo.mjs.map +0 -1
- package/build/chunks/MediaCreator-CAXBbn15.mjs +0 -59
- package/build/chunks/MediaCreator-CAXBbn15.mjs.map +0 -1
- package/build/chunks/MediaCreator-DDXQIlRv.cjs +0 -2
- package/build/chunks/MediaCreator-DDXQIlRv.cjs.map +0 -1
- package/build/chunks/SystemInfo--669uW1p.cjs +0 -2
- package/build/chunks/SystemInfo--669uW1p.cjs.map +0 -1
- package/build/chunks/SystemInfo-DYq9x4Ch.mjs.map +0 -1
- package/build/chunks/fflate.module-BQhIETD7.mjs.map +0 -1
- package/build/chunks/fflate.module-Chbb_O8w.cjs.map +0 -1
- package/build/index.cjs +0 -57
- package/build/index.cjs.map +0 -1
- package/build/index.mjs +0 -6793
- package/build/index.mjs.map +0 -1
- package/build/src/engine/index.d.ts +0 -1
- package/build/src/engine/pipeline/RenderPipeline.d.ts +0 -26
- package/build/src/error/index.d.ts +0 -4
- package/build/src/modules/_system/ModuleImporter.d.ts +0 -43
- package/build/src/modules/ar/ARSystem.cjs.map +0 -1
- package/build/src/modules/ar/ARSystem.mjs.map +0 -1
- package/build/src/modules/asset/converter/AssetConverter.cjs.map +0 -1
- package/build/src/modules/asset/converter/AssetConverter.mjs.map +0 -1
- package/build/src/modules/asset/exporter/AssetExporter.cjs.map +0 -1
- package/build/src/modules/asset/exporter/AssetExporter.mjs.map +0 -1
- package/build/src/modules/asset/loader/AssetLoader.cjs.map +0 -1
- package/build/src/modules/asset/loader/AssetLoader.mjs.map +0 -1
- package/build/src/modules/com/Communication.d.ts +0 -72
- package/build/src/modules/com/actions/camera/computeencompassingview.d.ts +0 -9
- package/build/src/modules/com/actions/camera/getcameratransform.d.ts +0 -9
- package/build/src/modules/com/actions/camera/movecamera.d.ts +0 -15
- package/build/src/modules/com/actions/camera/resetcamera.d.ts +0 -7
- package/build/src/modules/com/actions/camera/setcameralayer.d.ts +0 -7
- package/build/src/modules/com/actions/camera/setcameratransform.d.ts +0 -9
- package/build/src/modules/com/actions/camera/zoomcamera.d.ts +0 -8
- package/build/src/modules/com/actions/index.d.ts +0 -60
- package/build/src/modules/com/actions/media/generatemedia.d.ts +0 -14
- package/build/src/modules/com/actions/object/addobject.d.ts +0 -6
- package/build/src/modules/com/actions/object/deleteobject.d.ts +0 -8
- package/build/src/modules/com/actions/object/deselectobject.d.ts +0 -8
- package/build/src/modules/com/actions/object/getallobjects.d.ts +0 -6
- package/build/src/modules/com/actions/object/getobjects.d.ts +0 -8
- package/build/src/modules/com/actions/object/model/dropit.d.ts +0 -7
- package/build/src/modules/com/actions/object/model/modelloaded.d.ts +0 -7
- package/build/src/modules/com/actions/object/model/placeonfloor.d.ts +0 -7
- package/build/src/modules/com/actions/object/selectobject.d.ts +0 -8
- package/build/src/modules/com/actions/object/setparent.d.ts +0 -13
- package/build/src/modules/com/actions/object/updateobject.d.ts +0 -8
- package/build/src/modules/com/actions/renderer/startrender.d.ts +0 -5
- package/build/src/modules/com/actions/scene/exportscene.d.ts +0 -8
- package/build/src/modules/com/actions/scene/getallscenedata.d.ts +0 -6
- package/build/src/modules/com/actions/scene/launchar.d.ts +0 -9
- package/build/src/modules/com/actions/scene/setbackground.d.ts +0 -7
- package/build/src/modules/com/actions/scene/updatescene.d.ts +0 -11
- package/build/src/modules/com/actions/toolbox/select/setgizmomode.d.ts +0 -7
- package/build/src/modules/com/actions/toolbox/transform/setgizmoscalelinked.d.ts +0 -5
- package/build/src/modules/com/actions/toolbox/transform/setgizmovisible.d.ts +0 -5
- package/build/src/modules/com/actions/toolbox/usetool.d.ts +0 -8
- package/build/src/modules/com/types/COMEntity.d.ts +0 -6
- package/build/src/modules/com/types/COMPov.d.ts +0 -7
- package/build/src/modules/com/types/COMPrimitive.d.ts +0 -11
- package/build/src/modules/com/types/index.d.ts +0 -11
- package/build/src/modules/index.d.ts +0 -2
- package/build/src/modules/mediacreator/MediaCreator.cjs.map +0 -1
- package/build/src/modules/mediacreator/MediaCreator.mjs.map +0 -1
- package/build/src/modules/systeminfo/SystemInfo.cjs.map +0 -1
- package/build/src/modules/systeminfo/SystemInfo.mjs.map +0 -1
- /package/build/{index.d.ts → dive.d.ts} +0 -0
- /package/build/src/modules/{com → state}/types/COMEntityType.d.ts +0 -0
- /package/build/src/modules/{com → state}/types/COMGeometryType.d.ts +0 -0
- /package/build/src/modules/{com → state}/types/COMMaterial.d.ts +0 -0
|
@@ -0,0 +1,712 @@
|
|
|
1
|
+
var jt = Object.defineProperty;
|
|
2
|
+
var Xt = (r, i, t) => i in r ? jt(r, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[i] = t;
|
|
3
|
+
var c = (r, i, t) => Xt(r, typeof i != "symbol" ? i + "" : i, t);
|
|
4
|
+
import { Object3D as st, Vector3 as a, Quaternion as E, Raycaster as bt, MeshBasicMaterial as St, LineBasicMaterial as Yt, CylinderGeometry as w, BoxGeometry as f, BufferGeometry as lt, Float32BufferAttribute as ht, Mesh as o, OctahedronGeometry as B, Line as I, TorusGeometry as C, SphereGeometry as Qt, Euler as Zt, Matrix4 as vt, PlaneGeometry as Ht, DoubleSide as Ot, Vector2 as tt } from "three";
|
|
5
|
+
import { P as Ct, U as Rt } from "./VisibilityLayerMask-CXgt1fJc.mjs";
|
|
6
|
+
import { f as ot, A as ct, a as dt, b as pt, i as et } from "./findInterface-OrXgmwxj.mjs";
|
|
7
|
+
const j = new bt(), u = new a(), A = new a(), d = new E(), ut = {
|
|
8
|
+
X: new a(1, 0, 0),
|
|
9
|
+
Y: new a(0, 1, 0),
|
|
10
|
+
Z: new a(0, 0, 1)
|
|
11
|
+
}, it = { type: "change" }, mt = { type: "mouseDown" }, ft = { type: "mouseUp", mode: null }, _t = { type: "objectChange" };
|
|
12
|
+
class kt extends st {
|
|
13
|
+
constructor(i, t) {
|
|
14
|
+
super(), t === void 0 && (console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'), t = document), this.isTransformControls = !0, this.visible = !1, this.domElement = t, this.domElement.style.touchAction = "none";
|
|
15
|
+
const n = new Ut();
|
|
16
|
+
this._gizmo = n, this.add(n);
|
|
17
|
+
const s = new Vt();
|
|
18
|
+
this._plane = s, this.add(s);
|
|
19
|
+
const l = this;
|
|
20
|
+
function e(m, b) {
|
|
21
|
+
let Q = b;
|
|
22
|
+
Object.defineProperty(l, m, {
|
|
23
|
+
get: function() {
|
|
24
|
+
return Q !== void 0 ? Q : b;
|
|
25
|
+
},
|
|
26
|
+
set: function(T) {
|
|
27
|
+
Q !== T && (Q = T, s[m] = T, n[m] = T, l.dispatchEvent({ type: m + "-changed", value: T }), l.dispatchEvent(it));
|
|
28
|
+
}
|
|
29
|
+
}), l[m] = b, s[m] = b, n[m] = b;
|
|
30
|
+
}
|
|
31
|
+
e("camera", i), e("object", void 0), e("enabled", !0), e("axis", null), e("mode", "translate"), e("translationSnap", null), e("rotationSnap", null), e("scaleSnap", null), e("space", "world"), e("size", 1), e("dragging", !1), e("showX", !0), e("showY", !0), e("showZ", !0);
|
|
32
|
+
const p = new a(), g = new a(), z = new E(), Y = new E(), H = new a(), O = new E(), at = new a(), q = new a(), M = new a(), x = 0, v = new a();
|
|
33
|
+
e("worldPosition", p), e("worldPositionStart", g), e("worldQuaternion", z), e("worldQuaternionStart", Y), e("cameraPosition", H), e("cameraQuaternion", O), e("pointStart", at), e("pointEnd", q), e("rotationAxis", M), e("rotationAngle", x), e("eye", v), this._offset = new a(), this._startNorm = new a(), this._endNorm = new a(), this._cameraScale = new a(), this._parentPosition = new a(), this._parentQuaternion = new E(), this._parentQuaternionInv = new E(), this._parentScale = new a(), this._worldScaleStart = new a(), this._worldQuaternionInv = new E(), this._worldScale = new a(), this._positionStart = new a(), this._quaternionStart = new E(), this._scaleStart = new a(), this._getPointer = Lt.bind(this), this._onPointerDown = qt.bind(this), this._onPointerHover = Gt.bind(this), this._onPointerMove = Wt.bind(this), this._onPointerUp = Ft.bind(this), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointermove", this._onPointerHover), this.domElement.addEventListener("pointerup", this._onPointerUp);
|
|
34
|
+
}
|
|
35
|
+
// updateMatrixWorld updates key transformation variables
|
|
36
|
+
updateMatrixWorld(i) {
|
|
37
|
+
this.object !== void 0 && (this.object.updateMatrixWorld(), this.object.parent === null ? console.error("TransformControls: The attached 3D object must be a part of the scene graph.") : this.object.parent.matrixWorld.decompose(this._parentPosition, this._parentQuaternion, this._parentScale), this.object.matrixWorld.decompose(this.worldPosition, this.worldQuaternion, this._worldScale), this._parentQuaternionInv.copy(this._parentQuaternion).invert(), this._worldQuaternionInv.copy(this.worldQuaternion).invert()), this.camera.updateMatrixWorld(), this.camera.matrixWorld.decompose(this.cameraPosition, this.cameraQuaternion, this._cameraScale), this.camera.isOrthographicCamera ? this.camera.getWorldDirection(this.eye).negate() : this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(), super.updateMatrixWorld(i);
|
|
38
|
+
}
|
|
39
|
+
pointerHover(i) {
|
|
40
|
+
if (this.object === void 0 || this.dragging === !0) return;
|
|
41
|
+
i !== null && j.setFromCamera(i, this.camera);
|
|
42
|
+
const t = nt(this._gizmo.picker[this.mode], j);
|
|
43
|
+
t ? this.axis = t.object.name : this.axis = null;
|
|
44
|
+
}
|
|
45
|
+
pointerDown(i) {
|
|
46
|
+
if (!(this.object === void 0 || this.dragging === !0 || i != null && i.button !== 0) && this.axis !== null) {
|
|
47
|
+
i !== null && j.setFromCamera(i, this.camera);
|
|
48
|
+
const t = nt(this._plane, j, !0);
|
|
49
|
+
t && (this.object.updateMatrixWorld(), this.object.parent.updateMatrixWorld(), this._positionStart.copy(this.object.position), this._quaternionStart.copy(this.object.quaternion), this._scaleStart.copy(this.object.scale), this.object.matrixWorld.decompose(this.worldPositionStart, this.worldQuaternionStart, this._worldScaleStart), this.pointStart.copy(t.point).sub(this.worldPositionStart)), this.dragging = !0, mt.mode = this.mode, this.dispatchEvent(mt);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
pointerMove(i) {
|
|
53
|
+
const t = this.axis, n = this.mode, s = this.object;
|
|
54
|
+
let l = this.space;
|
|
55
|
+
if (n === "scale" ? l = "local" : (t === "E" || t === "XYZE" || t === "XYZ") && (l = "world"), s === void 0 || t === null || this.dragging === !1 || i !== null && i.button !== -1) return;
|
|
56
|
+
i !== null && j.setFromCamera(i, this.camera);
|
|
57
|
+
const e = nt(this._plane, j, !0);
|
|
58
|
+
if (e) {
|
|
59
|
+
if (this.pointEnd.copy(e.point).sub(this.worldPositionStart), n === "translate")
|
|
60
|
+
this._offset.copy(this.pointEnd).sub(this.pointStart), l === "local" && t !== "XYZ" && this._offset.applyQuaternion(this._worldQuaternionInv), t.indexOf("X") === -1 && (this._offset.x = 0), t.indexOf("Y") === -1 && (this._offset.y = 0), t.indexOf("Z") === -1 && (this._offset.z = 0), l === "local" && t !== "XYZ" ? this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale) : this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale), s.position.copy(this._offset).add(this._positionStart), this.translationSnap && (l === "local" && (s.position.applyQuaternion(d.copy(this._quaternionStart).invert()), t.search("X") !== -1 && (s.position.x = Math.round(s.position.x / this.translationSnap) * this.translationSnap), t.search("Y") !== -1 && (s.position.y = Math.round(s.position.y / this.translationSnap) * this.translationSnap), t.search("Z") !== -1 && (s.position.z = Math.round(s.position.z / this.translationSnap) * this.translationSnap), s.position.applyQuaternion(this._quaternionStart)), l === "world" && (s.parent && s.position.add(u.setFromMatrixPosition(s.parent.matrixWorld)), t.search("X") !== -1 && (s.position.x = Math.round(s.position.x / this.translationSnap) * this.translationSnap), t.search("Y") !== -1 && (s.position.y = Math.round(s.position.y / this.translationSnap) * this.translationSnap), t.search("Z") !== -1 && (s.position.z = Math.round(s.position.z / this.translationSnap) * this.translationSnap), s.parent && s.position.sub(u.setFromMatrixPosition(s.parent.matrixWorld))));
|
|
61
|
+
else if (n === "scale") {
|
|
62
|
+
if (t.search("XYZ") !== -1) {
|
|
63
|
+
let p = this.pointEnd.length() / this.pointStart.length();
|
|
64
|
+
this.pointEnd.dot(this.pointStart) < 0 && (p *= -1), A.set(p, p, p);
|
|
65
|
+
} else
|
|
66
|
+
u.copy(this.pointStart), A.copy(this.pointEnd), u.applyQuaternion(this._worldQuaternionInv), A.applyQuaternion(this._worldQuaternionInv), A.divide(u), t.search("X") === -1 && (A.x = 1), t.search("Y") === -1 && (A.y = 1), t.search("Z") === -1 && (A.z = 1);
|
|
67
|
+
s.scale.copy(this._scaleStart).multiply(A), this.scaleSnap && (t.search("X") !== -1 && (s.scale.x = Math.round(s.scale.x / this.scaleSnap) * this.scaleSnap || this.scaleSnap), t.search("Y") !== -1 && (s.scale.y = Math.round(s.scale.y / this.scaleSnap) * this.scaleSnap || this.scaleSnap), t.search("Z") !== -1 && (s.scale.z = Math.round(s.scale.z / this.scaleSnap) * this.scaleSnap || this.scaleSnap));
|
|
68
|
+
} else if (n === "rotate") {
|
|
69
|
+
this._offset.copy(this.pointEnd).sub(this.pointStart);
|
|
70
|
+
const p = 20 / this.worldPosition.distanceTo(u.setFromMatrixPosition(this.camera.matrixWorld));
|
|
71
|
+
let g = !1;
|
|
72
|
+
t === "XYZE" ? (this.rotationAxis.copy(this._offset).cross(this.eye).normalize(), this.rotationAngle = this._offset.dot(u.copy(this.rotationAxis).cross(this.eye)) * p) : (t === "X" || t === "Y" || t === "Z") && (this.rotationAxis.copy(ut[t]), u.copy(ut[t]), l === "local" && u.applyQuaternion(this.worldQuaternion), u.cross(this.eye), u.length() === 0 ? g = !0 : this.rotationAngle = this._offset.dot(u.normalize()) * p), (t === "E" || g) && (this.rotationAxis.copy(this.eye), this.rotationAngle = this.pointEnd.angleTo(this.pointStart), this._startNorm.copy(this.pointStart).normalize(), this._endNorm.copy(this.pointEnd).normalize(), this.rotationAngle *= this._endNorm.cross(this._startNorm).dot(this.eye) < 0 ? 1 : -1), this.rotationSnap && (this.rotationAngle = Math.round(this.rotationAngle / this.rotationSnap) * this.rotationSnap), l === "local" && t !== "E" && t !== "XYZE" ? (s.quaternion.copy(this._quaternionStart), s.quaternion.multiply(d.setFromAxisAngle(this.rotationAxis, this.rotationAngle)).normalize()) : (this.rotationAxis.applyQuaternion(this._parentQuaternionInv), s.quaternion.copy(d.setFromAxisAngle(this.rotationAxis, this.rotationAngle)), s.quaternion.multiply(this._quaternionStart).normalize());
|
|
73
|
+
}
|
|
74
|
+
this.dispatchEvent(it), this.dispatchEvent(_t);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
pointerUp(i) {
|
|
78
|
+
i !== null && i.button !== 0 || (this.dragging && this.axis !== null && (ft.mode = this.mode, this.dispatchEvent(ft)), this.dragging = !1, this.axis = null);
|
|
79
|
+
}
|
|
80
|
+
dispose() {
|
|
81
|
+
this.domElement.removeEventListener("pointerdown", this._onPointerDown), this.domElement.removeEventListener("pointermove", this._onPointerHover), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.traverse(function(i) {
|
|
82
|
+
i.geometry && i.geometry.dispose(), i.material && i.material.dispose();
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
// Set current object
|
|
86
|
+
attach(i) {
|
|
87
|
+
return this.object = i, this.visible = !0, this;
|
|
88
|
+
}
|
|
89
|
+
// Detach from object
|
|
90
|
+
detach() {
|
|
91
|
+
return this.object = void 0, this.visible = !1, this.axis = null, this;
|
|
92
|
+
}
|
|
93
|
+
reset() {
|
|
94
|
+
this.enabled && this.dragging && (this.object.position.copy(this._positionStart), this.object.quaternion.copy(this._quaternionStart), this.object.scale.copy(this._scaleStart), this.dispatchEvent(it), this.dispatchEvent(_t), this.pointStart.copy(this.pointEnd));
|
|
95
|
+
}
|
|
96
|
+
getRaycaster() {
|
|
97
|
+
return j;
|
|
98
|
+
}
|
|
99
|
+
// TODO: deprecate
|
|
100
|
+
getMode() {
|
|
101
|
+
return this.mode;
|
|
102
|
+
}
|
|
103
|
+
setMode(i) {
|
|
104
|
+
this.mode = i;
|
|
105
|
+
}
|
|
106
|
+
setTranslationSnap(i) {
|
|
107
|
+
this.translationSnap = i;
|
|
108
|
+
}
|
|
109
|
+
setRotationSnap(i) {
|
|
110
|
+
this.rotationSnap = i;
|
|
111
|
+
}
|
|
112
|
+
setScaleSnap(i) {
|
|
113
|
+
this.scaleSnap = i;
|
|
114
|
+
}
|
|
115
|
+
setSize(i) {
|
|
116
|
+
this.size = i;
|
|
117
|
+
}
|
|
118
|
+
setSpace(i) {
|
|
119
|
+
this.space = i;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function Lt(r) {
|
|
123
|
+
if (this.domElement.ownerDocument.pointerLockElement)
|
|
124
|
+
return {
|
|
125
|
+
x: 0,
|
|
126
|
+
y: 0,
|
|
127
|
+
button: r.button
|
|
128
|
+
};
|
|
129
|
+
{
|
|
130
|
+
const i = this.domElement.getBoundingClientRect();
|
|
131
|
+
return {
|
|
132
|
+
x: (r.clientX - i.left) / i.width * 2 - 1,
|
|
133
|
+
y: -(r.clientY - i.top) / i.height * 2 + 1,
|
|
134
|
+
button: r.button
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function Gt(r) {
|
|
139
|
+
if (this.enabled)
|
|
140
|
+
switch (r.pointerType) {
|
|
141
|
+
case "mouse":
|
|
142
|
+
case "pen":
|
|
143
|
+
this.pointerHover(this._getPointer(r));
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function qt(r) {
|
|
148
|
+
this.enabled && (document.pointerLockElement || this.domElement.setPointerCapture(r.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.pointerHover(this._getPointer(r)), this.pointerDown(this._getPointer(r)));
|
|
149
|
+
}
|
|
150
|
+
function Wt(r) {
|
|
151
|
+
this.enabled && this.pointerMove(this._getPointer(r));
|
|
152
|
+
}
|
|
153
|
+
function Ft(r) {
|
|
154
|
+
this.enabled && (this.domElement.releasePointerCapture(r.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.pointerUp(this._getPointer(r)));
|
|
155
|
+
}
|
|
156
|
+
function nt(r, i, t) {
|
|
157
|
+
const n = i.intersectObject(r, !0);
|
|
158
|
+
for (let s = 0; s < n.length; s++)
|
|
159
|
+
if (n[s].object.visible || t)
|
|
160
|
+
return n[s];
|
|
161
|
+
return !1;
|
|
162
|
+
}
|
|
163
|
+
const N = new Zt(), h = new a(0, 1, 0), wt = new a(0, 0, 0), gt = new vt(), K = new E(), $ = new E(), P = new a(), yt = new vt(), L = new a(1, 0, 0), X = new a(0, 1, 0), G = new a(0, 0, 1), J = new a(), R = new a(), k = new a();
|
|
164
|
+
class Ut extends st {
|
|
165
|
+
constructor() {
|
|
166
|
+
super(), this.isTransformControlsGizmo = !0, this.type = "TransformControlsGizmo";
|
|
167
|
+
const i = new St({
|
|
168
|
+
depthTest: !1,
|
|
169
|
+
depthWrite: !1,
|
|
170
|
+
fog: !1,
|
|
171
|
+
toneMapped: !1,
|
|
172
|
+
transparent: !0
|
|
173
|
+
}), t = new Yt({
|
|
174
|
+
depthTest: !1,
|
|
175
|
+
depthWrite: !1,
|
|
176
|
+
fog: !1,
|
|
177
|
+
toneMapped: !1,
|
|
178
|
+
transparent: !0
|
|
179
|
+
}), n = i.clone();
|
|
180
|
+
n.opacity = 0.15;
|
|
181
|
+
const s = t.clone();
|
|
182
|
+
s.opacity = 0.5;
|
|
183
|
+
const l = i.clone();
|
|
184
|
+
l.color.setHex(16711680);
|
|
185
|
+
const e = i.clone();
|
|
186
|
+
e.color.setHex(65280);
|
|
187
|
+
const p = i.clone();
|
|
188
|
+
p.color.setHex(255);
|
|
189
|
+
const g = i.clone();
|
|
190
|
+
g.color.setHex(16711680), g.opacity = 0.5;
|
|
191
|
+
const z = i.clone();
|
|
192
|
+
z.color.setHex(65280), z.opacity = 0.5;
|
|
193
|
+
const Y = i.clone();
|
|
194
|
+
Y.color.setHex(255), Y.opacity = 0.5;
|
|
195
|
+
const H = i.clone();
|
|
196
|
+
H.opacity = 0.25;
|
|
197
|
+
const O = i.clone();
|
|
198
|
+
O.color.setHex(16776960), O.opacity = 0.25, i.clone().color.setHex(16776960);
|
|
199
|
+
const q = i.clone();
|
|
200
|
+
q.color.setHex(7895160);
|
|
201
|
+
const M = new w(0, 0.04, 0.1, 12);
|
|
202
|
+
M.translate(0, 0.05, 0);
|
|
203
|
+
const x = new f(0.08, 0.08, 0.08);
|
|
204
|
+
x.translate(0, 0.04, 0);
|
|
205
|
+
const v = new lt();
|
|
206
|
+
v.setAttribute("position", new ht([0, 0, 0, 1, 0, 0], 3));
|
|
207
|
+
const m = new w(75e-4, 75e-4, 0.5, 3);
|
|
208
|
+
m.translate(0, 0.25, 0);
|
|
209
|
+
function b(y, W) {
|
|
210
|
+
const S = new C(y, 75e-4, 3, 64, W * Math.PI * 2);
|
|
211
|
+
return S.rotateY(Math.PI / 2), S.rotateX(Math.PI / 2), S;
|
|
212
|
+
}
|
|
213
|
+
function Q() {
|
|
214
|
+
const y = new lt();
|
|
215
|
+
return y.setAttribute("position", new ht([0, 0, 0, 1, 1, 1], 3)), y;
|
|
216
|
+
}
|
|
217
|
+
const T = {
|
|
218
|
+
X: [
|
|
219
|
+
[new o(M, l), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
|
|
220
|
+
[new o(M, l), [-0.5, 0, 0], [0, 0, Math.PI / 2]],
|
|
221
|
+
[new o(m, l), [0, 0, 0], [0, 0, -Math.PI / 2]]
|
|
222
|
+
],
|
|
223
|
+
Y: [
|
|
224
|
+
[new o(M, e), [0, 0.5, 0]],
|
|
225
|
+
[new o(M, e), [0, -0.5, 0], [Math.PI, 0, 0]],
|
|
226
|
+
[new o(m, e)]
|
|
227
|
+
],
|
|
228
|
+
Z: [
|
|
229
|
+
[new o(M, p), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
|
|
230
|
+
[new o(M, p), [0, 0, -0.5], [-Math.PI / 2, 0, 0]],
|
|
231
|
+
[new o(m, p), null, [Math.PI / 2, 0, 0]]
|
|
232
|
+
],
|
|
233
|
+
XYZ: [
|
|
234
|
+
[new o(new B(0.1, 0), H.clone()), [0, 0, 0]]
|
|
235
|
+
],
|
|
236
|
+
XY: [
|
|
237
|
+
[new o(new f(0.15, 0.15, 0.01), Y.clone()), [0.15, 0.15, 0]]
|
|
238
|
+
],
|
|
239
|
+
YZ: [
|
|
240
|
+
[new o(new f(0.15, 0.15, 0.01), g.clone()), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
|
|
241
|
+
],
|
|
242
|
+
XZ: [
|
|
243
|
+
[new o(new f(0.15, 0.15, 0.01), z.clone()), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
|
|
244
|
+
]
|
|
245
|
+
}, Pt = {
|
|
246
|
+
X: [
|
|
247
|
+
[new o(new w(0.2, 0, 0.6, 4), n), [0.3, 0, 0], [0, 0, -Math.PI / 2]],
|
|
248
|
+
[new o(new w(0.2, 0, 0.6, 4), n), [-0.3, 0, 0], [0, 0, Math.PI / 2]]
|
|
249
|
+
],
|
|
250
|
+
Y: [
|
|
251
|
+
[new o(new w(0.2, 0, 0.6, 4), n), [0, 0.3, 0]],
|
|
252
|
+
[new o(new w(0.2, 0, 0.6, 4), n), [0, -0.3, 0], [0, 0, Math.PI]]
|
|
253
|
+
],
|
|
254
|
+
Z: [
|
|
255
|
+
[new o(new w(0.2, 0, 0.6, 4), n), [0, 0, 0.3], [Math.PI / 2, 0, 0]],
|
|
256
|
+
[new o(new w(0.2, 0, 0.6, 4), n), [0, 0, -0.3], [-Math.PI / 2, 0, 0]]
|
|
257
|
+
],
|
|
258
|
+
XYZ: [
|
|
259
|
+
[new o(new B(0.2, 0), n)]
|
|
260
|
+
],
|
|
261
|
+
XY: [
|
|
262
|
+
[new o(new f(0.2, 0.2, 0.01), n), [0.15, 0.15, 0]]
|
|
263
|
+
],
|
|
264
|
+
YZ: [
|
|
265
|
+
[new o(new f(0.2, 0.2, 0.01), n), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
|
|
266
|
+
],
|
|
267
|
+
XZ: [
|
|
268
|
+
[new o(new f(0.2, 0.2, 0.01), n), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
|
|
269
|
+
]
|
|
270
|
+
}, Et = {
|
|
271
|
+
START: [
|
|
272
|
+
[new o(new B(0.01, 2), s), null, null, null, "helper"]
|
|
273
|
+
],
|
|
274
|
+
END: [
|
|
275
|
+
[new o(new B(0.01, 2), s), null, null, null, "helper"]
|
|
276
|
+
],
|
|
277
|
+
DELTA: [
|
|
278
|
+
[new I(Q(), s), null, null, null, "helper"]
|
|
279
|
+
],
|
|
280
|
+
X: [
|
|
281
|
+
[new I(v, s.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
|
|
282
|
+
],
|
|
283
|
+
Y: [
|
|
284
|
+
[new I(v, s.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]
|
|
285
|
+
],
|
|
286
|
+
Z: [
|
|
287
|
+
[new I(v, s.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]
|
|
288
|
+
]
|
|
289
|
+
}, Mt = {
|
|
290
|
+
XYZE: [
|
|
291
|
+
[new o(b(0.5, 1), q), null, [0, Math.PI / 2, 0]]
|
|
292
|
+
],
|
|
293
|
+
X: [
|
|
294
|
+
[new o(b(0.5, 0.5), l)]
|
|
295
|
+
],
|
|
296
|
+
Y: [
|
|
297
|
+
[new o(b(0.5, 0.5), e), null, [0, 0, -Math.PI / 2]]
|
|
298
|
+
],
|
|
299
|
+
Z: [
|
|
300
|
+
[new o(b(0.5, 0.5), p), null, [0, Math.PI / 2, 0]]
|
|
301
|
+
],
|
|
302
|
+
E: [
|
|
303
|
+
[new o(b(0.75, 1), O), null, [0, Math.PI / 2, 0]]
|
|
304
|
+
]
|
|
305
|
+
}, xt = {
|
|
306
|
+
AXIS: [
|
|
307
|
+
[new I(v, s.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
|
|
308
|
+
]
|
|
309
|
+
}, Dt = {
|
|
310
|
+
XYZE: [
|
|
311
|
+
[new o(new Qt(0.25, 10, 8), n)]
|
|
312
|
+
],
|
|
313
|
+
X: [
|
|
314
|
+
[new o(new C(0.5, 0.1, 4, 24), n), [0, 0, 0], [0, -Math.PI / 2, -Math.PI / 2]]
|
|
315
|
+
],
|
|
316
|
+
Y: [
|
|
317
|
+
[new o(new C(0.5, 0.1, 4, 24), n), [0, 0, 0], [Math.PI / 2, 0, 0]]
|
|
318
|
+
],
|
|
319
|
+
Z: [
|
|
320
|
+
[new o(new C(0.5, 0.1, 4, 24), n), [0, 0, 0], [0, 0, -Math.PI / 2]]
|
|
321
|
+
],
|
|
322
|
+
E: [
|
|
323
|
+
[new o(new C(0.75, 0.1, 2, 24), n)]
|
|
324
|
+
]
|
|
325
|
+
}, It = {
|
|
326
|
+
X: [
|
|
327
|
+
[new o(x, l), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
|
|
328
|
+
[new o(m, l), [0, 0, 0], [0, 0, -Math.PI / 2]],
|
|
329
|
+
[new o(x, l), [-0.5, 0, 0], [0, 0, Math.PI / 2]]
|
|
330
|
+
],
|
|
331
|
+
Y: [
|
|
332
|
+
[new o(x, e), [0, 0.5, 0]],
|
|
333
|
+
[new o(m, e)],
|
|
334
|
+
[new o(x, e), [0, -0.5, 0], [0, 0, Math.PI]]
|
|
335
|
+
],
|
|
336
|
+
Z: [
|
|
337
|
+
[new o(x, p), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
|
|
338
|
+
[new o(m, p), [0, 0, 0], [Math.PI / 2, 0, 0]],
|
|
339
|
+
[new o(x, p), [0, 0, -0.5], [-Math.PI / 2, 0, 0]]
|
|
340
|
+
],
|
|
341
|
+
XY: [
|
|
342
|
+
[new o(new f(0.15, 0.15, 0.01), Y), [0.15, 0.15, 0]]
|
|
343
|
+
],
|
|
344
|
+
YZ: [
|
|
345
|
+
[new o(new f(0.15, 0.15, 0.01), g), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
|
|
346
|
+
],
|
|
347
|
+
XZ: [
|
|
348
|
+
[new o(new f(0.15, 0.15, 0.01), z), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
|
|
349
|
+
],
|
|
350
|
+
XYZ: [
|
|
351
|
+
[new o(new f(0.1, 0.1, 0.1), H.clone())]
|
|
352
|
+
]
|
|
353
|
+
}, At = {
|
|
354
|
+
X: [
|
|
355
|
+
[new o(new w(0.2, 0, 0.6, 4), n), [0.3, 0, 0], [0, 0, -Math.PI / 2]],
|
|
356
|
+
[new o(new w(0.2, 0, 0.6, 4), n), [-0.3, 0, 0], [0, 0, Math.PI / 2]]
|
|
357
|
+
],
|
|
358
|
+
Y: [
|
|
359
|
+
[new o(new w(0.2, 0, 0.6, 4), n), [0, 0.3, 0]],
|
|
360
|
+
[new o(new w(0.2, 0, 0.6, 4), n), [0, -0.3, 0], [0, 0, Math.PI]]
|
|
361
|
+
],
|
|
362
|
+
Z: [
|
|
363
|
+
[new o(new w(0.2, 0, 0.6, 4), n), [0, 0, 0.3], [Math.PI / 2, 0, 0]],
|
|
364
|
+
[new o(new w(0.2, 0, 0.6, 4), n), [0, 0, -0.3], [-Math.PI / 2, 0, 0]]
|
|
365
|
+
],
|
|
366
|
+
XY: [
|
|
367
|
+
[new o(new f(0.2, 0.2, 0.01), n), [0.15, 0.15, 0]]
|
|
368
|
+
],
|
|
369
|
+
YZ: [
|
|
370
|
+
[new o(new f(0.2, 0.2, 0.01), n), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
|
|
371
|
+
],
|
|
372
|
+
XZ: [
|
|
373
|
+
[new o(new f(0.2, 0.2, 0.01), n), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
|
|
374
|
+
],
|
|
375
|
+
XYZ: [
|
|
376
|
+
[new o(new f(0.2, 0.2, 0.2), n), [0, 0, 0]]
|
|
377
|
+
]
|
|
378
|
+
}, zt = {
|
|
379
|
+
X: [
|
|
380
|
+
[new I(v, s.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
|
|
381
|
+
],
|
|
382
|
+
Y: [
|
|
383
|
+
[new I(v, s.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]
|
|
384
|
+
],
|
|
385
|
+
Z: [
|
|
386
|
+
[new I(v, s.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]
|
|
387
|
+
]
|
|
388
|
+
};
|
|
389
|
+
function D(y) {
|
|
390
|
+
const W = new st();
|
|
391
|
+
for (const S in y)
|
|
392
|
+
for (let Z = y[S].length; Z--; ) {
|
|
393
|
+
const _ = y[S][Z][0].clone(), F = y[S][Z][1], U = y[S][Z][2], V = y[S][Z][3], Tt = y[S][Z][4];
|
|
394
|
+
_.name = S, _.tag = Tt, F && _.position.set(F[0], F[1], F[2]), U && _.rotation.set(U[0], U[1], U[2]), V && _.scale.set(V[0], V[1], V[2]), _.updateMatrix();
|
|
395
|
+
const rt = _.geometry.clone();
|
|
396
|
+
rt.applyMatrix4(_.matrix), _.geometry = rt, _.renderOrder = 1 / 0, _.position.set(0, 0, 0), _.rotation.set(0, 0, 0), _.scale.set(1, 1, 1), W.add(_);
|
|
397
|
+
}
|
|
398
|
+
return W;
|
|
399
|
+
}
|
|
400
|
+
this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = D(T)), this.add(this.gizmo.rotate = D(Mt)), this.add(this.gizmo.scale = D(It)), this.add(this.picker.translate = D(Pt)), this.add(this.picker.rotate = D(Dt)), this.add(this.picker.scale = D(At)), this.add(this.helper.translate = D(Et)), this.add(this.helper.rotate = D(xt)), this.add(this.helper.scale = D(zt)), this.picker.translate.visible = !1, this.picker.rotate.visible = !1, this.picker.scale.visible = !1;
|
|
401
|
+
}
|
|
402
|
+
// updateMatrixWorld will update transformations and appearance of individual handles
|
|
403
|
+
updateMatrixWorld(i) {
|
|
404
|
+
const n = (this.mode === "scale" ? "local" : this.space) === "local" ? this.worldQuaternion : $;
|
|
405
|
+
this.gizmo.translate.visible = this.mode === "translate", this.gizmo.rotate.visible = this.mode === "rotate", this.gizmo.scale.visible = this.mode === "scale", this.helper.translate.visible = this.mode === "translate", this.helper.rotate.visible = this.mode === "rotate", this.helper.scale.visible = this.mode === "scale";
|
|
406
|
+
let s = [];
|
|
407
|
+
s = s.concat(this.picker[this.mode].children), s = s.concat(this.gizmo[this.mode].children), s = s.concat(this.helper[this.mode].children);
|
|
408
|
+
for (let l = 0; l < s.length; l++) {
|
|
409
|
+
const e = s[l];
|
|
410
|
+
e.visible = !0, e.rotation.set(0, 0, 0), e.position.copy(this.worldPosition);
|
|
411
|
+
let p;
|
|
412
|
+
if (this.camera.isOrthographicCamera ? p = (this.camera.top - this.camera.bottom) / this.camera.zoom : p = this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * this.camera.fov / 360) / this.camera.zoom, 7), e.scale.set(1, 1, 1).multiplyScalar(p * this.size / 4), e.tag === "helper") {
|
|
413
|
+
e.visible = !1, e.name === "AXIS" ? (e.visible = !!this.axis, this.axis === "X" && (d.setFromEuler(N.set(0, 0, 0)), e.quaternion.copy(n).multiply(d), Math.abs(h.copy(L).applyQuaternion(n).dot(this.eye)) > 0.9 && (e.visible = !1)), this.axis === "Y" && (d.setFromEuler(N.set(0, 0, Math.PI / 2)), e.quaternion.copy(n).multiply(d), Math.abs(h.copy(X).applyQuaternion(n).dot(this.eye)) > 0.9 && (e.visible = !1)), this.axis === "Z" && (d.setFromEuler(N.set(0, Math.PI / 2, 0)), e.quaternion.copy(n).multiply(d), Math.abs(h.copy(G).applyQuaternion(n).dot(this.eye)) > 0.9 && (e.visible = !1)), this.axis === "XYZE" && (d.setFromEuler(N.set(0, Math.PI / 2, 0)), h.copy(this.rotationAxis), e.quaternion.setFromRotationMatrix(gt.lookAt(wt, h, X)), e.quaternion.multiply(d), e.visible = this.dragging), this.axis === "E" && (e.visible = !1)) : e.name === "START" ? (e.position.copy(this.worldPositionStart), e.visible = this.dragging) : e.name === "END" ? (e.position.copy(this.worldPosition), e.visible = this.dragging) : e.name === "DELTA" ? (e.position.copy(this.worldPositionStart), e.quaternion.copy(this.worldQuaternionStart), u.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1), u.applyQuaternion(this.worldQuaternionStart.clone().invert()), e.scale.copy(u), e.visible = this.dragging) : (e.quaternion.copy(n), this.dragging ? e.position.copy(this.worldPositionStart) : e.position.copy(this.worldPosition), this.axis && (e.visible = this.axis.search(e.name) !== -1));
|
|
414
|
+
continue;
|
|
415
|
+
}
|
|
416
|
+
e.quaternion.copy(n), this.mode === "translate" || this.mode === "scale" ? (e.name === "X" && Math.abs(h.copy(L).applyQuaternion(n).dot(this.eye)) > 0.99 && (e.scale.set(1e-10, 1e-10, 1e-10), e.visible = !1), e.name === "Y" && Math.abs(h.copy(X).applyQuaternion(n).dot(this.eye)) > 0.99 && (e.scale.set(1e-10, 1e-10, 1e-10), e.visible = !1), e.name === "Z" && Math.abs(h.copy(G).applyQuaternion(n).dot(this.eye)) > 0.99 && (e.scale.set(1e-10, 1e-10, 1e-10), e.visible = !1), e.name === "XY" && Math.abs(h.copy(G).applyQuaternion(n).dot(this.eye)) < 0.2 && (e.scale.set(1e-10, 1e-10, 1e-10), e.visible = !1), e.name === "YZ" && Math.abs(h.copy(L).applyQuaternion(n).dot(this.eye)) < 0.2 && (e.scale.set(1e-10, 1e-10, 1e-10), e.visible = !1), e.name === "XZ" && Math.abs(h.copy(X).applyQuaternion(n).dot(this.eye)) < 0.2 && (e.scale.set(1e-10, 1e-10, 1e-10), e.visible = !1)) : this.mode === "rotate" && (K.copy(n), h.copy(this.eye).applyQuaternion(d.copy(n).invert()), e.name.search("E") !== -1 && e.quaternion.setFromRotationMatrix(gt.lookAt(this.eye, wt, X)), e.name === "X" && (d.setFromAxisAngle(L, Math.atan2(-h.y, h.z)), d.multiplyQuaternions(K, d), e.quaternion.copy(d)), e.name === "Y" && (d.setFromAxisAngle(X, Math.atan2(h.x, h.z)), d.multiplyQuaternions(K, d), e.quaternion.copy(d)), e.name === "Z" && (d.setFromAxisAngle(G, Math.atan2(h.y, h.x)), d.multiplyQuaternions(K, d), e.quaternion.copy(d))), e.visible = e.visible && (e.name.indexOf("X") === -1 || this.showX), e.visible = e.visible && (e.name.indexOf("Y") === -1 || this.showY), e.visible = e.visible && (e.name.indexOf("Z") === -1 || this.showZ), e.visible = e.visible && (e.name.indexOf("E") === -1 || this.showX && this.showY && this.showZ), e.material._color = e.material._color || e.material.color.clone(), e.material._opacity = e.material._opacity || e.material.opacity, e.material.color.copy(e.material._color), e.material.opacity = e.material._opacity, this.enabled && this.axis && (e.name === this.axis || this.axis.split("").some(function(g) {
|
|
417
|
+
return e.name === g;
|
|
418
|
+
})) && (e.material.color.setHex(16776960), e.material.opacity = 1);
|
|
419
|
+
}
|
|
420
|
+
super.updateMatrixWorld(i);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
class Vt extends o {
|
|
424
|
+
constructor() {
|
|
425
|
+
super(
|
|
426
|
+
new Ht(1e5, 1e5, 2, 2),
|
|
427
|
+
new St({ visible: !1, wireframe: !0, side: Ot, transparent: !0, opacity: 0.1, toneMapped: !1 })
|
|
428
|
+
), this.isTransformControlsPlane = !0, this.type = "TransformControlsPlane";
|
|
429
|
+
}
|
|
430
|
+
updateMatrixWorld(i) {
|
|
431
|
+
let t = this.space;
|
|
432
|
+
switch (this.position.copy(this.worldPosition), this.mode === "scale" && (t = "local"), J.copy(L).applyQuaternion(t === "local" ? this.worldQuaternion : $), R.copy(X).applyQuaternion(t === "local" ? this.worldQuaternion : $), k.copy(G).applyQuaternion(t === "local" ? this.worldQuaternion : $), h.copy(R), this.mode) {
|
|
433
|
+
case "translate":
|
|
434
|
+
case "scale":
|
|
435
|
+
switch (this.axis) {
|
|
436
|
+
case "X":
|
|
437
|
+
h.copy(this.eye).cross(J), P.copy(J).cross(h);
|
|
438
|
+
break;
|
|
439
|
+
case "Y":
|
|
440
|
+
h.copy(this.eye).cross(R), P.copy(R).cross(h);
|
|
441
|
+
break;
|
|
442
|
+
case "Z":
|
|
443
|
+
h.copy(this.eye).cross(k), P.copy(k).cross(h);
|
|
444
|
+
break;
|
|
445
|
+
case "XY":
|
|
446
|
+
P.copy(k);
|
|
447
|
+
break;
|
|
448
|
+
case "YZ":
|
|
449
|
+
P.copy(J);
|
|
450
|
+
break;
|
|
451
|
+
case "XZ":
|
|
452
|
+
h.copy(k), P.copy(R);
|
|
453
|
+
break;
|
|
454
|
+
case "XYZ":
|
|
455
|
+
case "E":
|
|
456
|
+
P.set(0, 0, 0);
|
|
457
|
+
break;
|
|
458
|
+
}
|
|
459
|
+
break;
|
|
460
|
+
case "rotate":
|
|
461
|
+
default:
|
|
462
|
+
P.set(0, 0, 0);
|
|
463
|
+
}
|
|
464
|
+
P.length() === 0 ? this.quaternion.copy(this.cameraQuaternion) : (yt.lookAt(u.set(0, 0, 0), P, h), this.quaternion.setFromRotationMatrix(yt)), super.updateMatrixWorld(i);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
class Bt {
|
|
468
|
+
constructor(i, t) {
|
|
469
|
+
c(this, "POINTER_DRAG_THRESHOLD", 1e-3);
|
|
470
|
+
c(this, "name");
|
|
471
|
+
c(this, "_canvas");
|
|
472
|
+
c(this, "_scene");
|
|
473
|
+
c(this, "_controller");
|
|
474
|
+
// general pointer members
|
|
475
|
+
c(this, "_pointer");
|
|
476
|
+
c(this, "_pointerPrimaryDown");
|
|
477
|
+
c(this, "_pointerMiddleDown");
|
|
478
|
+
c(this, "_pointerSecondaryDown");
|
|
479
|
+
c(this, "_lastPointerDown");
|
|
480
|
+
c(this, "_lastPointerUp");
|
|
481
|
+
// raycast members
|
|
482
|
+
c(this, "_raycaster");
|
|
483
|
+
c(this, "_intersects");
|
|
484
|
+
// hovering members
|
|
485
|
+
c(this, "_hovered");
|
|
486
|
+
// dragging members
|
|
487
|
+
c(this, "_dragging");
|
|
488
|
+
c(this, "_dragStart");
|
|
489
|
+
c(this, "_dragCurrent");
|
|
490
|
+
c(this, "_dragEnd");
|
|
491
|
+
c(this, "_dragDelta");
|
|
492
|
+
c(this, "_draggable");
|
|
493
|
+
c(this, "_dragRaycastOnObjects");
|
|
494
|
+
this.name = "BaseTool", this._canvas = t.domElement, this._scene = i, this._controller = t, this._pointer = new tt(), this._pointerPrimaryDown = !1, this._pointerMiddleDown = !1, this._pointerSecondaryDown = !1, this._lastPointerDown = new tt(), this._lastPointerUp = new tt(), this._raycaster = new bt(), this._raycaster.layers.mask = Ct | Rt, this._intersects = [], this._hovered = null, this._dragging = !1, this._dragStart = new a(), this._dragCurrent = new a(), this._dragEnd = new a(), this._dragDelta = new a(), this._draggable = null, this._dragRaycastOnObjects = null;
|
|
495
|
+
}
|
|
496
|
+
get _pointerAnyDown() {
|
|
497
|
+
return this._pointerPrimaryDown || this._pointerMiddleDown || this._pointerSecondaryDown;
|
|
498
|
+
}
|
|
499
|
+
Activate() {
|
|
500
|
+
}
|
|
501
|
+
Deactivate() {
|
|
502
|
+
}
|
|
503
|
+
onPointerDown(i) {
|
|
504
|
+
var t;
|
|
505
|
+
switch (i.button) {
|
|
506
|
+
case 0: {
|
|
507
|
+
this._pointerPrimaryDown = !0;
|
|
508
|
+
break;
|
|
509
|
+
}
|
|
510
|
+
case 1: {
|
|
511
|
+
this._pointerMiddleDown = !0;
|
|
512
|
+
break;
|
|
513
|
+
}
|
|
514
|
+
case 2: {
|
|
515
|
+
this._pointerSecondaryDown = !0;
|
|
516
|
+
break;
|
|
517
|
+
}
|
|
518
|
+
default:
|
|
519
|
+
console.warn(
|
|
520
|
+
"DIVEBaseTool.onPointerDown: Unknown button: " + i.button
|
|
521
|
+
);
|
|
522
|
+
}
|
|
523
|
+
this._lastPointerDown.copy(this._pointer), this._draggable = ot(
|
|
524
|
+
(t = this._intersects[0]) == null ? void 0 : t.object,
|
|
525
|
+
"isDraggable"
|
|
526
|
+
) || null;
|
|
527
|
+
}
|
|
528
|
+
onDragStart(i) {
|
|
529
|
+
this._draggable && (this._dragRaycastOnObjects !== null && (this._intersects = this._raycaster.intersectObjects(
|
|
530
|
+
this._dragRaycastOnObjects,
|
|
531
|
+
!0
|
|
532
|
+
)), this._intersects.length !== 0 && (this._dragStart.copy(this._intersects[0].point.clone()), this._dragCurrent.copy(this._intersects[0].point.clone()), this._dragEnd.copy(this._dragStart.clone()), this._dragDelta.set(0, 0, 0), this._draggable && this._draggable.onDragStart && (this._draggable.onDragStart({
|
|
533
|
+
dragStart: this._dragStart,
|
|
534
|
+
dragCurrent: this._dragCurrent,
|
|
535
|
+
dragEnd: this._dragEnd,
|
|
536
|
+
dragDelta: this._dragDelta
|
|
537
|
+
}), this._dragging = !0, this._controller.enabled = !1)));
|
|
538
|
+
}
|
|
539
|
+
onPointerMove(i) {
|
|
540
|
+
var n;
|
|
541
|
+
this._pointer.x = i.offsetX / this._canvas.clientWidth * 2 - 1, this._pointer.y = -(i.offsetY / this._canvas.clientHeight) * 2 + 1, this._raycaster.setFromCamera(this._pointer, this._controller.object), this._intersects = this.raycast(this._scene.children);
|
|
542
|
+
const t = ot(
|
|
543
|
+
(n = this._intersects[0]) == null ? void 0 : n.object,
|
|
544
|
+
"isHoverable"
|
|
545
|
+
);
|
|
546
|
+
if (this._intersects[0] && t) {
|
|
547
|
+
if (!this._hovered) {
|
|
548
|
+
t.onPointerEnter && t.onPointerEnter(this._intersects[0]), this._hovered = t;
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
if (this._hovered.uuid !== t.uuid) {
|
|
552
|
+
this._hovered.onPointerLeave && this._hovered.onPointerLeave(), t.onPointerEnter && t.onPointerEnter(this._intersects[0]), this._hovered = t;
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
t.onPointerOver && t.onPointerOver(this._intersects[0]), this._hovered = t;
|
|
556
|
+
} else
|
|
557
|
+
this._hovered && this._hovered.onPointerLeave && this._hovered.onPointerLeave(), this._hovered = null;
|
|
558
|
+
this._pointerAnyDown && (this._dragging || this.onDragStart(i), this.onDrag(i));
|
|
559
|
+
}
|
|
560
|
+
onDrag(i) {
|
|
561
|
+
this._dragRaycastOnObjects !== null && (this._intersects = this._raycaster.intersectObjects(
|
|
562
|
+
this._dragRaycastOnObjects,
|
|
563
|
+
!0
|
|
564
|
+
));
|
|
565
|
+
const t = this._intersects[0];
|
|
566
|
+
t && (this._dragCurrent.copy(t.point.clone()), this._dragEnd.copy(t.point.clone()), this._dragDelta.subVectors(
|
|
567
|
+
this._dragCurrent.clone(),
|
|
568
|
+
this._dragStart.clone()
|
|
569
|
+
), this._draggable && this._draggable.onDrag && this._draggable.onDrag({
|
|
570
|
+
dragStart: this._dragStart,
|
|
571
|
+
dragCurrent: this._dragCurrent,
|
|
572
|
+
dragEnd: this._dragEnd,
|
|
573
|
+
dragDelta: this._dragDelta
|
|
574
|
+
}));
|
|
575
|
+
}
|
|
576
|
+
onPointerUp(i) {
|
|
577
|
+
switch (this.pointerWasDragged() || this._dragging ? this._draggable && this.onDragEnd(i) : this.onClick(i), i.button) {
|
|
578
|
+
case 0:
|
|
579
|
+
this._pointerPrimaryDown = !1;
|
|
580
|
+
break;
|
|
581
|
+
case 1:
|
|
582
|
+
this._pointerMiddleDown = !1;
|
|
583
|
+
break;
|
|
584
|
+
case 2:
|
|
585
|
+
this._pointerSecondaryDown = !1;
|
|
586
|
+
break;
|
|
587
|
+
}
|
|
588
|
+
this._lastPointerUp.copy(this._pointer);
|
|
589
|
+
}
|
|
590
|
+
onClick(i) {
|
|
591
|
+
}
|
|
592
|
+
onDragEnd(i) {
|
|
593
|
+
const t = this._intersects[0];
|
|
594
|
+
t && (this._dragEnd.copy(t.point.clone()), this._dragCurrent.copy(t.point.clone()), this._dragDelta.subVectors(
|
|
595
|
+
this._dragCurrent.clone(),
|
|
596
|
+
this._dragStart.clone()
|
|
597
|
+
)), this._draggable && this._draggable.onDragEnd && this._draggable.onDragEnd({
|
|
598
|
+
dragStart: this._dragStart,
|
|
599
|
+
dragCurrent: this._dragCurrent,
|
|
600
|
+
dragEnd: this._dragEnd,
|
|
601
|
+
dragDelta: this._dragDelta
|
|
602
|
+
}), this._draggable = null, this._dragging = !1, this._dragStart.set(0, 0, 0), this._dragCurrent.set(0, 0, 0), this._dragEnd.set(0, 0, 0), this._dragDelta.set(0, 0, 0), this._controller.enabled = !0;
|
|
603
|
+
}
|
|
604
|
+
onWheel(i) {
|
|
605
|
+
}
|
|
606
|
+
raycast(i) {
|
|
607
|
+
return i !== void 0 ? this._raycaster.intersectObjects(i, !0).filter((t) => t.object.visible) : this._raycaster.intersectObjects(this._scene.children, !0).filter((t) => t.object.visible);
|
|
608
|
+
}
|
|
609
|
+
pointerWasDragged() {
|
|
610
|
+
return this._lastPointerDown.distanceTo(this._pointer) > this.POINTER_DRAG_THRESHOLD;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
class Nt extends Bt {
|
|
614
|
+
constructor(t, n) {
|
|
615
|
+
super(t, n);
|
|
616
|
+
c(this, "isTransformTool", !0);
|
|
617
|
+
c(this, "_scaleLinked");
|
|
618
|
+
c(this, "_gizmo");
|
|
619
|
+
this.name = "DIVETransformTool", this._scaleLinked = !1, this._gizmo = this.initGizmo(), this._scene.add(this._gizmo);
|
|
620
|
+
}
|
|
621
|
+
Activate() {
|
|
622
|
+
}
|
|
623
|
+
SetGizmoMode(t) {
|
|
624
|
+
this._gizmo.mode = t;
|
|
625
|
+
}
|
|
626
|
+
SetGizmoVisibility(t) {
|
|
627
|
+
const n = this._scene.children.includes(this._gizmo);
|
|
628
|
+
t && !n ? (this._scene.add(this._gizmo), "isTransformControls" in this._gizmo && this._gizmo.getRaycaster().layers.enableAll()) : !t && n && (this._scene.remove(this._gizmo), "isTransformControls" in this._gizmo && this._gizmo.getRaycaster().layers.disableAll());
|
|
629
|
+
}
|
|
630
|
+
SetGizmoScaleLinked(t) {
|
|
631
|
+
this._scaleLinked = t;
|
|
632
|
+
}
|
|
633
|
+
// only used for optimizing pointer events with DIVEGizmo
|
|
634
|
+
// public onPointerDown(e: PointerEvent): void {
|
|
635
|
+
// super.onPointerDown(e);
|
|
636
|
+
// if (this._hovered) {
|
|
637
|
+
// this._dragRaycastOnObjects = (
|
|
638
|
+
// this._gizmo as DIVEGizmo
|
|
639
|
+
// ).gizmoPlane?.children;
|
|
640
|
+
// }
|
|
641
|
+
// }
|
|
642
|
+
// only used for optimizing pointer events with DIVEGizmo
|
|
643
|
+
// protected raycast(): Intersection[] {
|
|
644
|
+
// return super.raycast((this._gizmo as DIVEGizmo).gizmoNode.children);
|
|
645
|
+
// }
|
|
646
|
+
initGizmo() {
|
|
647
|
+
const t = new kt(
|
|
648
|
+
// this._controller,
|
|
649
|
+
this._controller.object,
|
|
650
|
+
this._controller.domElement
|
|
651
|
+
);
|
|
652
|
+
return t.mode = "translate", t.traverse((n) => {
|
|
653
|
+
if (!("isMesh" in n)) return;
|
|
654
|
+
const s = n.material;
|
|
655
|
+
n.name === "X" && s.color.set(ct), n.name === "Y" && s.color.set(dt), n.name === "Z" && s.color.set(pt), n.name === "XY" && s.color.set(pt), n.name === "YZ" && s.color.set(ct), n.name === "XZ" && s.color.set(dt);
|
|
656
|
+
}), t.addEventListener("mouseDown", () => {
|
|
657
|
+
this._controller.enabled = !1, et(t.object, "isMovable") && t.object.onMoveStart && t.object.onMoveStart();
|
|
658
|
+
}), t.addEventListener("objectChange", () => {
|
|
659
|
+
if (et(t.object, "isMovable") && t.object.onMove && (t.object.onMove(), this._scaleLinked)) {
|
|
660
|
+
const n = t.object.scale, s = (n.x + n.y + n.z) / 3;
|
|
661
|
+
t.object.scale.set(s, s, s);
|
|
662
|
+
}
|
|
663
|
+
}), t.addEventListener("mouseUp", () => {
|
|
664
|
+
this._controller.enabled = !0, et(t.object, "isMovable") && t.object.onMoveEnd && t.object.onMoveEnd();
|
|
665
|
+
}), t;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
const ee = (r) => r.isSelectTool !== void 0;
|
|
669
|
+
class ie extends Nt {
|
|
670
|
+
constructor(t, n) {
|
|
671
|
+
super(t, n);
|
|
672
|
+
c(this, "isSelectTool", !0);
|
|
673
|
+
this.name = "SelectTool";
|
|
674
|
+
}
|
|
675
|
+
Activate() {
|
|
676
|
+
}
|
|
677
|
+
Select(t) {
|
|
678
|
+
this.AttachGizmo(t), t.onSelect && t.onSelect();
|
|
679
|
+
}
|
|
680
|
+
Deselect(t) {
|
|
681
|
+
this.DetachGizmo(), t.onDeselect && t.onDeselect();
|
|
682
|
+
}
|
|
683
|
+
AttachGizmo(t) {
|
|
684
|
+
if ("isMovable" in t) {
|
|
685
|
+
const n = t;
|
|
686
|
+
this._gizmo.attach(n), this.SetGizmoVisibility(n.visible);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
DetachGizmo() {
|
|
690
|
+
this._gizmo.detach();
|
|
691
|
+
}
|
|
692
|
+
onClick(t) {
|
|
693
|
+
super.onClick(t);
|
|
694
|
+
const n = this._raycaster.intersectObjects(this._scene.Root.children, !0).filter((l) => l.object.visible)[0], s = ot(
|
|
695
|
+
n == null ? void 0 : n.object,
|
|
696
|
+
"isSelectable"
|
|
697
|
+
);
|
|
698
|
+
if (!n || !s) {
|
|
699
|
+
this._gizmo.object && this.Deselect(this._gizmo.object);
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
if (this._gizmo.object) {
|
|
703
|
+
if (this._gizmo.object.uuid === s.uuid) return;
|
|
704
|
+
this.Deselect(this._gizmo.object);
|
|
705
|
+
}
|
|
706
|
+
this.Select(s);
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
export {
|
|
710
|
+
ie as D,
|
|
711
|
+
ee as i
|
|
712
|
+
};
|