@shapediver/viewer.features.drawing-tools 3.1.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.
Files changed (209) hide show
  1. package/LICENSE +73 -0
  2. package/README.md +161 -0
  3. package/dist/api/implementation/DrawingToolsApi.d.ts +31 -0
  4. package/dist/api/implementation/DrawingToolsApi.d.ts.map +1 -0
  5. package/dist/api/implementation/DrawingToolsApi.js +111 -0
  6. package/dist/api/implementation/DrawingToolsApi.js.map +1 -0
  7. package/dist/api/implementation/restrictions/AbstractRestrictionApi.d.ts +10 -0
  8. package/dist/api/implementation/restrictions/AbstractRestrictionApi.d.ts.map +1 -0
  9. package/dist/api/implementation/restrictions/AbstractRestrictionApi.js +38 -0
  10. package/dist/api/implementation/restrictions/AbstractRestrictionApi.js.map +1 -0
  11. package/dist/api/implementation/restrictions/AbstractSnapRestrictionApi.d.ts +11 -0
  12. package/dist/api/implementation/restrictions/AbstractSnapRestrictionApi.d.ts.map +1 -0
  13. package/dist/api/implementation/restrictions/AbstractSnapRestrictionApi.js +40 -0
  14. package/dist/api/implementation/restrictions/AbstractSnapRestrictionApi.js.map +1 -0
  15. package/dist/api/implementation/restrictions/axis/AxisRestrictionApi.d.ts +7 -0
  16. package/dist/api/implementation/restrictions/axis/AxisRestrictionApi.d.ts.map +1 -0
  17. package/dist/api/implementation/restrictions/axis/AxisRestrictionApi.js +24 -0
  18. package/dist/api/implementation/restrictions/axis/AxisRestrictionApi.js.map +1 -0
  19. package/dist/api/implementation/restrictions/geometry/GeometryRestrictionApi.d.ts +15 -0
  20. package/dist/api/implementation/restrictions/geometry/GeometryRestrictionApi.d.ts.map +1 -0
  21. package/dist/api/implementation/restrictions/geometry/GeometryRestrictionApi.js +54 -0
  22. package/dist/api/implementation/restrictions/geometry/GeometryRestrictionApi.js.map +1 -0
  23. package/dist/api/implementation/restrictions/plane/PlaneRestrictionApi.d.ts +18 -0
  24. package/dist/api/implementation/restrictions/plane/PlaneRestrictionApi.d.ts.map +1 -0
  25. package/dist/api/implementation/restrictions/plane/PlaneRestrictionApi.js +61 -0
  26. package/dist/api/implementation/restrictions/plane/PlaneRestrictionApi.js.map +1 -0
  27. package/dist/api/implementation/restrictions/plane/snap/AngularRestrictionApi.d.ts +10 -0
  28. package/dist/api/implementation/restrictions/plane/snap/AngularRestrictionApi.d.ts.map +1 -0
  29. package/dist/api/implementation/restrictions/plane/snap/AngularRestrictionApi.js +40 -0
  30. package/dist/api/implementation/restrictions/plane/snap/AngularRestrictionApi.js.map +1 -0
  31. package/dist/api/implementation/restrictions/plane/snap/GridRestrictionApi.d.ts +10 -0
  32. package/dist/api/implementation/restrictions/plane/snap/GridRestrictionApi.d.ts.map +1 -0
  33. package/dist/api/implementation/restrictions/plane/snap/GridRestrictionApi.js +40 -0
  34. package/dist/api/implementation/restrictions/plane/snap/GridRestrictionApi.js.map +1 -0
  35. package/dist/api/interfaces/IDrawingToolsApi.d.ts +89 -0
  36. package/dist/api/interfaces/IDrawingToolsApi.d.ts.map +1 -0
  37. package/dist/api/interfaces/IDrawingToolsApi.js +3 -0
  38. package/dist/api/interfaces/IDrawingToolsApi.js.map +1 -0
  39. package/dist/api/interfaces/IRestrictionApi.d.ts +11 -0
  40. package/dist/api/interfaces/IRestrictionApi.d.ts.map +1 -0
  41. package/dist/api/interfaces/IRestrictionApi.js +3 -0
  42. package/dist/api/interfaces/IRestrictionApi.js.map +1 -0
  43. package/dist/api/interfaces/ISnapRestrictionApi.d.ts +13 -0
  44. package/dist/api/interfaces/ISnapRestrictionApi.d.ts.map +1 -0
  45. package/dist/api/interfaces/ISnapRestrictionApi.js +3 -0
  46. package/dist/api/interfaces/ISnapRestrictionApi.js.map +1 -0
  47. package/dist/business/implementation/DrawingToolsManager.d.ts +95 -0
  48. package/dist/business/implementation/DrawingToolsManager.d.ts.map +1 -0
  49. package/dist/business/implementation/DrawingToolsManager.js +544 -0
  50. package/dist/business/implementation/DrawingToolsManager.js.map +1 -0
  51. package/dist/business/implementation/managers/HistoryManager.d.ts +19 -0
  52. package/dist/business/implementation/managers/HistoryManager.d.ts.map +1 -0
  53. package/dist/business/implementation/managers/HistoryManager.js +89 -0
  54. package/dist/business/implementation/managers/HistoryManager.js.map +1 -0
  55. package/dist/business/implementation/managers/TextVisualizationManager.d.ts +14 -0
  56. package/dist/business/implementation/managers/TextVisualizationManager.d.ts.map +1 -0
  57. package/dist/business/implementation/managers/TextVisualizationManager.js +228 -0
  58. package/dist/business/implementation/managers/TextVisualizationManager.js.map +1 -0
  59. package/dist/business/implementation/managers/geometry/GeometryManager.d.ts +23 -0
  60. package/dist/business/implementation/managers/geometry/GeometryManager.d.ts.map +1 -0
  61. package/dist/business/implementation/managers/geometry/GeometryManager.js +82 -0
  62. package/dist/business/implementation/managers/geometry/GeometryManager.js.map +1 -0
  63. package/dist/business/implementation/managers/geometry/GeometryMathManager.d.ts +73 -0
  64. package/dist/business/implementation/managers/geometry/GeometryMathManager.d.ts.map +1 -0
  65. package/dist/business/implementation/managers/geometry/GeometryMathManager.js +230 -0
  66. package/dist/business/implementation/managers/geometry/GeometryMathManager.js.map +1 -0
  67. package/dist/business/implementation/managers/geometry/GeometryState.d.ts +46 -0
  68. package/dist/business/implementation/managers/geometry/GeometryState.d.ts.map +1 -0
  69. package/dist/business/implementation/managers/geometry/GeometryState.js +323 -0
  70. package/dist/business/implementation/managers/geometry/GeometryState.js.map +1 -0
  71. package/dist/business/implementation/managers/geometry/helpers/GeometryManagerHelper.d.ts +16 -0
  72. package/dist/business/implementation/managers/geometry/helpers/GeometryManagerHelper.d.ts.map +1 -0
  73. package/dist/business/implementation/managers/geometry/helpers/GeometryManagerHelper.js +157 -0
  74. package/dist/business/implementation/managers/geometry/helpers/GeometryManagerHelper.js.map +1 -0
  75. package/dist/business/implementation/managers/interaction/EventManager.d.ts +26 -0
  76. package/dist/business/implementation/managers/interaction/EventManager.d.ts.map +1 -0
  77. package/dist/business/implementation/managers/interaction/EventManager.js +63 -0
  78. package/dist/business/implementation/managers/interaction/EventManager.js.map +1 -0
  79. package/dist/business/implementation/managers/interaction/InteractionManager.d.ts +39 -0
  80. package/dist/business/implementation/managers/interaction/InteractionManager.d.ts.map +1 -0
  81. package/dist/business/implementation/managers/interaction/InteractionManager.js +237 -0
  82. package/dist/business/implementation/managers/interaction/InteractionManager.js.map +1 -0
  83. package/dist/business/implementation/managers/interaction/RestrictionManager.d.ts +19 -0
  84. package/dist/business/implementation/managers/interaction/RestrictionManager.d.ts.map +1 -0
  85. package/dist/business/implementation/managers/interaction/RestrictionManager.js +117 -0
  86. package/dist/business/implementation/managers/interaction/RestrictionManager.js.map +1 -0
  87. package/dist/business/implementation/managers/interaction/handlers/DeletionInteractionHandler.d.ts +10 -0
  88. package/dist/business/implementation/managers/interaction/handlers/DeletionInteractionHandler.d.ts.map +1 -0
  89. package/dist/business/implementation/managers/interaction/handlers/DeletionInteractionHandler.js +52 -0
  90. package/dist/business/implementation/managers/interaction/handlers/DeletionInteractionHandler.js.map +1 -0
  91. package/dist/business/implementation/managers/interaction/handlers/InsertionInteractionHandler.d.ts +14 -0
  92. package/dist/business/implementation/managers/interaction/handlers/InsertionInteractionHandler.d.ts.map +1 -0
  93. package/dist/business/implementation/managers/interaction/handlers/InsertionInteractionHandler.js +135 -0
  94. package/dist/business/implementation/managers/interaction/handlers/InsertionInteractionHandler.js.map +1 -0
  95. package/dist/business/implementation/managers/interaction/handlers/MidPointInteractionHandler.d.ts +16 -0
  96. package/dist/business/implementation/managers/interaction/handlers/MidPointInteractionHandler.d.ts.map +1 -0
  97. package/dist/business/implementation/managers/interaction/handlers/MidPointInteractionHandler.js +113 -0
  98. package/dist/business/implementation/managers/interaction/handlers/MidPointInteractionHandler.js.map +1 -0
  99. package/dist/business/implementation/managers/interaction/helpers/InteractionManagerHelper.d.ts +58 -0
  100. package/dist/business/implementation/managers/interaction/helpers/InteractionManagerHelper.d.ts.map +1 -0
  101. package/dist/business/implementation/managers/interaction/helpers/InteractionManagerHelper.js +377 -0
  102. package/dist/business/implementation/managers/interaction/helpers/InteractionManagerHelper.js.map +1 -0
  103. package/dist/business/implementation/managers/interaction/restrictions/AbstractRestriction.d.ts +19 -0
  104. package/dist/business/implementation/managers/interaction/restrictions/AbstractRestriction.d.ts.map +1 -0
  105. package/dist/business/implementation/managers/interaction/restrictions/AbstractRestriction.js +105 -0
  106. package/dist/business/implementation/managers/interaction/restrictions/AbstractRestriction.js.map +1 -0
  107. package/dist/business/implementation/managers/interaction/restrictions/axis/AxisRestriction.d.ts +22 -0
  108. package/dist/business/implementation/managers/interaction/restrictions/axis/AxisRestriction.d.ts.map +1 -0
  109. package/dist/business/implementation/managers/interaction/restrictions/axis/AxisRestriction.js +96 -0
  110. package/dist/business/implementation/managers/interaction/restrictions/axis/AxisRestriction.js.map +1 -0
  111. package/dist/business/implementation/managers/interaction/restrictions/geometry/GeometryRestriction.d.ts +39 -0
  112. package/dist/business/implementation/managers/interaction/restrictions/geometry/GeometryRestriction.d.ts.map +1 -0
  113. package/dist/business/implementation/managers/interaction/restrictions/geometry/GeometryRestriction.js +215 -0
  114. package/dist/business/implementation/managers/interaction/restrictions/geometry/GeometryRestriction.js.map +1 -0
  115. package/dist/business/implementation/managers/interaction/restrictions/plane/PlaneRestriction.d.ts +58 -0
  116. package/dist/business/implementation/managers/interaction/restrictions/plane/PlaneRestriction.d.ts.map +1 -0
  117. package/dist/business/implementation/managers/interaction/restrictions/plane/PlaneRestriction.js +180 -0
  118. package/dist/business/implementation/managers/interaction/restrictions/plane/PlaneRestriction.js.map +1 -0
  119. package/dist/business/implementation/managers/interaction/restrictions/plane/snap/AngularRestriction.d.ts +38 -0
  120. package/dist/business/implementation/managers/interaction/restrictions/plane/snap/AngularRestriction.d.ts.map +1 -0
  121. package/dist/business/implementation/managers/interaction/restrictions/plane/snap/AngularRestriction.js +308 -0
  122. package/dist/business/implementation/managers/interaction/restrictions/plane/snap/AngularRestriction.js.map +1 -0
  123. package/dist/business/implementation/managers/interaction/restrictions/plane/snap/GridRestriction.d.ts +37 -0
  124. package/dist/business/implementation/managers/interaction/restrictions/plane/snap/GridRestriction.d.ts.map +1 -0
  125. package/dist/business/implementation/managers/interaction/restrictions/plane/snap/GridRestriction.js +228 -0
  126. package/dist/business/implementation/managers/interaction/restrictions/plane/snap/GridRestriction.js.map +1 -0
  127. package/dist/business/implementation/utils/numberCleaner.d.ts +2 -0
  128. package/dist/business/implementation/utils/numberCleaner.d.ts.map +1 -0
  129. package/dist/business/implementation/utils/numberCleaner.js +9 -0
  130. package/dist/business/implementation/utils/numberCleaner.js.map +1 -0
  131. package/dist/business/interfaces/IDrawingToolsManager.d.ts +270 -0
  132. package/dist/business/interfaces/IDrawingToolsManager.d.ts.map +1 -0
  133. package/dist/business/interfaces/IDrawingToolsManager.js +16 -0
  134. package/dist/business/interfaces/IDrawingToolsManager.js.map +1 -0
  135. package/dist/business/interfaces/IManager.d.ts +4 -0
  136. package/dist/business/interfaces/IManager.d.ts.map +1 -0
  137. package/dist/business/interfaces/IManager.js +3 -0
  138. package/dist/business/interfaces/IManager.js.map +1 -0
  139. package/dist/business/interfaces/IRestriction.d.ts +41 -0
  140. package/dist/business/interfaces/IRestriction.d.ts.map +1 -0
  141. package/dist/business/interfaces/IRestriction.js +13 -0
  142. package/dist/business/interfaces/IRestriction.js.map +1 -0
  143. package/dist/business/interfaces/IRestrictionBase.d.ts +19 -0
  144. package/dist/business/interfaces/IRestrictionBase.d.ts.map +1 -0
  145. package/dist/business/interfaces/IRestrictionBase.js +5 -0
  146. package/dist/business/interfaces/IRestrictionBase.js.map +1 -0
  147. package/dist/business/interfaces/ISnapRestriction.d.ts +50 -0
  148. package/dist/business/interfaces/ISnapRestriction.d.ts.map +1 -0
  149. package/dist/business/interfaces/ISnapRestriction.js +4 -0
  150. package/dist/business/interfaces/ISnapRestriction.js.map +1 -0
  151. package/dist/business/interfaces/events/EventResponseMapping.d.ts +19 -0
  152. package/dist/business/interfaces/events/EventResponseMapping.d.ts.map +1 -0
  153. package/dist/business/interfaces/events/EventResponseMapping.js +4 -0
  154. package/dist/business/interfaces/events/EventResponseMapping.js.map +1 -0
  155. package/dist/business/interfaces/events/IDrawingToolsEvent.d.ts +12 -0
  156. package/dist/business/interfaces/events/IDrawingToolsEvent.d.ts.map +1 -0
  157. package/dist/business/interfaces/events/IDrawingToolsEvent.js +3 -0
  158. package/dist/business/interfaces/events/IDrawingToolsEvent.js.map +1 -0
  159. package/dist/index.d.ts +32 -0
  160. package/dist/index.d.ts.map +1 -0
  161. package/dist/index.js +45 -0
  162. package/dist/index.js.map +1 -0
  163. package/dist/three/CSS2DRenderer.d.ts +32 -0
  164. package/dist/three/CSS2DRenderer.d.ts.map +1 -0
  165. package/dist/three/CSS2DRenderer.js +137 -0
  166. package/dist/three/CSS2DRenderer.js.map +1 -0
  167. package/package.json +55 -0
  168. package/src/api/implementation/DrawingToolsApi.ts +135 -0
  169. package/src/api/implementation/restrictions/AbstractRestrictionApi.ts +34 -0
  170. package/src/api/implementation/restrictions/AbstractSnapRestrictionApi.ts +36 -0
  171. package/src/api/implementation/restrictions/axis/AxisRestrictionApi.ts +19 -0
  172. package/src/api/implementation/restrictions/geometry/GeometryRestrictionApi.ts +56 -0
  173. package/src/api/implementation/restrictions/plane/PlaneRestrictionApi.ts +63 -0
  174. package/src/api/implementation/restrictions/plane/snap/AngularRestrictionApi.ts +35 -0
  175. package/src/api/implementation/restrictions/plane/snap/GridRestrictionApi.ts +35 -0
  176. package/src/api/interfaces/IDrawingToolsApi.ts +99 -0
  177. package/src/api/interfaces/IRestrictionApi.ts +15 -0
  178. package/src/api/interfaces/ISnapRestrictionApi.ts +18 -0
  179. package/src/business/implementation/DrawingToolsManager.ts +619 -0
  180. package/src/business/implementation/managers/HistoryManager.ts +101 -0
  181. package/src/business/implementation/managers/TextVisualizationManager.ts +245 -0
  182. package/src/business/implementation/managers/geometry/GeometryManager.ts +95 -0
  183. package/src/business/implementation/managers/geometry/GeometryMathManager.ts +273 -0
  184. package/src/business/implementation/managers/geometry/GeometryState.ts +436 -0
  185. package/src/business/implementation/managers/geometry/helpers/GeometryManagerHelper.ts +170 -0
  186. package/src/business/implementation/managers/interaction/EventManager.ts +80 -0
  187. package/src/business/implementation/managers/interaction/InteractionManager.ts +268 -0
  188. package/src/business/implementation/managers/interaction/RestrictionManager.ts +135 -0
  189. package/src/business/implementation/managers/interaction/handlers/DeletionInteractionHandler.ts +48 -0
  190. package/src/business/implementation/managers/interaction/handlers/InsertionInteractionHandler.ts +149 -0
  191. package/src/business/implementation/managers/interaction/handlers/MidPointInteractionHandler.ts +127 -0
  192. package/src/business/implementation/managers/interaction/helpers/InteractionManagerHelper.ts +411 -0
  193. package/src/business/implementation/managers/interaction/restrictions/AbstractRestriction.ts +99 -0
  194. package/src/business/implementation/managers/interaction/restrictions/axis/AxisRestriction.ts +107 -0
  195. package/src/business/implementation/managers/interaction/restrictions/geometry/GeometryRestriction.ts +237 -0
  196. package/src/business/implementation/managers/interaction/restrictions/plane/PlaneRestriction.ts +257 -0
  197. package/src/business/implementation/managers/interaction/restrictions/plane/snap/AngularRestriction.ts +384 -0
  198. package/src/business/implementation/managers/interaction/restrictions/plane/snap/GridRestriction.ts +262 -0
  199. package/src/business/implementation/utils/numberCleaner.ts +5 -0
  200. package/src/business/interfaces/IDrawingToolsManager.ts +313 -0
  201. package/src/business/interfaces/IManager.ts +7 -0
  202. package/src/business/interfaces/IRestriction.ts +64 -0
  203. package/src/business/interfaces/IRestrictionBase.ts +33 -0
  204. package/src/business/interfaces/ISnapRestriction.ts +70 -0
  205. package/src/business/interfaces/events/EventResponseMapping.ts +19 -0
  206. package/src/business/interfaces/events/IDrawingToolsEvent.ts +16 -0
  207. package/src/index.ts +72 -0
  208. package/src/three/CSS2DRenderer.ts +212 -0
  209. package/tsconfig.json +17 -0
@@ -0,0 +1,127 @@
1
+ import { DrawingToolsManager } from '../../../DrawingToolsManager';
2
+ import { GeometryMathManager } from '../../geometry/GeometryMathManager';
3
+ import { GeometryState } from '../../geometry/GeometryState';
4
+ import { InteractionManager } from '../InteractionManager';
5
+ import { IRay } from '@shapediver/viewer.features.interaction';
6
+ import { MATERIAL_INDEX } from '../../../../interfaces/IDrawingToolsManager';
7
+ import { vec3 } from 'gl-matrix';
8
+
9
+ export class MidPointInteractionHandler {
10
+ // #region Properties (5)
11
+
12
+ readonly #drawingToolsManager: DrawingToolsManager;
13
+ readonly #geometryMathManager: GeometryMathManager;
14
+ readonly #geometryState: GeometryState;
15
+
16
+ #midPointInsertionActive: boolean = false;
17
+ #midPointInsertionIndex: number = -1;
18
+
19
+ // #endregion Properties (5)
20
+
21
+ // #region Constructors (1)
22
+
23
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
24
+ constructor(drawingToolsManager: DrawingToolsManager, interactionManager: InteractionManager) {
25
+ this.#drawingToolsManager = drawingToolsManager;
26
+
27
+ this.#geometryState = drawingToolsManager.geometryState;
28
+ this.#geometryMathManager = drawingToolsManager.geometryMathManager;
29
+ }
30
+
31
+ // #endregion Constructors (1)
32
+
33
+ // #region Public Getters And Setters (2)
34
+
35
+ public get midPointInsertionActive(): boolean {
36
+ return this.#midPointInsertionActive;
37
+ }
38
+
39
+ public get midPointInsertionIndex(): number {
40
+ return this.#midPointInsertionIndex;
41
+ }
42
+
43
+ // #endregion Public Getters And Setters (2)
44
+
45
+ // #region Public Methods (3)
46
+
47
+ public finishMidPointInsertion(distances: {
48
+ index: number;
49
+ distance: number;
50
+ }[] | undefined): void {
51
+ if (this.#midPointInsertionActive === true) {
52
+ if (distances) {
53
+ // finish mid point insertion if it is the current index
54
+ if (distances[0].index === this.#midPointInsertionIndex) {
55
+ this.#geometryState.makePointPersistent(this.#midPointInsertionIndex, false);
56
+ this.#midPointInsertionActive = false;
57
+ this.#midPointInsertionIndex = -1;
58
+ }
59
+ }
60
+ }
61
+ }
62
+
63
+ public onMove(ray: IRay, hoveredPoint?: number): void {
64
+ if (this.#midPointInsertionActive === true && hoveredPoint === this.#midPointInsertionIndex) {
65
+ // we are just waiting for a mouse click to finish the mid point insertion
66
+ } else if (hoveredPoint === undefined && this.#geometryState.canAddPoint()) {
67
+ // check if there is a line close to the ray and add a mid point to it
68
+ const lineDistances = this.#geometryMathManager.checkLineDistances(ray);
69
+ if (lineDistances) {
70
+ let firstIndex = lineDistances[0].index[0];
71
+ let secondIndex = lineDistances[0].index[1];
72
+
73
+ if (this.#midPointInsertionActive === true && firstIndex !== this.#midPointInsertionIndex && secondIndex !== this.#midPointInsertionIndex) {
74
+ // remove last added point
75
+ this.#drawingToolsManager.removePointTemporary(this.#midPointInsertionIndex);
76
+ this.#midPointInsertionActive = false;
77
+ this.#midPointInsertionIndex = -1;
78
+
79
+ // move indices one back if they are after the removal index
80
+ if (firstIndex > this.#midPointInsertionIndex) {
81
+ firstIndex--;
82
+
83
+ if (firstIndex < 0)
84
+ firstIndex = this.#geometryState.getPointCount() - 1;
85
+ }
86
+
87
+ // move indices one back if they are after the removal index
88
+ if (secondIndex > this.#midPointInsertionIndex || secondIndex === 0) {
89
+ secondIndex--;
90
+
91
+ if (secondIndex < 0)
92
+ secondIndex = this.#geometryState.getPointCount() - 1;
93
+ }
94
+ }
95
+
96
+ if (this.#midPointInsertionActive === false) {
97
+ const firstPoint = this.#geometryState.getPosition(firstIndex);
98
+ const secondPoint = this.#geometryState.getPosition(secondIndex);
99
+ const midPoint = vec3.add(vec3.create(), firstPoint, secondPoint);
100
+ vec3.scale(midPoint, midPoint, 0.5);
101
+
102
+ this.#midPointInsertionIndex = secondIndex;
103
+
104
+ this.#drawingToolsManager.addPointTemporary(secondIndex, midPoint);
105
+ this.#drawingToolsManager.updateMaterialIndex(secondIndex, MATERIAL_INDEX.INSERTION);
106
+
107
+ this.#midPointInsertionActive = true;
108
+ }
109
+ } else {
110
+ this.stopMidPointInsertion();
111
+ }
112
+ } else {
113
+ this.stopMidPointInsertion();
114
+ }
115
+ }
116
+
117
+ public stopMidPointInsertion(): void {
118
+ if (this.#midPointInsertionActive === true) {
119
+ // remove last added point
120
+ this.#drawingToolsManager.removePointTemporary(this.#midPointInsertionIndex);
121
+ this.#midPointInsertionActive = false;
122
+ this.#midPointInsertionIndex = -1;
123
+ }
124
+ }
125
+
126
+ // #endregion Public Methods (3)
127
+ }
@@ -0,0 +1,411 @@
1
+ import { addListener } from '@shapediver/viewer';
2
+ import { DrawingToolsManager } from '../../../DrawingToolsManager';
3
+ import { EventEngine, EVENTTYPE_DRAWING_TOOLS } from '@shapediver/viewer.shared.services';
4
+ import { GeometryMathManager } from '../../geometry/GeometryMathManager';
5
+ import { GeometryState } from '../../geometry/GeometryState';
6
+ import { InteractionManager } from '../InteractionManager';
7
+ import { IRay } from '@shapediver/viewer.features.interaction';
8
+ import { MATERIAL_INDEX, Settings } from '../../../../interfaces/IDrawingToolsManager';
9
+ import { vec3 } from 'gl-matrix';
10
+
11
+ export class InteractionManagerHelper {
12
+ // #region Properties (17)
13
+
14
+ readonly #drawingToolsManager: DrawingToolsManager;
15
+ readonly #eventEngine = EventEngine.instance;
16
+ readonly #geometryMathManager: GeometryMathManager;
17
+ readonly #geometryState: GeometryState;
18
+ readonly #interactionManager: InteractionManager;
19
+ readonly #settings: Settings;
20
+
21
+ #draggedPoint?: number;
22
+ #draggedPointPosition: vec3 = vec3.create();
23
+ #dragging: boolean = false;
24
+ #hoveredPoint?: number;
25
+ #justSelected: boolean = false;
26
+ #lastRay: IRay | undefined;
27
+ #midPointInserted: boolean = false;
28
+ #moving: boolean = false;
29
+ #selectedMovedPointPositions: vec3[] = [];
30
+ #selectedPointIndices: number[] = [];
31
+ #selectedPointPositions: vec3[] = [];
32
+
33
+ // #endregion Properties (17)
34
+
35
+ // #region Constructors (1)
36
+
37
+ constructor(drawingToolsManager: DrawingToolsManager, interactionManager: InteractionManager) {
38
+ this.#drawingToolsManager = drawingToolsManager;
39
+ this.#interactionManager = interactionManager;
40
+ this.#geometryState = this.#drawingToolsManager.geometryState;
41
+ this.#geometryMathManager = this.#drawingToolsManager.geometryMathManager;
42
+ this.#settings = this.#drawingToolsManager.settings;
43
+
44
+ addListener(EVENTTYPE_DRAWING_TOOLS.GEOMETRY_CHANGED, () => {
45
+ this.removeAllSelectedPoints();
46
+ });
47
+ }
48
+
49
+ // #endregion Constructors (1)
50
+
51
+ // #region Public Getters And Setters (7)
52
+
53
+ public get dragging(): boolean {
54
+ return this.#dragging;
55
+ }
56
+
57
+ public get hoveredPoint(): number | undefined {
58
+ return this.#hoveredPoint;
59
+ }
60
+
61
+ public get midPointInserted(): boolean {
62
+ return this.#midPointInserted;
63
+ }
64
+
65
+ public set midPointInserted(value: boolean) {
66
+ this.#midPointInserted = value;
67
+ }
68
+
69
+ public get moving(): boolean {
70
+ return this.#moving;
71
+ }
72
+
73
+ public set moving(value: boolean) {
74
+ this.#moving = value;
75
+ }
76
+
77
+ public get selectedPointIndices(): number[] {
78
+ return this.#selectedPointIndices;
79
+ }
80
+
81
+ // #endregion Public Getters And Setters (7)
82
+
83
+ // #region Public Methods (10)
84
+
85
+ /**
86
+ * A point was added so we have to move the selected indices one forward if they are after the insertion index
87
+ *
88
+ * @param insertionIndex
89
+ */
90
+ public addPoint(insertionIndex: number): void {
91
+ // move index if it is the hovered index
92
+ if (this.#hoveredPoint !== undefined && this.#hoveredPoint >= insertionIndex) {
93
+ if (this.#selectedPointIndices.includes(this.#hoveredPoint)) {
94
+ this.#drawingToolsManager.updateMaterialIndex(this.#hoveredPoint, MATERIAL_INDEX.SELECTED);
95
+ } else if (this.#interactionManager.midPointInteractionHandler.midPointInsertionIndex === insertionIndex) {
96
+ this.#drawingToolsManager.updateMaterialIndex(this.#hoveredPoint, MATERIAL_INDEX.INSERTION);
97
+ } else {
98
+ this.#drawingToolsManager.updateMaterialIndex(this.#hoveredPoint, MATERIAL_INDEX.DEFAULT);
99
+ }
100
+
101
+ this.#hoveredPoint++;
102
+
103
+ if (this.#selectedPointIndices.includes(this.#hoveredPoint)) {
104
+ this.#drawingToolsManager.updateMaterialIndex(this.#hoveredPoint, MATERIAL_INDEX.SELECTED_HOVERED);
105
+ } else if (this.#interactionManager.midPointInteractionHandler.midPointInsertionIndex === this.#hoveredPoint) {
106
+ this.#drawingToolsManager.updateMaterialIndex(this.#hoveredPoint, MATERIAL_INDEX.INSERTION_HOVERED);
107
+ } else {
108
+ this.#drawingToolsManager.updateMaterialIndex(this.#hoveredPoint, MATERIAL_INDEX.HOVERED);
109
+ }
110
+ }
111
+
112
+ // move selected indices one forward if they are after the insertion index
113
+ this.#selectedPointIndices.forEach((element, i) => {
114
+ this.#selectedPointIndices[i] = element >= insertionIndex ? element + 1 : element;
115
+ });
116
+ }
117
+
118
+ /**
119
+ * Check if there is a point close to the ray and update the hovered point
120
+ *
121
+ * @param event
122
+ * @param ray
123
+ * @returns
124
+ */
125
+ public checkHover(distances?: { index: number; distance: number; }[], ray?: IRay): void {
126
+ if (!ray && !this.#lastRay) return;
127
+ if (!ray) ray = this.#lastRay!;
128
+ this.#lastRay = ray;
129
+
130
+ // check if there is a point close to the ray
131
+ if (distances) {
132
+ // add the id if it is not already in the array
133
+ // remove it if it is in the array
134
+ const index = distances[0].index;
135
+
136
+ if (this.#hoveredPoint !== undefined && this.#hoveredPoint === index) return;
137
+ if (this.#hoveredPoint !== undefined) {
138
+ if (this.#selectedPointIndices.includes(this.#hoveredPoint)) {
139
+ this.#drawingToolsManager.updateMaterialIndex(this.#hoveredPoint, MATERIAL_INDEX.SELECTED);
140
+ } else if (this.#interactionManager.midPointInteractionHandler.midPointInsertionIndex === index) {
141
+ this.#drawingToolsManager.updateMaterialIndex(this.#hoveredPoint, MATERIAL_INDEX.INSERTION);
142
+ } else if (this.#interactionManager.insertionInteractionHandler.insertionActive === true && this.#interactionManager.insertionInteractionHandler.alreadyInserted === true && this.#hoveredPoint === this.#geometryState.getPointCount() - 1) {
143
+ this.#drawingToolsManager.updateMaterialIndex(this.#hoveredPoint, MATERIAL_INDEX.INSERTION);
144
+ } else {
145
+ this.#drawingToolsManager.updateMaterialIndex(this.#hoveredPoint, MATERIAL_INDEX.DEFAULT);
146
+ }
147
+ }
148
+
149
+ if (this.#selectedPointIndices.includes(index)) {
150
+ this.#drawingToolsManager.updateMaterialIndex(index, MATERIAL_INDEX.SELECTED_HOVERED);
151
+ } else if (this.#interactionManager.midPointInteractionHandler.midPointInsertionIndex === index) {
152
+ this.#drawingToolsManager.updateMaterialIndex(index, MATERIAL_INDEX.INSERTION_HOVERED);
153
+ } else if (this.#interactionManager.insertionInteractionHandler.insertionActive === true && this.#interactionManager.insertionInteractionHandler.alreadyInserted === true && index === this.#geometryState.getPointCount() - 1) {
154
+ this.#drawingToolsManager.updateMaterialIndex(index, MATERIAL_INDEX.INSERTION_HOVERED);
155
+ } else {
156
+ this.#drawingToolsManager.updateMaterialIndex(index, MATERIAL_INDEX.HOVERED);
157
+ }
158
+
159
+ this.#hoveredPoint = index;
160
+ } else {
161
+ // remove the hovered point if there is no point close to the ray
162
+ if (this.#hoveredPoint !== undefined) {
163
+ if (this.#selectedPointIndices.includes(this.#hoveredPoint)) {
164
+ this.#drawingToolsManager.updateMaterialIndex(this.#hoveredPoint, MATERIAL_INDEX.SELECTED);
165
+ } else if (this.#interactionManager.midPointInteractionHandler.midPointInsertionIndex === this.#hoveredPoint) {
166
+ this.#drawingToolsManager.updateMaterialIndex(this.#hoveredPoint, MATERIAL_INDEX.INSERTION);
167
+ } else if (this.#interactionManager.insertionInteractionHandler.insertionActive === true && this.#interactionManager.insertionInteractionHandler.alreadyInserted === true && this.#hoveredPoint === this.#geometryState.getPointCount() - 1) {
168
+ this.#drawingToolsManager.updateMaterialIndex(this.#hoveredPoint, MATERIAL_INDEX.INSERTION_HOVERED);
169
+ } else {
170
+ this.#drawingToolsManager.updateMaterialIndex(this.#hoveredPoint, MATERIAL_INDEX.DEFAULT);
171
+ }
172
+ }
173
+ this.#hoveredPoint = undefined;
174
+ }
175
+ }
176
+
177
+ public close(): void {
178
+ this.#selectedPointIndices = [];
179
+ this.#hoveredPoint = undefined;
180
+ this.#draggedPoint = undefined;
181
+ this.#dragging = false;
182
+ this.#selectedPointPositions = [];
183
+ this.#selectedMovedPointPositions = [];
184
+ this.#draggedPointPosition = vec3.create();
185
+ }
186
+
187
+ public moveSelectedPoints(ray: IRay): void {
188
+ if (this.#selectedPointIndices.length > 0 && this.#dragging) {
189
+ this.#drawingToolsManager.restrictionManager.showRestrictionVisualization = true;
190
+
191
+ const intersectionPoint = this.#drawingToolsManager.restrictionManager.rayTrace(ray, {
192
+ index: this.#draggedPoint!,
193
+ referencePoint: this.#draggedPointPosition
194
+ });
195
+
196
+ if (intersectionPoint) {
197
+ const differenceToIntersected = vec3.sub(vec3.create(), intersectionPoint, this.#draggedPointPosition);
198
+
199
+ for (let i = 0; i < this.#selectedPointIndices.length; i++) {
200
+ const isLastPoint = this.#selectedPointIndices.length === 1 && this.#selectedPointIndices[0] === this.#geometryState.getPointCount() - 1;
201
+ const canBeClosed = this.#geometryState.getPointCount() > 3 && this.#geometryState.checkNumberOfPoints(this.#geometryState.getPointCount() - 1);
202
+ const shouldBeClosed = this.#settings.geometry.close === true && this.#geometryState.closeLoop === false && this.#settings.geometry.autoClose === false;
203
+
204
+ if (isLastPoint && canBeClosed && shouldBeClosed) {
205
+ // if restricted point is close to the first point, remove the current insertion point and draw a line to the first point
206
+ const firstPoint = this.#geometryState.getPosition(0);
207
+ const lastPoint = intersectionPoint;
208
+
209
+ if (lastPoint && this.#geometryMathManager.screenSpaceDistanceCheck(firstPoint, lastPoint, this.#settings.visualization.points.size_0! * this.#settings.visualization.distanceMultiplicationFactor).check === true) {
210
+ // close the geometry
211
+ this.#selectedMovedPointPositions[i] = vec3.clone(firstPoint);
212
+ this.#drawingToolsManager.movePointTemporary(this.#selectedPointIndices[i], firstPoint);
213
+ } else {
214
+ // not close enough to close the geometry
215
+ this.#selectedMovedPointPositions[i] = vec3.add(vec3.create(), differenceToIntersected, this.#selectedPointPositions[i]);
216
+ this.#drawingToolsManager.movePointTemporary(this.#selectedPointIndices[i], this.#selectedMovedPointPositions[i]);
217
+ }
218
+ } else {
219
+ // add difference to selected point
220
+ this.#selectedMovedPointPositions[i] = vec3.add(vec3.create(), differenceToIntersected, this.#selectedPointPositions[i]);
221
+ this.#drawingToolsManager.movePointTemporary(this.#selectedPointIndices[i], this.#selectedMovedPointPositions[i]);
222
+ }
223
+ }
224
+
225
+ this.#eventEngine.emitEvent(EVENTTYPE_DRAWING_TOOLS.DRAG_MOVE, { viewportId: this.#drawingToolsManager.viewport.id, drawingToolsId: this.#drawingToolsManager.uuid });
226
+ }
227
+ }
228
+ }
229
+
230
+ public onOut(): void {
231
+ if (this.#dragging === true) {
232
+ // reset all selected points to their original position
233
+ this.#selectedPointIndices.forEach((element, i) => {
234
+ this.#drawingToolsManager.movePointTemporary(element, this.#selectedPointPositions[i]);
235
+ });
236
+
237
+ // reset the dragged point position
238
+ this.#drawingToolsManager.movePointTemporary(this.#draggedPoint!, this.#draggedPointPosition);
239
+ }
240
+
241
+ // remove the hovered point and the selected points
242
+ this.removeAllSelectedPoints();
243
+ }
244
+
245
+ public onUp(): void {
246
+ if (this.#moving === true && this.#dragging === true) {
247
+ const selectedPointIndices = this.#selectedPointIndices.slice();
248
+ for (let i = 0; i < this.#selectedPointIndices.length; i++)
249
+ this.#geometryState.makePointPersistent(this.#selectedPointIndices[i], false);
250
+
251
+ /**
252
+ * Check if the geometry should be closed
253
+ */
254
+ const isLastPoint = selectedPointIndices.length === 1 && selectedPointIndices[0] === this.#geometryState.getPointCount() - 1;
255
+ const canBeClosed = this.#geometryState.getPointCount() > 3 && this.#geometryState.checkNumberOfPoints(this.#geometryState.getPointCount() - 1);
256
+ const shouldBeClosed = this.#settings.geometry.close === true && this.#geometryState.closeLoop === false && this.#settings.geometry.autoClose === false;
257
+
258
+ if (isLastPoint && canBeClosed && shouldBeClosed) {
259
+ // if restricted point is close to the first point, remove the current insertion point and draw a line to the first point
260
+ const firstPoint = this.#geometryState.getPosition(0);
261
+ const lastPoint = this.#selectedMovedPointPositions[0];
262
+
263
+ if (lastPoint && this.#geometryMathManager.screenSpaceDistanceCheck(firstPoint, lastPoint, this.#settings.visualization.points.size_0! * this.#settings.visualization.distanceMultiplicationFactor).check === true) {
264
+ // close the geometry
265
+ this.#geometryState.closeLoop = true;
266
+ this.#drawingToolsManager.removePoint(selectedPointIndices[0]);
267
+ }
268
+ }
269
+ this.removeAllSelectedPoints();
270
+
271
+ this.#eventEngine.emitEvent(EVENTTYPE_DRAWING_TOOLS.GEOMETRY_CHANGED, {
272
+ points: this.#geometryState.getPointsData(),
273
+ temporary: false,
274
+ fromHistory: false
275
+ });
276
+
277
+ this.#eventEngine.emitEvent(EVENTTYPE_DRAWING_TOOLS.DRAG_END, { viewportId: this.#drawingToolsManager.viewport.id, drawingToolsId: this.#drawingToolsManager.uuid });
278
+ } else if (this.#hoveredPoint !== undefined && this.#selectedPointIndices.includes(this.#hoveredPoint)) {
279
+ if (this.#justSelected === this.#moving)
280
+ this.toggleSelection(this.#hoveredPoint);
281
+
282
+ if (this.#midPointInserted) {
283
+ /**
284
+ * SPECIAL CASE:
285
+ * - A MIDPOINT WAS ADDED, BUT NOT DRAGGED
286
+ * - HAS TO BE ADDED TO THE HISTORY NOW
287
+ */
288
+ this.#eventEngine.emitEvent(EVENTTYPE_DRAWING_TOOLS.GEOMETRY_CHANGED, {
289
+ points: this.#geometryState.getPointsData(),
290
+ temporary: false
291
+ });
292
+ }
293
+ }
294
+ }
295
+
296
+ /**
297
+ * A point was removed so we have to move the selected indices one back if they are after the removal index
298
+ *
299
+ * @param removalIndex
300
+ */
301
+ public removePoint(removalIndex: number): void {
302
+ // remove index if it is the hovered index
303
+ if (this.#hoveredPoint === removalIndex) {
304
+ this.#hoveredPoint = undefined;
305
+ }
306
+
307
+ if (this.#hoveredPoint !== undefined && this.#hoveredPoint > removalIndex) {
308
+ this.#hoveredPoint--;
309
+ }
310
+
311
+ // remove index from selected indices
312
+ const indexInArray = this.#selectedPointIndices.indexOf(removalIndex);
313
+ if (indexInArray !== -1) {
314
+ this.#selectedPointIndices.splice(indexInArray, 1);
315
+ }
316
+
317
+ // move selected indices one back if they are after the removal index
318
+ this.#selectedPointIndices.forEach((element, i) => {
319
+ this.#selectedPointIndices[i] = element > removalIndex ? element - 1 : element;
320
+ });
321
+ }
322
+
323
+ public reset(): void {
324
+ this.#justSelected = false;
325
+ this.#midPointInserted = false;
326
+ this.#moving = false;
327
+ this.#dragging = false;
328
+ this.#selectedPointPositions = [];
329
+ this.#selectedMovedPointPositions = [];
330
+ }
331
+
332
+ public selectPoint(distances: {
333
+ index: number;
334
+ distance: number;
335
+ }[] | undefined): void {
336
+ if (distances) {
337
+ // add the id if it is not already in the array
338
+ // remove it if it is in the array
339
+ if (!this.#selectedPointIndices.includes(distances[0].index)) {
340
+ this.toggleSelection(distances[0].index);
341
+ this.#justSelected = true;
342
+ }
343
+ }
344
+ }
345
+
346
+ public startDragging(ray: IRay): boolean {
347
+ if (this.#selectedPointIndices.length > 0 && this.#hoveredPoint !== undefined && this.#selectedPointIndices.includes(this.#hoveredPoint)) {
348
+ const draggedPoint = this.#geometryState.getPosition(this.#hoveredPoint);
349
+
350
+ // store drag start
351
+ const intersectionPoint = this.#drawingToolsManager.restrictionManager.rayTrace(ray, {
352
+ index: this.#hoveredPoint,
353
+ referencePoint: draggedPoint
354
+ });
355
+
356
+ if (intersectionPoint) {
357
+ // store selected point positions
358
+ this.#selectedPointIndices.forEach(element =>
359
+ this.#selectedPointPositions.push(this.#geometryState.getPosition(element))
360
+ );
361
+
362
+ // copy values into selected moved point positions
363
+ this.#selectedMovedPointPositions = this.#selectedPointPositions.map(element => vec3.clone(element));
364
+
365
+ this.#draggedPointPosition = this.#geometryState.getPosition(this.#hoveredPoint);
366
+
367
+ this.#draggedPoint = this.#hoveredPoint;
368
+
369
+ this.#dragging = true;
370
+ this.#eventEngine.emitEvent(EVENTTYPE_DRAWING_TOOLS.DRAG_START, { viewportId: this.#drawingToolsManager.viewport.id, drawingToolsId: this.#drawingToolsManager.uuid });
371
+
372
+ return true;
373
+ }
374
+ }
375
+ return false;
376
+ }
377
+
378
+ // #endregion Public Methods (10)
379
+
380
+ // #region Private Methods (2)
381
+
382
+ /**
383
+ * Remove all selected points
384
+ */
385
+ private removeAllSelectedPoints(): void {
386
+ while (this.#selectedPointIndices.length > 0)
387
+ this.toggleSelection(this.#selectedPointIndices[0]);
388
+ }
389
+
390
+ /**
391
+ * Select a point, deselect it if it is already selected
392
+ *
393
+ * @param index
394
+ */
395
+ private toggleSelection(index: number): void {
396
+ // add the id if it is not already in the array
397
+ // remove it if it is in the array
398
+ const indexInArray = this.#selectedPointIndices.indexOf(index);
399
+ if (indexInArray === -1) {
400
+ this.#selectedPointIndices.push(index);
401
+ this.#drawingToolsManager.updateMaterialIndex(index, this.#hoveredPoint === index ? MATERIAL_INDEX.SELECTED_HOVERED : MATERIAL_INDEX.SELECTED);
402
+ this.#eventEngine.emitEvent(EVENTTYPE_DRAWING_TOOLS.SELECTED, { viewportId: this.#drawingToolsManager.viewport.id, drawingToolsId: this.#drawingToolsManager.uuid, index });
403
+ } else {
404
+ this.#selectedPointIndices.splice(indexInArray, 1);
405
+ this.#drawingToolsManager.updateMaterialIndex(index, this.#hoveredPoint === index ? MATERIAL_INDEX.HOVERED : MATERIAL_INDEX.DEFAULT);
406
+ this.#eventEngine.emitEvent(EVENTTYPE_DRAWING_TOOLS.DESELECTED, { viewportId: this.#drawingToolsManager.viewport.id, drawingToolsId: this.#drawingToolsManager.uuid, index });
407
+ }
408
+ }
409
+
410
+ // #endregion Private Methods (2)
411
+ }
@@ -0,0 +1,99 @@
1
+ import * as THREE from 'three';
2
+ import { DrawingToolsManager } from '../../../DrawingToolsManager';
3
+ import { IRestrictionBase } from '../../../../interfaces/IRestrictionBase';
4
+ import { ITreeNode, TreeNode } from '@shapediver/viewer.shared.node-tree';
5
+ import { IViewportApi } from '@shapediver/viewer';
6
+ import { ThreejsData } from '@shapediver/viewer.rendering-engine.rendering-engine-threejs';
7
+
8
+ export abstract class AbstractRestriction implements IRestrictionBase {
9
+ // #region Properties (8)
10
+
11
+ readonly #id: string;
12
+ readonly #parentNode: ITreeNode;
13
+ readonly #viewport: IViewportApi;
14
+ readonly #visualizationNode: TreeNode = new TreeNode('RestrictionVisualizationNode');
15
+
16
+ #showVisualization: boolean = false;
17
+
18
+ protected _enabled: boolean = true;
19
+ protected _enabledEditable: boolean = true;
20
+ protected _object3D!: THREE.Object3D;
21
+
22
+ // #endregion Properties (8)
23
+
24
+ // #region Constructors (1)
25
+
26
+ constructor(drawingToolsManager: DrawingToolsManager, id: string) {
27
+ this.#parentNode = drawingToolsManager.parentNode;
28
+ this.#viewport = drawingToolsManager.viewport;
29
+ this.#id = id;
30
+ this.createGridHelperObject();
31
+ }
32
+
33
+ // #endregion Constructors (1)
34
+
35
+ // #region Public Getters And Setters (5)
36
+
37
+ public get enabled(): boolean {
38
+ return this._enabled;
39
+ }
40
+
41
+ public set enabled(value: boolean) {
42
+ if (this._enabledEditable === false) return;
43
+
44
+ this._enabled = value;
45
+ this.visibilityChanged(this._object3D.visible);
46
+ }
47
+
48
+ public get id(): string {
49
+ return this.#id;
50
+ }
51
+
52
+ public get showVisualization(): boolean {
53
+ return this.#showVisualization;
54
+ }
55
+
56
+ public set showVisualization(value: boolean) {
57
+ this.#showVisualization = value;
58
+ this._object3D.visible = value;
59
+ this.visibilityChanged(this._object3D.visible);
60
+ }
61
+
62
+ // #endregion Public Getters And Setters (5)
63
+
64
+ // #region Public Methods (1)
65
+
66
+ public removeVisualization(): void {
67
+ this.#parentNode.removeChild(this.#visualizationNode);
68
+ this.#parentNode.updateVersion(false, false);
69
+ this.#viewport.updateNode(this.#parentNode);
70
+ }
71
+
72
+ // #endregion Public Methods (1)
73
+
74
+ // #region Protected Abstract Methods (1)
75
+
76
+ protected abstract visibilityChanged(visible: boolean): void;
77
+
78
+ // #endregion Protected Abstract Methods (1)
79
+
80
+ // #region Private Methods (2)
81
+
82
+ private createGridHelperObject(): void {
83
+ this._object3D = new THREE.Object3D();
84
+ this._object3D.visible = false;
85
+
86
+ const node = new TreeNode('ThreeJsDataNode');
87
+
88
+ const data = new ThreejsData(this._object3D);
89
+ node.addData(data);
90
+
91
+ this.#visualizationNode.addChild(node);
92
+ this.#visualizationNode.updateVersion();
93
+ this.#parentNode.addChild(this.#visualizationNode);
94
+ this.#parentNode.updateVersion(false, false);
95
+ this.#viewport.updateNode(this.#parentNode);
96
+ }
97
+
98
+ // #endregion Private Methods (2)
99
+ }