@shopware-ag/dive 3.1.0 → 4.0.1

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.
Files changed (196) hide show
  1. package/README.md +31 -5
  2. package/build/chunks/{AssetCache-xpY_N7Yp.cjs → AssetCache-CUVFS7wk.cjs} +1 -1
  3. package/build/chunks/{AssetCache-C3YXhbaX.mjs → AssetCache-DnAAa719.mjs} +1 -1
  4. package/build/chunks/AssetExporter-CD2iuQce.mjs +108 -0
  5. package/build/chunks/AssetExporter-CoL-QXkB.cjs +1 -0
  6. package/build/chunks/{AssetLoader-MfH5d_Rr.mjs → AssetLoader-Bkp3fWZz.mjs} +9 -9
  7. package/build/chunks/{AssetLoader-CRxLq0AL.cjs → AssetLoader-DnVvCd41.cjs} +2 -2
  8. package/build/chunks/FileTypes-B-MjfMGd.cjs +29 -0
  9. package/build/chunks/FileTypes-D3Dxr2dj.mjs +2294 -0
  10. package/build/chunks/ModelComponent-Cmu0EX0r.cjs +1 -0
  11. package/build/chunks/ModelComponent-WA0kLOEY.mjs +87 -0
  12. package/build/chunks/OrbitController-CAJIiZeE.cjs +1 -0
  13. package/build/chunks/OrbitController-DxCbrQVB.mjs +612 -0
  14. package/build/chunks/SpriteTextComponent-BpoKLOjA.cjs +1 -0
  15. package/build/chunks/SpriteTextComponent-DIZFqao0.mjs +83 -0
  16. package/build/chunks/collectAnimations-BgYCN1le.mjs +35 -0
  17. package/build/chunks/collectAnimations-C3HfZHte.cjs +1 -0
  18. package/build/chunks/contributesToBounds-C1mva__U.cjs +1 -0
  19. package/build/chunks/contributesToBounds-DYmHYES4.mjs +14 -0
  20. package/build/chunks/detachTransformControls-B4iRF1bw.mjs +209 -0
  21. package/build/chunks/detachTransformControls-CZ2cd5hx.cjs +1 -0
  22. package/build/chunks/{isFileTypeSupported-BBU39V4u.cjs → isFileExtensionSupported-B1q2eWs7.cjs} +1 -1
  23. package/build/chunks/{isFileTypeSupported-9h8lrIuG.mjs → isFileExtensionSupported-BqOqU3-h.mjs} +1 -1
  24. package/build/chunks/isVisibleInHierarchy-D9JcLqR5.cjs +1 -0
  25. package/build/chunks/isVisibleInHierarchy-KzVGvDEw.mjs +21 -0
  26. package/build/components/boundingbox/BoundingBoxComponent.d.ts +100 -0
  27. package/build/components/boundingbox/index.d.ts +1 -0
  28. package/build/components/camera/CameraComponent.d.ts +75 -0
  29. package/build/components/camera/index.d.ts +2 -0
  30. package/build/components/camera/perspective/PerspectiveCameraComponent.d.ts +39 -0
  31. package/build/components/grid/GridComponent.d.ts +50 -0
  32. package/build/components/index.d.ts +6 -10
  33. package/build/components/light/LightComponent.d.ts +65 -0
  34. package/build/components/light/ambient/AmbientLightComponent.d.ts +10 -0
  35. package/build/components/light/directional/DirectionalLightComponent.d.ts +23 -0
  36. package/build/components/light/hemi/HemisphereLightComponent.d.ts +21 -0
  37. package/build/components/light/index.d.ts +5 -3
  38. package/build/components/light/point/PointLightComponent.d.ts +26 -0
  39. package/build/components/line/MultiLineComponent.d.ts +133 -0
  40. package/build/components/line/index.d.ts +1 -0
  41. package/build/components/mesh/MeshComponent.d.ts +74 -0
  42. package/build/components/mesh/floor/FloorComponent.d.ts +36 -0
  43. package/build/components/mesh/index.d.ts +4 -0
  44. package/build/components/mesh/model/ModelComponent.d.ts +67 -0
  45. package/build/components/mesh/primitive/PrimitiveComponent.d.ts +43 -0
  46. package/build/components/spritetext/SpriteTextComponent.d.ts +58 -0
  47. package/build/constants/VisibilityLayerMask.d.ts +23 -0
  48. package/build/dive.cjs +1 -1
  49. package/build/dive.mjs +252 -773
  50. package/build/engine/Dive.d.ts +11 -13
  51. package/build/engine/boundingbox/BoundingBox.d.ts +76 -0
  52. package/build/engine/component/Component.d.ts +236 -0
  53. package/build/engine/environment/Environment.d.ts +0 -18
  54. package/build/engine/index.d.ts +4 -1
  55. package/build/engine/node/Node.d.ts +189 -0
  56. package/build/engine/promise/abortable/AbortablePromise.d.ts +8 -0
  57. package/build/engine/renderer/Renderer.d.ts +43 -7
  58. package/build/engine/scene/Scene.d.ts +88 -4
  59. package/build/engine/scene/root/Root.d.ts +29 -0
  60. package/build/engine/scene/xrroot/XRRoot.d.ts +1 -1
  61. package/build/engine/view/View.d.ts +15 -4
  62. package/build/helpers/collectAnimations/collectAnimations.d.ts +23 -0
  63. package/build/helpers/computeProductBounds/computeProductBounds.d.ts +18 -0
  64. package/build/helpers/contributesToBounds/contributesToBounds.d.ts +17 -0
  65. package/build/helpers/detachTransformControls/detachTransformControls.d.ts +15 -0
  66. package/build/helpers/disposeComponents/disposeComponents.d.ts +20 -0
  67. package/build/helpers/findSceneRecursive/findSceneRecursive.d.ts +7 -3
  68. package/build/helpers/implementsInterface/implementsInterface.d.ts +11 -0
  69. package/build/helpers/index.d.ts +6 -1
  70. package/build/helpers/isVisibleInHierarchy/isVisibleInHierarchy.d.ts +12 -0
  71. package/build/index.d.ts +0 -1
  72. package/build/plugins/animation/index.mjs +3 -2
  73. package/build/plugins/animation/src/system/AnimationSystem.d.ts +3 -2
  74. package/build/plugins/ar/index.cjs +1 -1
  75. package/build/plugins/ar/index.mjs +2 -2
  76. package/build/plugins/ar/src/webxr/WebXR.d.ts +7 -0
  77. package/build/plugins/assetcache/index.cjs +1 -1
  78. package/build/plugins/assetcache/index.mjs +1 -1
  79. package/build/plugins/assetexporter/index.cjs +1 -1
  80. package/build/plugins/assetexporter/index.mjs +1 -1
  81. package/build/plugins/assetexporter/src/AssetExporter.d.ts +12 -0
  82. package/build/plugins/assetloader/index.cjs +1 -1
  83. package/build/plugins/assetloader/index.mjs +2 -2
  84. package/build/plugins/mediacreator/index.cjs +1 -1
  85. package/build/plugins/mediacreator/index.mjs +32 -30
  86. package/build/plugins/mediacreator/src/MediaCreator.d.ts +1 -2
  87. package/build/plugins/orbitcontroller/index.cjs +1 -1
  88. package/build/plugins/orbitcontroller/index.d.ts +1 -0
  89. package/build/plugins/orbitcontroller/index.mjs +1 -1
  90. package/build/plugins/orbitcontroller/src/OrbitController.d.ts +39 -6
  91. package/build/plugins/orientationdisplay/index.cjs +1 -1
  92. package/build/plugins/orientationdisplay/index.mjs +39 -31
  93. package/build/plugins/orientationdisplay/src/OrientationDisplay.d.ts +3 -3
  94. package/build/plugins/quickview/index.cjs +1 -1
  95. package/build/plugins/quickview/index.mjs +68 -45
  96. package/build/plugins/quickview/src/QuickView.d.ts +40 -13
  97. package/build/plugins/quickview/types/index.d.ts +0 -18
  98. package/build/plugins/state/index.cjs +1 -27
  99. package/build/plugins/state/index.mjs +1983 -4262
  100. package/build/plugins/state/src/EngineGateway.d.ts +98 -0
  101. package/build/plugins/state/src/EntityRegistry.d.ts +51 -0
  102. package/build/plugins/state/src/State.d.ts +20 -9
  103. package/build/plugins/state/src/actions/camera/computeencompassingview.d.ts +1 -1
  104. package/build/plugins/state/src/actions/camera/movecamera.d.ts +2 -2
  105. package/build/plugins/state/src/actions/media/generatemedia.d.ts +1 -1
  106. package/build/plugins/state/src/actions/object/addobject.d.ts +2 -3
  107. package/build/plugins/state/src/actions/object/deleteobject.d.ts +3 -4
  108. package/build/plugins/state/src/actions/object/deselectobject.d.ts +3 -4
  109. package/build/plugins/state/src/actions/object/dropit.d.ts +2 -2
  110. package/build/plugins/state/src/actions/object/getallobjects.d.ts +2 -3
  111. package/build/plugins/state/src/actions/object/getobjects.d.ts +3 -4
  112. package/build/plugins/state/src/actions/object/index.d.ts +0 -1
  113. package/build/plugins/state/src/actions/object/modelloaded.d.ts +2 -2
  114. package/build/plugins/state/src/actions/object/selectobject.d.ts +3 -4
  115. package/build/plugins/state/src/actions/object/setparent.d.ts +3 -4
  116. package/build/plugins/state/src/actions/object/updateobject.d.ts +3 -4
  117. package/build/plugins/state/src/actions/renderer/startrender.d.ts +1 -1
  118. package/build/plugins/state/src/actions/scene/exportscene.d.ts +2 -2
  119. package/build/plugins/state/src/actions/scene/index.d.ts +0 -1
  120. package/build/plugins/state/src/actions/scene/setbackground.d.ts +2 -2
  121. package/build/plugins/state/src/actions/scene/updatescene.d.ts +2 -2
  122. package/build/plugins/state/src/actions/state/getstate.d.ts +1 -1
  123. package/build/plugins/state/src/actions/state/setstate.d.ts +1 -1
  124. package/build/plugins/state/src/helpers/copyVectors/copyVectors.d.ts +17 -0
  125. package/build/plugins/state/src/helpers/updateParentLink/updateParentLink.d.ts +29 -0
  126. package/build/plugins/state/src/helpers/watchEntity/watchEntity.d.ts +30 -0
  127. package/build/plugins/state/types/ActionTypes.d.ts +18 -3
  128. package/build/plugins/state/types/RegisteredEntity.d.ts +27 -0
  129. package/build/plugins/state/types/StateData.d.ts +1 -1
  130. package/build/plugins/state/types/index.d.ts +2 -1
  131. package/build/{types → plugins/state/types}/schema/GroupSchema.d.ts +1 -1
  132. package/build/{types → plugins/state/types}/schema/ModelSchema.d.ts +7 -4
  133. package/build/{types → plugins/state/types}/schema/PrimitiveSchema.d.ts +4 -5
  134. package/build/{types → plugins/state/types}/schema/index.d.ts +0 -3
  135. package/build/plugins/toolbox/index.cjs +1 -1
  136. package/build/plugins/toolbox/index.mjs +193 -140
  137. package/build/plugins/toolbox/src/PointerContext.d.ts +7 -0
  138. package/build/plugins/toolbox/src/SelectionState.d.ts +21 -0
  139. package/build/plugins/toolbox/src/Toolbox.d.ts +9 -2
  140. package/build/{components → plugins/toolbox/src}/gizmo/Gizmo.d.ts +16 -2
  141. package/build/{components → plugins/toolbox/src}/gizmo/handles/AxisHandle.d.ts +2 -3
  142. package/build/{components → plugins/toolbox/src}/gizmo/handles/RadialHandle.d.ts +2 -3
  143. package/build/{components → plugins/toolbox/src}/gizmo/handles/ScaleHandle.d.ts +2 -3
  144. package/build/{components → plugins/toolbox/src}/gizmo/rotate/RotateGizmo.d.ts +2 -2
  145. package/build/{components → plugins/toolbox/src}/gizmo/scale/ScaleGizmo.d.ts +3 -3
  146. package/build/{components → plugins/toolbox/src}/gizmo/translate/TranslateGizmo.d.ts +2 -2
  147. package/build/types/components/DIVESceneObject.d.ts +13 -6
  148. package/build/types/components/index.d.ts +0 -1
  149. package/build/types/events/DIVEComponentEventMap.d.ts +14 -0
  150. package/build/types/events/DIVEEntityEventMap.d.ts +47 -0
  151. package/build/types/events/index.d.ts +2 -0
  152. package/build/types/{schema/GeometrySchema.d.ts → geometry/DIVEGeometry.d.ts} +4 -4
  153. package/build/types/{schema/GeometryTypeSchema.d.ts → geometry/DIVEGeometryType.d.ts} +1 -1
  154. package/build/types/geometry/index.d.ts +2 -0
  155. package/build/types/index.d.ts +3 -1
  156. package/build/types/{schema/MaterialSchema.d.ts → material/DIVEMaterial.d.ts} +1 -1
  157. package/build/types/material/index.d.ts +1 -0
  158. package/package.json +6 -5
  159. package/build/chunks/AssetExporter-C5MScs9S.mjs +0 -70
  160. package/build/chunks/AssetExporter-Cdxb04b3.cjs +0 -1
  161. package/build/chunks/CameraSchema-cgY5WBGW.mjs +0 -10
  162. package/build/chunks/CameraSchema-twxH-72N.cjs +0 -1
  163. package/build/chunks/FileTypes-Cgyf8ocm.cjs +0 -29
  164. package/build/chunks/FileTypes-DiYB3WBp.mjs +0 -2166
  165. package/build/chunks/PerspectiveCamera-B5TvUzTa.mjs +0 -39
  166. package/build/chunks/PerspectiveCamera-DwQUmkDv.cjs +0 -1
  167. package/build/chunks/SpriteText-2lCRglsw.cjs +0 -1
  168. package/build/chunks/SpriteText-C_CQPvUn.mjs +0 -50
  169. package/build/chunks/findInterface-C6mrvf_t.cjs +0 -1
  170. package/build/chunks/findInterface-DbJ5qzbc.mjs +0 -11
  171. package/build/components/boundingbox/BoundingBox.d.ts +0 -140
  172. package/build/components/floor/Floor.d.ts +0 -14
  173. package/build/components/grid/Grid.d.ts +0 -23
  174. package/build/components/group/Group.d.ts +0 -28
  175. package/build/components/light/AmbientLight.d.ts +0 -19
  176. package/build/components/light/PointLight.d.ts +0 -29
  177. package/build/components/light/SceneLight.d.ts +0 -20
  178. package/build/components/model/Model.d.ts +0 -26
  179. package/build/components/node/Node.d.ts +0 -24
  180. package/build/components/primitive/Primitive.d.ts +0 -27
  181. package/build/components/root/Root.d.ts +0 -34
  182. package/build/components/spritetext/SpriteText.d.ts +0 -27
  183. package/build/engine/camera/PerspectiveCamera.d.ts +0 -24
  184. package/build/helpers/isFileTypeSupported/isFileTypeSupported.d.ts +0 -9
  185. package/build/plugins/quickview/src/state/QuickViewState.d.ts +0 -4
  186. package/build/plugins/quickview/src/uri/QuickViewUri.d.ts +0 -3
  187. package/build/plugins/state/src/actions/object/placeonfloor.d.ts +0 -12
  188. package/build/plugins/state/src/actions/scene/getallscenedata.d.ts +0 -12
  189. package/build/plugins/state/types/StateSceneData.d.ts +0 -5
  190. package/build/types/components/DIVELight.d.ts +0 -4
  191. /package/build/{types → plugins/state/types}/schema/BaseEntitySchema.d.ts +0 -0
  192. /package/build/{types → plugins/state/types}/schema/CameraSchema.d.ts +0 -0
  193. /package/build/{types → plugins/state/types}/schema/EntitySchema.d.ts +0 -0
  194. /package/build/{types → plugins/state/types}/schema/EntityTypeSchema.d.ts +0 -0
  195. /package/build/{types → plugins/state/types}/schema/LightSchema.d.ts +0 -0
  196. /package/build/{components → plugins/toolbox/src}/gizmo/plane/GizmoPlane.d.ts +0 -0
@@ -1,18 +1,18 @@
1
- var S = Object.defineProperty;
2
- var w = (n, t, e) => t in n ? S(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
- var o = (n, t, e) => w(n, typeof t != "symbol" ? t + "" : t, e);
4
- import { EventDispatcher as T, Vector3 as l, Raycaster as P, Vector2 as f, Layers as m } from "three/webgpu";
5
- import "../../chunks/FileTypes-DiYB3WBp.mjs";
6
- import { P as _, U as d } from "../../chunks/PerspectiveCamera-B5TvUzTa.mjs";
1
+ var P = Object.defineProperty;
2
+ var w = (a, t, e) => t in a ? P(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
3
+ var r = (a, t, e) => w(a, typeof t != "symbol" ? t + "" : t, e);
4
+ import { EventDispatcher as T, Vector3 as h, Raycaster as S, Vector2 as m } from "three/webgpu";
5
+ import "../../chunks/FileTypes-D3Dxr2dj.mjs";
6
+ import { D as E, P as _, U as f, a as v } from "../../chunks/contributesToBounds-DYmHYES4.mjs";
7
7
  import "three/examples/jsm/loaders/HDRLoader.js";
8
8
  import "three/tsl";
9
- import { f as g, i as h } from "../../chunks/findInterface-DbJ5qzbc.mjs";
10
- import { TransformControls as E } from "three/examples/jsm/controls/TransformControls.js";
9
+ import { f as d, i as l, a as z } from "../../chunks/isVisibleInHierarchy-KzVGvDEw.mjs";
10
+ import { TransformControls as C } from "three/examples/jsm/controls/TransformControls.js";
11
11
  import { A as b, a as D, b as y } from "../../chunks/AxisHelperColors-JLBHYQDi.mjs";
12
- class z {
12
+ class L {
13
13
  constructor() {
14
- o(this, "_selected", null);
15
- o(this, "_listeners", /* @__PURE__ */ new Set());
14
+ r(this, "_selected", null);
15
+ r(this, "_listeners", /* @__PURE__ */ new Set());
16
16
  }
17
17
  /**
18
18
  * Currently selected object, or null if nothing is selected.
@@ -25,16 +25,48 @@ class z {
25
25
  * Calls onSelect on the new object and onDeselect on the previous.
26
26
  */
27
27
  select(t) {
28
- var e, s, i;
29
- this._selected !== t && (this._selected && ((s = (e = this._selected).onDeselect) == null || s.call(e)), this._selected = t, (i = t.onSelect) == null || i.call(t), this.notifyListeners());
28
+ this._select(t, !0);
29
+ }
30
+ /**
31
+ * Selects without having the object announce it.
32
+ *
33
+ * For a caller that announces the selection itself, so a subscriber does not
34
+ * hear about it twice: whoever asked for this already knows it happened.
35
+ *
36
+ * The object that was displaced still gets its `onDeselect` — nobody told
37
+ * *it* anything, and it is the only source for that news. Listeners
38
+ * registered through {@link onChange} are notified either way, or a
39
+ * programmatic selection would not attach the gizmo.
40
+ */
41
+ applySelection(t) {
42
+ this._select(t, !1);
30
43
  }
31
44
  /**
32
45
  * Deselect the currently selected object.
33
46
  * Calls onDeselect on the object.
34
47
  */
35
48
  deselect() {
36
- var t, e;
37
- this._selected && ((e = (t = this._selected).onDeselect) == null || e.call(t), this._selected = null, this.notifyListeners());
49
+ this._deselect(!0);
50
+ }
51
+ /**
52
+ * Deselects without having the object announce it.
53
+ *
54
+ * The counterpart to {@link applySelection}: for a caller that asked for
55
+ * exactly this and announces it itself.
56
+ */
57
+ applyDeselection() {
58
+ this._deselect(!1);
59
+ }
60
+ _select(t, e) {
61
+ var i, o;
62
+ if (this._selected === t) return;
63
+ const s = this._selected;
64
+ this._selected = null, (i = s == null ? void 0 : s.onDeselect) == null || i.call(s), this._selected = t, e && ((o = t.onSelect) == null || o.call(t)), this.notifyListeners();
65
+ }
66
+ _deselect(t) {
67
+ var s;
68
+ const e = this._selected;
69
+ e && (this._selected = null, t && ((s = e.onDeselect) == null || s.call(e)), this.notifyListeners());
38
70
  }
39
71
  /**
40
72
  * Register a callback to be notified when selection changes.
@@ -59,11 +91,11 @@ class z {
59
91
  t(this._selected);
60
92
  }
61
93
  }
62
- class C {
94
+ class A {
63
95
  constructor() {
64
- o(this, "name", "hover");
65
- o(this, "priority", 20);
66
- o(this, "_hovered", null);
96
+ r(this, "name", "hover");
97
+ r(this, "priority", 20);
98
+ r(this, "_hovered", null);
67
99
  }
68
100
  /**
69
101
  * Currently hovered object, or null if nothing is hovered.
@@ -79,8 +111,10 @@ class C {
79
111
  this._hovered && ((e = (t = this._hovered).onPointerLeave) == null || e.call(t), this._hovered = null);
80
112
  }
81
113
  onPointerMove(t) {
82
- var i, r, a, c, u, p, v;
83
- const e = t.modelIntersects[0], s = g(
114
+ var i, o, n, c, g, u, p;
115
+ if (t.pointerPrimaryDown || t.pointerMiddleDown || t.pointerSecondaryDown)
116
+ return;
117
+ const e = t.intersects[0], s = d(
84
118
  e == null ? void 0 : e.object,
85
119
  "isHoverable"
86
120
  );
@@ -90,21 +124,21 @@ class C {
90
124
  return;
91
125
  }
92
126
  if (this._hovered.uuid !== s.uuid) {
93
- (a = (r = this._hovered).onPointerLeave) == null || a.call(r), (c = s.onPointerEnter) == null || c.call(s, e), this._hovered = s;
127
+ (n = (o = this._hovered).onPointerLeave) == null || n.call(o), (c = s.onPointerEnter) == null || c.call(s, e), this._hovered = s;
94
128
  return;
95
129
  }
96
- (u = s.onPointerOver) == null || u.call(s, e);
130
+ (g = s.onPointerOver) == null || g.call(s, e);
97
131
  return;
98
132
  }
99
- this._hovered && ((v = (p = this._hovered).onPointerLeave) == null || v.call(p), this._hovered = null);
133
+ this._hovered && ((p = (u = this._hovered).onPointerLeave) == null || p.call(u), this._hovered = null);
100
134
  }
101
135
  }
102
- const B = (n) => n.name === "select";
136
+ const F = (a) => a.name === "select";
103
137
  class M {
104
138
  constructor(t) {
105
- o(this, "name", "select");
106
- o(this, "priority", 30);
107
- o(this, "_selectionState");
139
+ r(this, "name", "select");
140
+ r(this, "priority", 30);
141
+ r(this, "_selectionState");
108
142
  this._selectionState = t;
109
143
  }
110
144
  /**
@@ -118,7 +152,7 @@ class M {
118
152
  onDeactivate() {
119
153
  }
120
154
  onClick(t) {
121
- const e = t.modelIntersects[0], s = g(
155
+ const e = t.entityIntersects[0], s = d(
122
156
  e == null ? void 0 : e.object,
123
157
  "isSelectable"
124
158
  );
@@ -142,20 +176,20 @@ class M {
142
176
  this._selectionState.deselect();
143
177
  }
144
178
  }
145
- const Y = (n) => n.name === "transform";
146
- class L extends T {
179
+ const K = (a) => a.name === "transform";
180
+ class j extends T {
147
181
  constructor(e, s, i) {
148
182
  super();
149
- o(this, "name", "transform");
150
- o(this, "priority", 5);
151
- o(this, "_scene");
152
- o(this, "_controller");
153
- o(this, "_selectionState");
154
- o(this, "_gizmo");
155
- o(this, "_gizmoHelper");
156
- o(this, "_scaleLinked", !1);
157
- o(this, "_gizmoVisible", !0);
158
- o(this, "_selectionChangeHandler");
183
+ r(this, "name", "transform");
184
+ r(this, "priority", 5);
185
+ r(this, "_scene");
186
+ r(this, "_controller");
187
+ r(this, "_selectionState");
188
+ r(this, "_gizmo");
189
+ r(this, "_gizmoHelper");
190
+ r(this, "_scaleLinked", !1);
191
+ r(this, "_gizmoVisible", !0);
192
+ r(this, "_selectionChangeHandler");
159
193
  this._scene = e, this._controller = s, this._selectionState = i, this._gizmo = this.initGizmo(), this._gizmoHelper = this._gizmo.getHelper(), this._scene.add(this._gizmoHelper), this._selectionChangeHandler = this.onSelectionChange.bind(this);
160
194
  }
161
195
  /**
@@ -179,7 +213,11 @@ class L extends T {
179
213
  this._selectionState.offChange(this._selectionChangeHandler), this._gizmo.detach();
180
214
  }
181
215
  onPointerMove(e) {
182
- if (this._gizmo.dragging || e.uiIntersects.length > 0 && e.uiIntersects.some(
216
+ if (this._gizmo.dragging)
217
+ return !0;
218
+ if (e.pointerPrimaryDown || e.pointerMiddleDown || e.pointerSecondaryDown)
219
+ return;
220
+ if (e.intersects.some(
183
221
  (i) => this.isGizmoChild(i.object)
184
222
  ))
185
223
  return !0;
@@ -212,10 +250,10 @@ class L extends T {
212
250
  }
213
251
  // ============ Private Methods ============
214
252
  onSelectionChange(e) {
215
- e && h(e, "isMovable") ? this.attachGizmo(e) : this._gizmo.detach();
253
+ e && l(e, "isMovable") ? this.attachGizmo(e) : this._gizmo.detach();
216
254
  }
217
255
  attachGizmo(e) {
218
- h(e, "isMovable") && (this._gizmo.attach(e), this.setGizmoVisible(e.visible && this._gizmoVisible));
256
+ l(e, "isMovable") && (this._gizmo.attach(e), this.setGizmoVisible(e.visible && this._gizmoVisible));
219
257
  }
220
258
  isGizmoChild(e) {
221
259
  let s = e;
@@ -226,22 +264,24 @@ class L extends T {
226
264
  return !1;
227
265
  }
228
266
  initGizmo() {
229
- const e = new E(
230
- this._controller.object,
267
+ const e = new C(
268
+ this._controller.object.camera,
231
269
  this._controller.domElement
232
270
  );
233
- return e.mode = "translate", e.getHelper().traverse((i) => {
271
+ e.mode = "translate";
272
+ const s = e.getHelper();
273
+ return s.name = "TransformControlsRoot", s.traverse((i) => {
234
274
  if (!("isMesh" in i)) return;
235
- const r = i.material;
236
- i.name === "X" && r.color.set(b), i.name === "Y" && r.color.set(D), i.name === "Z" && r.color.set(y), i.name === "XY" && r.color.set(y), i.name === "YZ" && r.color.set(b), i.name === "XZ" && r.color.set(D);
275
+ const o = i.material;
276
+ i.name === "X" && o.color.set(b), i.name === "Y" && o.color.set(D), i.name === "Z" && o.color.set(y), i.name === "XY" && o.color.set(y), i.name === "YZ" && o.color.set(b), i.name === "XZ" && o.color.set(D);
237
277
  }), e.addEventListener("mouseDown", () => {
238
- var i, r;
239
- this._controller.enabled = !1, h(e.object, "isMovable") && ((r = (i = e.object).onMoveStart) == null || r.call(i));
278
+ var i, o;
279
+ this._controller.enabled = !1, l(e.object, "isMovable") && ((o = (i = e.object).onMoveStart) == null || o.call(i));
240
280
  }), e.addEventListener("objectChange", () => {
241
- var i, r;
242
- if (h(e.object, "isMovable")) {
243
- if ((r = (i = e.object).onMove) == null || r.call(i), this._scaleLinked && e.object) {
244
- const a = e.object.scale, c = (a.x + a.y + a.z) / 3;
281
+ var i, o;
282
+ if (l(e.object, "isMovable")) {
283
+ if ((o = (i = e.object).onMove) == null || o.call(i), this._scaleLinked && e.object) {
284
+ const n = e.object.scale, c = (n.x + n.y + n.z) / 3;
245
285
  e.object.scale.set(c, c, c);
246
286
  }
247
287
  switch (this.dispatchEvent({
@@ -269,28 +309,28 @@ class L extends T {
269
309
  }
270
310
  }
271
311
  }), e.addEventListener("mouseUp", () => {
272
- var i, r;
273
- this._controller.enabled = !0, h(e.object, "isMovable") && ((r = (i = e.object).onMoveEnd) == null || r.call(i));
312
+ var i, o;
313
+ this._controller.enabled = !0, l(e.object, "isMovable") && ((o = (i = e.object).onMoveEnd) == null || o.call(i));
274
314
  }), e;
275
315
  }
276
316
  }
277
- const A = 1e-3;
278
- class j {
317
+ const H = 1e-3;
318
+ class R {
279
319
  constructor(t) {
280
- o(this, "name", "drag");
281
- o(this, "priority", 10);
282
- o(this, "_controller");
283
- o(this, "_raycaster");
320
+ r(this, "name", "drag");
321
+ r(this, "priority", 10);
322
+ r(this, "_controller");
323
+ r(this, "_raycaster");
284
324
  // Drag state
285
- o(this, "_dragging", !1);
286
- o(this, "_draggable", null);
287
- o(this, "_dragStart", new l());
288
- o(this, "_dragCurrent", new l());
289
- o(this, "_dragEnd", new l());
290
- o(this, "_dragDelta", new l());
325
+ r(this, "_dragging", !1);
326
+ r(this, "_draggable", null);
327
+ r(this, "_dragStart", new h());
328
+ r(this, "_dragCurrent", new h());
329
+ r(this, "_dragEnd", new h());
330
+ r(this, "_dragDelta", new h());
291
331
  // Custom raycast targets for drag plane
292
- o(this, "_dragRaycastTargets", null);
293
- this._controller = t, this._raycaster = new P();
332
+ r(this, "_dragRaycastTargets", null);
333
+ this._controller = t, this._raycaster = new S();
294
334
  }
295
335
  /**
296
336
  * Whether a drag operation is currently in progress.
@@ -312,17 +352,23 @@ class j {
312
352
  }
313
353
  onPointerDown(t) {
314
354
  var e;
315
- t.pointerPrimaryDown && (this._draggable = g(
355
+ t.pointerPrimaryDown && (this._draggable = d(
316
356
  (e = t.intersects[0]) == null ? void 0 : e.object,
317
357
  "isDraggable"
318
358
  ) || null);
319
359
  }
320
360
  onPointerMove(t) {
321
- if (t.pointerPrimaryDown && this._draggable && (this._raycaster.setFromCamera(t.pointer, this._controller.object), this._dragging || t.lastPointerDown.distanceTo(t.pointer) > A && this.startDrag(t), this._dragging))
361
+ if (t.pointerPrimaryDown && this._draggable && (this._raycaster.setFromCamera(
362
+ t.pointer,
363
+ this._controller.object.camera
364
+ ), this._dragging || t.lastPointerDown.distanceTo(t.pointer) > H && this.startDrag(t), this._dragging))
322
365
  return this.updateDrag(t), !0;
323
366
  }
324
367
  onPointerUp(t) {
325
- this._dragging && (this._raycaster.setFromCamera(t.pointer, this._controller.object), this.endDrag()), this._draggable = null;
368
+ this._dragging && (this._raycaster.setFromCamera(
369
+ t.pointer,
370
+ this._controller.object.camera
371
+ ), this.endDrag()), this._draggable = null;
326
372
  }
327
373
  /**
328
374
  * Set custom objects to raycast against during drag.
@@ -368,40 +414,38 @@ class j {
368
414
  }
369
415
  }
370
416
  const k = 1e-3;
371
- class X {
417
+ class B {
372
418
  constructor(t, e) {
373
- o(this, "_scene");
374
- o(this, "_controller");
375
- o(this, "_canvas");
419
+ r(this, "_scene");
420
+ r(this, "_controller");
421
+ r(this, "_canvas");
376
422
  // Tool management
377
- o(this, "_tools");
378
- o(this, "_activeTools", /* @__PURE__ */ new Map());
379
- o(this, "_sortedActiveTools", []);
423
+ r(this, "_tools");
424
+ r(this, "_activeTools", /* @__PURE__ */ new Map());
425
+ r(this, "_sortedActiveTools", []);
380
426
  // Shared selection state
381
- o(this, "_selectionState");
427
+ r(this, "_selectionState");
382
428
  // Raycasting (shared, computed once per event)
383
- o(this, "_raycaster");
384
- o(this, "_pointer");
385
- o(this, "_productLayerMask");
386
- o(this, "_uiLayerMask");
429
+ r(this, "_raycaster");
430
+ r(this, "_pointer");
387
431
  // Pointer state
388
- o(this, "_pointerPrimaryDown", !1);
389
- o(this, "_pointerMiddleDown", !1);
390
- o(this, "_pointerSecondaryDown", !1);
391
- o(this, "_lastPointerDown");
432
+ r(this, "_pointerPrimaryDown", !1);
433
+ r(this, "_pointerMiddleDown", !1);
434
+ r(this, "_pointerSecondaryDown", !1);
435
+ r(this, "_lastPointerDown");
392
436
  // Bound event handlers (for cleanup)
393
- o(this, "_boundPointerMove");
394
- o(this, "_boundPointerDown");
395
- o(this, "_boundPointerUp");
396
- o(this, "_boundWheel");
397
- this._scene = t, this._controller = e, this._canvas = e.domElement, this._selectionState = new z(), this._raycaster = new P(), this._pointer = new f(), this._lastPointerDown = new f(), this._productLayerMask = new m(), this._productLayerMask.set(Math.log2(_)), this._uiLayerMask = new m(), this._uiLayerMask.set(Math.log2(d)), this._tools = /* @__PURE__ */ new Map([
398
- ["hover", new C()],
437
+ r(this, "_boundPointerMove");
438
+ r(this, "_boundPointerDown");
439
+ r(this, "_boundPointerUp");
440
+ r(this, "_boundWheel");
441
+ this._scene = t, this._controller = e, this._canvas = e.domElement, this._selectionState = new L(), this._raycaster = new S(), this._pointer = new m(), this._lastPointerDown = new m(), this._tools = /* @__PURE__ */ new Map([
442
+ ["hover", new A()],
399
443
  ["select", new M(this._selectionState)],
400
444
  [
401
445
  "transform",
402
- new L(t, e, this._selectionState)
446
+ new j(t, e, this._selectionState)
403
447
  ],
404
- ["drag", new j(e)]
448
+ ["drag", new R(e)]
405
449
  ]), this._boundPointerMove = this.onPointerMove.bind(this), this._boundPointerDown = this.onPointerDown.bind(this), this._boundPointerUp = this.onPointerUp.bind(this), this._boundWheel = this.onWheel.bind(this), this._canvas.addEventListener("pointermove", this._boundPointerMove), this._canvas.addEventListener("pointerdown", this._boundPointerDown), this._canvas.addEventListener("pointerup", this._boundPointerUp), this._canvas.addEventListener("wheel", this._boundWheel);
406
450
  }
407
451
  get selectionState() {
@@ -466,14 +510,14 @@ class X {
466
510
  if ((s = i.onPointerDown) == null ? void 0 : s.call(i, e)) break;
467
511
  }
468
512
  onPointerUp(t) {
469
- var i, r;
513
+ var i, o;
470
514
  this.updatePointer(t);
471
515
  const e = this.createPointerContext(t), s = !this.pointerWasDragged();
472
- for (const a of this._sortedActiveTools)
473
- if ((i = a.onPointerUp) == null ? void 0 : i.call(a, e)) break;
516
+ for (const n of this._sortedActiveTools)
517
+ if ((i = n.onPointerUp) == null ? void 0 : i.call(n, e)) break;
474
518
  if (s) {
475
- for (const a of this._sortedActiveTools)
476
- if ((r = a.onClick) == null ? void 0 : r.call(a, e)) break;
519
+ for (const n of this._sortedActiveTools)
520
+ if ((o = n.onClick) == null ? void 0 : o.call(n, e)) break;
477
521
  }
478
522
  this.updatePointerState(t, !1);
479
523
  }
@@ -485,44 +529,55 @@ class X {
485
529
  }
486
530
  // ============ Context Creation ============
487
531
  createPointerContext(t) {
488
- const e = this.raycast();
489
- return {
532
+ return Object.assign(this.createLazyIntersects(), {
490
533
  event: t,
491
534
  pointer: this._pointer.clone(),
492
- intersects: e,
493
- modelIntersects: this.filterIntersectsByLayer(
494
- e,
495
- _
496
- ),
497
- uiIntersects: this.filterIntersectsByLayer(
498
- e,
499
- d
500
- ),
501
535
  pointerPrimaryDown: this._pointerPrimaryDown,
502
536
  pointerMiddleDown: this._pointerMiddleDown,
503
537
  pointerSecondaryDown: this._pointerSecondaryDown,
504
538
  lastPointerDown: this._lastPointerDown.clone()
505
- };
539
+ });
506
540
  }
507
541
  createWheelContext(t) {
508
- const e = this.raycast();
509
- return {
542
+ return Object.assign(this.createLazyIntersects(), {
510
543
  event: t,
511
- pointer: this._pointer.clone(),
512
- intersects: e,
513
- modelIntersects: this.filterIntersectsByLayer(
514
- e,
515
- _
516
- ),
517
- uiIntersects: this.filterIntersectsByLayer(
518
- e,
519
- d
520
- )
544
+ pointer: this._pointer.clone()
545
+ });
546
+ }
547
+ /**
548
+ * The four intersect lists, each raycast on first read and then kept.
549
+ *
550
+ * Still one raycast per event shared by every tool -- but only if a tool
551
+ * actually looks. It used to run eagerly, so a pointer move cost a full
552
+ * raycast even with no tool enabled at all, and while the camera was being
553
+ * orbited that was a raycast per frame against every mesh in the scene.
554
+ */
555
+ createLazyIntersects() {
556
+ const t = () => s ?? (s = this.raycast()), e = (c) => this.filterIntersectsByLayer(t(), c);
557
+ let s, i, o, n;
558
+ return {
559
+ get intersects() {
560
+ return t();
561
+ },
562
+ get modelIntersects() {
563
+ return i ?? (i = e(_));
564
+ },
565
+ get entityIntersects() {
566
+ return o ?? (o = e(
567
+ _ | v
568
+ ));
569
+ },
570
+ get uiIntersects() {
571
+ return n ?? (n = e(f));
572
+ }
521
573
  };
522
574
  }
523
575
  // ============ Helper Methods ============
524
576
  updatePointer(t) {
525
- this._pointer.x = t.offsetX / this._canvas.clientWidth * 2 - 1, this._pointer.y = -(t.offsetY / this._canvas.clientHeight) * 2 + 1, this._raycaster.setFromCamera(this._pointer, this._controller.object);
577
+ this._pointer.x = t.offsetX / this._canvas.clientWidth * 2 - 1, this._pointer.y = -(t.offsetY / this._canvas.clientHeight) * 2 + 1, this._raycaster.setFromCamera(
578
+ this._pointer,
579
+ this._controller.object.camera
580
+ );
526
581
  }
527
582
  updatePointerState(t, e) {
528
583
  switch (t.button) {
@@ -538,11 +593,9 @@ class X {
538
593
  }
539
594
  }
540
595
  raycast() {
541
- this._raycaster.layers.mask = _ | d;
542
- const t = this._scene.children.filter(
543
- (e) => e.visible && "isMesh" in e && e.isMesh
596
+ return this._raycaster.layers.mask = E | _ | f | v, this._raycaster.intersectObjects(this._scene.children, !0).filter(
597
+ (t) => z(t.object)
544
598
  );
545
- return this._raycaster.intersectObjects(t, !0);
546
599
  }
547
600
  filterIntersectsByLayer(t, e) {
548
601
  return t.filter(
@@ -560,13 +613,13 @@ class X {
560
613
  }
561
614
  export {
562
615
  M as DIVESelectTool,
563
- L as DIVETransformTool,
564
- j as DragTool,
565
- C as HoverTool,
616
+ j as DIVETransformTool,
617
+ R as DragTool,
618
+ A as HoverTool,
566
619
  M as SelectTool,
567
- z as SelectionState,
568
- X as Toolbox,
569
- L as TransformTool,
570
- B as isSelectTool,
571
- Y as isTransformTool
620
+ L as SelectionState,
621
+ B as Toolbox,
622
+ j as TransformTool,
623
+ F as isSelectTool,
624
+ K as isTransformTool
572
625
  };
@@ -16,6 +16,11 @@ export interface PointerContext {
16
16
  readonly intersects: Intersection[];
17
17
  /** Intersections filtered to PRODUCT_LAYER (models only) */
18
18
  readonly modelIntersects: Intersection[];
19
+ /**
20
+ * Intersections that stand for an entity: real geometry, or a proxy for
21
+ * something that has none, such as a light's handle. What selecting reads.
22
+ */
23
+ readonly entityIntersects: Intersection[];
19
24
  /** Intersections filtered to UI_LAYER (gizmo, UI elements) */
20
25
  readonly uiIntersects: Intersection[];
21
26
  /** Whether primary mouse button (left) is pressed */
@@ -41,6 +46,8 @@ export interface WheelContext {
41
46
  readonly intersects: Intersection[];
42
47
  /** Intersections filtered to PRODUCT_LAYER (models only) */
43
48
  readonly modelIntersects: Intersection[];
49
+ /** Intersections that stand for an entity. See {@link PointerContext}. */
50
+ readonly entityIntersects: Intersection[];
44
51
  /** Intersections filtered to UI_LAYER (gizmo, UI elements) */
45
52
  readonly uiIntersects: Intersection[];
46
53
  }
@@ -21,11 +21,32 @@ export declare class SelectionState {
21
21
  * Calls onSelect on the new object and onDeselect on the previous.
22
22
  */
23
23
  select(obj: Object3D & DIVESelectable): void;
24
+ /**
25
+ * Selects without having the object announce it.
26
+ *
27
+ * For a caller that announces the selection itself, so a subscriber does not
28
+ * hear about it twice: whoever asked for this already knows it happened.
29
+ *
30
+ * The object that was displaced still gets its `onDeselect` — nobody told
31
+ * *it* anything, and it is the only source for that news. Listeners
32
+ * registered through {@link onChange} are notified either way, or a
33
+ * programmatic selection would not attach the gizmo.
34
+ */
35
+ applySelection(obj: Object3D & DIVESelectable): void;
24
36
  /**
25
37
  * Deselect the currently selected object.
26
38
  * Calls onDeselect on the object.
27
39
  */
28
40
  deselect(): void;
41
+ /**
42
+ * Deselects without having the object announce it.
43
+ *
44
+ * The counterpart to {@link applySelection}: for a caller that asked for
45
+ * exactly this and announces it itself.
46
+ */
47
+ applyDeselection(): void;
48
+ private _select;
49
+ private _deselect;
29
50
  /**
30
51
  * Register a callback to be notified when selection changes.
31
52
  */
@@ -22,8 +22,6 @@ export declare class Toolbox {
22
22
  get selectionState(): SelectionState;
23
23
  private _raycaster;
24
24
  private _pointer;
25
- private _productLayerMask;
26
- private _uiLayerMask;
27
25
  private _pointerPrimaryDown;
28
26
  private _pointerMiddleDown;
29
27
  private _pointerSecondaryDown;
@@ -63,6 +61,15 @@ export declare class Toolbox {
63
61
  private onWheel;
64
62
  private createPointerContext;
65
63
  private createWheelContext;
64
+ /**
65
+ * The four intersect lists, each raycast on first read and then kept.
66
+ *
67
+ * Still one raycast per event shared by every tool -- but only if a tool
68
+ * actually looks. It used to run eagerly, so a pointer move cost a full
69
+ * raycast even with no tool enabled at all, and while the camera was being
70
+ * orbited that was a raycast per frame against every mesh in the scene.
71
+ */
72
+ private createLazyIntersects;
66
73
  private updatePointer;
67
74
  private updatePointerState;
68
75
  private raycast;
@@ -1,7 +1,21 @@
1
1
  import { Euler, Object3D, Vector3 } from 'three/webgpu';
2
- import { OrbitController } from '../../plugins/orbitcontroller/index.ts';
2
+ import { OrbitController } from '../../../orbitcontroller/index.ts';
3
3
  import { DIVEGizmoPlane as DIVEGizmoPlane } from './plane/GizmoPlane.ts';
4
- import { DIVESelectable } from '../../interfaces/Selectable.ts';
4
+ import { DIVESelectable } from '../../../../index.ts';
5
+ /**
6
+ * DIVE's own transform gizmo.
7
+ *
8
+ * **Written ahead of its activation, and deliberately not wired up yet.** The
9
+ * toolbox currently drives three's `TransformControls` (see
10
+ * `plugins/toolbox/src/transform/TransformTool.ts`), so nothing constructs a
11
+ * `DIVEGizmo` at runtime.
12
+ *
13
+ * Being unreferenced is therefore expected and is *not* a sign that this is
14
+ * obsolete — do not remove it as dead code. Its tests keep it compiling until
15
+ * the switch happens.
16
+ *
17
+ * @module
18
+ */
5
19
  export type DIVEGizmoMode = 'translate' | 'rotate' | 'scale';
6
20
  export type DIVEGizmoAxis = 'x' | 'y' | 'z';
7
21
  export declare class DIVEGizmo extends Object3D {
@@ -1,8 +1,7 @@
1
1
  import { ColorRepresentation, Object3D, Vector3 } from 'three/webgpu';
2
- import { DIVEHoverable } from '../../../interfaces/Hoverable.ts';
2
+ import { DIVEHoverable, DIVEDraggable } from '../../../../../index.ts';
3
3
  import { DIVETranslateGizmo } from '../translate/TranslateGizmo.ts';
4
- import { DIVEDraggable } from '../../../interfaces/Draggable.ts';
5
- import { DraggableEvent } from '../../../plugins/toolbox/index.ts';
4
+ import { DraggableEvent } from '../../drag/DraggableEvent.ts';
6
5
  export declare class DIVEAxisHandle extends Object3D implements DIVEHoverable, DIVEDraggable {
7
6
  readonly isHoverable: true;
8
7
  readonly isDraggable: true;
@@ -1,8 +1,7 @@
1
1
  import { ColorRepresentation, Object3D, Vector3 } from 'three/webgpu';
2
- import { DIVEHoverable } from '../../../interfaces/Hoverable.ts';
3
- import { DraggableEvent } from '../../../plugins/toolbox/index.ts';
2
+ import { DIVEHoverable, DIVEDraggable } from '../../../../../index.ts';
3
+ import { DraggableEvent } from '../../drag/DraggableEvent.ts';
4
4
  import { DIVERotateGizmo } from '../rotate/RotateGizmo.ts';
5
- import { DIVEDraggable } from '../../../interfaces/Draggable.ts';
6
5
  export declare class DIVERadialHandle extends Object3D implements DIVEHoverable, DIVEDraggable {
7
6
  readonly isHoverable: true;
8
7
  readonly isDraggable: true;
@@ -1,8 +1,7 @@
1
1
  import { ColorRepresentation, Object3D, Vector3 } from 'three/webgpu';
2
- import { DIVEHoverable } from '../../../interfaces/Hoverable.ts';
2
+ import { DIVEHoverable, DIVEDraggable } from '../../../../../index.ts';
3
3
  import { DIVEScaleGizmo } from '../scale/ScaleGizmo.ts';
4
- import { DIVEDraggable } from '../../../interfaces/Draggable.ts';
5
- import { DraggableEvent } from '../../../plugins/toolbox/index.ts';
4
+ import { DraggableEvent } from '../../drag/DraggableEvent.ts';
6
5
  export declare class DIVEScaleHandle extends Object3D implements DIVEHoverable, DIVEDraggable {
7
6
  readonly isHoverable: true;
8
7
  readonly isDraggable: true;