@2112-lab/central-plant 0.1.39 → 0.1.41
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/dist/bundle/index.js +7991 -7054
- package/dist/cjs/src/core/centralPlant.js +48 -3
- package/dist/cjs/src/core/centralPlantInternals.js +75 -566
- package/dist/cjs/src/core/sceneViewer.js +38 -13
- package/dist/cjs/src/index.js +6 -4
- package/dist/cjs/src/managers/components/pathfindingManager.js +75 -60
- package/dist/cjs/src/managers/components/transformOperationsManager.js +929 -0
- package/dist/cjs/src/managers/controls/keyboardControlsManager.js +57 -1
- package/dist/cjs/src/managers/controls/transformControls.js +11 -3
- package/dist/cjs/src/managers/controls/transformControlsManager.js +563 -263
- package/dist/cjs/src/managers/pathfinding/ConnectorManager.js +385 -0
- package/dist/cjs/src/managers/pathfinding/PathIntersectionDetector.js +387 -0
- package/dist/cjs/src/managers/pathfinding/PathRenderingManager.js +401 -0
- package/dist/cjs/src/managers/pathfinding/pathfindingManager.js +378 -0
- package/dist/cjs/src/managers/pathfinding/sceneDataManager.js +256 -0
- package/dist/cjs/src/managers/scene/animationManager.js +145 -0
- package/dist/cjs/src/managers/scene/sceneExportManager.js +14 -13
- package/dist/cjs/src/managers/scene/sceneOperationsManager.js +516 -21
- package/dist/cjs/src/managers/scene/sceneTooltipsManager.js +1 -8
- package/dist/cjs/src/managers/system/operationHistoryManager.js +414 -0
- package/dist/cjs/src/managers/system/settingsManager.js +2 -1
- package/dist/cjs/src/utils/objectTypes.js +5 -7
- package/dist/esm/src/core/centralPlant.js +48 -3
- package/dist/esm/src/core/centralPlantInternals.js +76 -567
- package/dist/esm/src/core/sceneViewer.js +38 -13
- package/dist/esm/src/index.js +4 -3
- package/dist/esm/src/managers/components/pathfindingManager.js +75 -60
- package/dist/esm/src/managers/components/transformOperationsManager.js +904 -0
- package/dist/esm/src/managers/controls/keyboardControlsManager.js +57 -1
- package/dist/esm/src/managers/controls/transformControls.js +11 -3
- package/dist/esm/src/managers/controls/transformControlsManager.js +564 -264
- package/dist/esm/src/managers/pathfinding/ConnectorManager.js +361 -0
- package/dist/esm/src/managers/pathfinding/PathIntersectionDetector.js +363 -0
- package/dist/esm/src/managers/pathfinding/PathRenderingManager.js +377 -0
- package/dist/esm/src/managers/pathfinding/pathfindingManager.js +374 -0
- package/dist/esm/src/managers/pathfinding/sceneDataManager.js +232 -0
- package/dist/esm/src/managers/scene/animationManager.js +141 -0
- package/dist/esm/src/managers/scene/sceneExportManager.js +14 -13
- package/dist/esm/src/managers/scene/sceneOperationsManager.js +516 -21
- package/dist/esm/src/managers/scene/sceneTooltipsManager.js +1 -8
- package/dist/esm/src/managers/system/operationHistoryManager.js +409 -0
- package/dist/esm/src/managers/system/settingsManager.js +2 -1
- package/dist/esm/src/utils/objectTypes.js +5 -7
- package/dist/index.d.ts +2 -2
- package/package.json +1 -1
|
@@ -249,8 +249,19 @@ var sceneViewer = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
249
249
|
var _this3 = this;
|
|
250
250
|
// Prevent duplicate handlers
|
|
251
251
|
if (this._resizeHandlerSetup) return;
|
|
252
|
+
|
|
253
|
+
// Debounce timer for resize events
|
|
254
|
+
var resizeTimeout = null;
|
|
252
255
|
var resizeHandler = function resizeHandler() {
|
|
253
|
-
|
|
256
|
+
// Clear any pending resize
|
|
257
|
+
if (resizeTimeout) {
|
|
258
|
+
clearTimeout(resizeTimeout);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// Debounce resize to prevent excessive calls
|
|
262
|
+
resizeTimeout = setTimeout(function () {
|
|
263
|
+
_this3.handleResize();
|
|
264
|
+
}, 100); // 100ms debounce delay
|
|
254
265
|
};
|
|
255
266
|
window.addEventListener('resize', resizeHandler);
|
|
256
267
|
this._resizeHandlerSetup = true;
|
|
@@ -269,17 +280,33 @@ var sceneViewer = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
269
280
|
var width = this.container.clientWidth;
|
|
270
281
|
var height = this.container.clientHeight;
|
|
271
282
|
|
|
283
|
+
// Validate dimensions to prevent invalid resize
|
|
284
|
+
if (width <= 0 || height <= 0) {
|
|
285
|
+
console.warn('⚠️ Invalid resize dimensions:', {
|
|
286
|
+
width: width,
|
|
287
|
+
height: height
|
|
288
|
+
});
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
|
|
272
292
|
// Update camera aspect ratio
|
|
273
293
|
this.camera.aspect = width / height;
|
|
274
294
|
this.camera.updateProjectionMatrix();
|
|
275
295
|
|
|
276
|
-
// Update renderer size
|
|
277
|
-
this.renderer.setSize(width, height);
|
|
296
|
+
// Update renderer size (updateStyle=true to sync canvas CSS)
|
|
297
|
+
this.renderer.setSize(width, height, true);
|
|
298
|
+
|
|
299
|
+
// Force renderer to clear and re-render to prevent blank screen
|
|
300
|
+
this.renderer.clear();
|
|
278
301
|
|
|
279
302
|
// Update tooltips manager if available
|
|
280
303
|
if (this.tooltipsManager) {
|
|
281
304
|
this.tooltipsManager.resize();
|
|
282
305
|
}
|
|
306
|
+
console.log('🔄 Window resized:', {
|
|
307
|
+
width: width,
|
|
308
|
+
height: height
|
|
309
|
+
});
|
|
283
310
|
}
|
|
284
311
|
|
|
285
312
|
/**
|
|
@@ -570,20 +597,18 @@ var sceneViewer = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
570
597
|
}, {
|
|
571
598
|
key: "isSelectableObject",
|
|
572
599
|
value: function isSelectableObject(object) {
|
|
573
|
-
var _object$userData
|
|
600
|
+
var _object$userData;
|
|
574
601
|
if (object.type == "TransformControlsPlane") {
|
|
575
602
|
object = object.object;
|
|
576
603
|
}
|
|
577
604
|
|
|
578
|
-
// Allow pipe segments
|
|
579
|
-
|
|
580
|
-
var isPipeJunction = ((_object$userData2 = object.userData) === null || _object$userData2 === void 0 ? void 0 : _object$userData2.isPipeJunction) === true;
|
|
581
|
-
if (isPipeSegment) {
|
|
605
|
+
// Allow pipe segments to be selected
|
|
606
|
+
if (((_object$userData = object.userData) === null || _object$userData === void 0 ? void 0 : _object$userData.objectType) === "segment") {
|
|
582
607
|
return true;
|
|
583
608
|
}
|
|
584
609
|
|
|
585
610
|
// Exclude regular polyline parent objects (pipe paths) from selection
|
|
586
|
-
if (object.name && object.name.toLowerCase().includes("polyline")
|
|
611
|
+
if (object.name && object.name.toLowerCase().includes("polyline")) {
|
|
587
612
|
return false;
|
|
588
613
|
}
|
|
589
614
|
|
|
@@ -635,7 +660,7 @@ var sceneViewer = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
635
660
|
}, {
|
|
636
661
|
key: "selectObject",
|
|
637
662
|
value: function selectObject(object) {
|
|
638
|
-
var _object$
|
|
663
|
+
var _object$userData2;
|
|
639
664
|
if (!object || !object.uuid) {
|
|
640
665
|
console.warn('⚠️ Cannot select invalid object');
|
|
641
666
|
return false;
|
|
@@ -646,7 +671,7 @@ var sceneViewer = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
646
671
|
|
|
647
672
|
// Emit selection event with component details
|
|
648
673
|
var componentId = object.name || object.uuid;
|
|
649
|
-
var objectType = ((_object$
|
|
674
|
+
var objectType = ((_object$userData2 = object.userData) === null || _object$userData2 === void 0 ? void 0 : _object$userData2.objectType) || 'component';
|
|
650
675
|
this.emit('component-selected', {
|
|
651
676
|
id: componentId,
|
|
652
677
|
uuid: object.uuid,
|
|
@@ -667,8 +692,8 @@ var sceneViewer = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
667
692
|
var fullCleanup = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
668
693
|
if (this.transformManager) {
|
|
669
694
|
if (fullCleanup) {
|
|
670
|
-
// First deselect any
|
|
671
|
-
if (this.transformManager.
|
|
695
|
+
// First deselect any objects
|
|
696
|
+
if (this.transformManager.selectedObjects && this.transformManager.selectedObjects.length > 0) {
|
|
672
697
|
this.transformManager.deselectObject();
|
|
673
698
|
}
|
|
674
699
|
|
package/dist/cjs/src/index.js
CHANGED
|
@@ -13,8 +13,9 @@ var sceneExportManager = require('./managers/scene/sceneExportManager.js');
|
|
|
13
13
|
var sceneTooltipsManager = require('./managers/scene/sceneTooltipsManager.js');
|
|
14
14
|
var sceneHierarchyManager = require('./managers/scene/sceneHierarchyManager.js');
|
|
15
15
|
var componentManager = require('./managers/components/componentManager.js');
|
|
16
|
-
var animationManager = require('./managers/
|
|
17
|
-
var pathfindingManager = require('./managers/
|
|
16
|
+
var animationManager = require('./managers/scene/animationManager.js');
|
|
17
|
+
var pathfindingManager = require('./managers/pathfinding/pathfindingManager.js');
|
|
18
|
+
var PathIntersectionDetector = require('./managers/pathfinding/PathIntersectionDetector.js');
|
|
18
19
|
var componentDataManager = require('./managers/components/componentDataManager.js');
|
|
19
20
|
var transformControlsManager = require('./managers/controls/transformControlsManager.js');
|
|
20
21
|
var keyboardControlsManager = require('./managers/controls/keyboardControlsManager.js');
|
|
@@ -24,7 +25,7 @@ var environmentManager = require('./managers/environment/environmentManager.js')
|
|
|
24
25
|
var textureConfig = require('./managers/environment/textureConfig.js');
|
|
25
26
|
var threeJSResourceManager = require('./managers/system/threeJSResourceManager.js');
|
|
26
27
|
var performanceMonitorManager = require('./managers/system/performanceMonitorManager.js');
|
|
27
|
-
var
|
|
28
|
+
var operationHistoryManager = require('./managers/system/operationHistoryManager.js');
|
|
28
29
|
var modelManager = require('./managers/scene/modelManager.js');
|
|
29
30
|
var modelPreloader = require('./rendering/modelPreloader.js');
|
|
30
31
|
var rendering2D = require('./rendering/rendering2D.js');
|
|
@@ -60,6 +61,7 @@ exports.SceneHierarchyManager = sceneHierarchyManager.SceneHierarchyManager;
|
|
|
60
61
|
exports.ComponentManager = componentManager.ComponentManager;
|
|
61
62
|
exports.AnimationManager = animationManager.AnimationManager;
|
|
62
63
|
exports.PathfindingManager = pathfindingManager.PathfindingManager;
|
|
64
|
+
exports.PathIntersectionDetector = PathIntersectionDetector.PathIntersectionDetector;
|
|
63
65
|
exports.ComponentDataManager = componentDataManager.ComponentDataManager;
|
|
64
66
|
exports.createTransformControls = transformControlsManager.createTransformControls;
|
|
65
67
|
exports.KeyboardControlsManager = keyboardControlsManager.KeyboardControlsManager;
|
|
@@ -69,7 +71,7 @@ exports.EnvironmentManager = environmentManager.EnvironmentManager;
|
|
|
69
71
|
exports.loadTextureSetAndCreateMaterial = textureConfig.loadTextureSetAndCreateMaterial;
|
|
70
72
|
exports.ThreeJSResourceManager = threeJSResourceManager.ThreeJSResourceManager;
|
|
71
73
|
exports.PerformanceMonitorManager = performanceMonitorManager.PerformanceMonitorManager;
|
|
72
|
-
exports.
|
|
74
|
+
exports.OperationHistoryManager = operationHistoryManager.OperationHistoryManager;
|
|
73
75
|
exports.ModelManager = modelManager.ModelManager;
|
|
74
76
|
exports.modelPreloader = modelPreloader["default"];
|
|
75
77
|
exports.Rendering2D = rendering2D;
|
|
@@ -148,18 +148,10 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
148
148
|
return;
|
|
149
149
|
}
|
|
150
150
|
children.forEach(function (child) {
|
|
151
|
-
var _child$userData, _child$userData2, _child$userData3, _child$userData5, _child$userData6, _child$userData7;
|
|
151
|
+
var _child$userData, _child$userData2, _child$userData3, _child$userData5, _child$userData6, _child$userData7, _child$userData8;
|
|
152
152
|
// Skip manual segments - they are visual only and not obstacles for pathfinding
|
|
153
|
+
// BUT: Keep them in the scene data structure for parent-child relationships
|
|
153
154
|
var isManualSegment = ((_child$userData = child.userData) === null || _child$userData === void 0 ? void 0 : _child$userData.objectType) === 'segment';
|
|
154
|
-
if (isManualSegment) {
|
|
155
|
-
console.log("\u23ED\uFE0F Skipping manual segment in pathfinder: ".concat(child.uuid));
|
|
156
|
-
|
|
157
|
-
// Still process the segment's connector children if they exist
|
|
158
|
-
if (child.children && Array.isArray(child.children) && child.children.length > 0) {
|
|
159
|
-
_collectAllObjects(child.children);
|
|
160
|
-
}
|
|
161
|
-
return; // Skip adding the segment itself
|
|
162
|
-
}
|
|
163
155
|
|
|
164
156
|
// Convert connectors to position-based format (Phase 2 Refactoring)
|
|
165
157
|
// BUT: Skip manual (declared) connectors and gateways - their positions are already set
|
|
@@ -193,6 +185,13 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
193
185
|
delete child.rotation;
|
|
194
186
|
}
|
|
195
187
|
|
|
188
|
+
// IMPORTANT: Remove bounding boxes from manual segments so they're not treated as obstacles
|
|
189
|
+
// Manual segments are visual-only representations of paths that have already been manually positioned
|
|
190
|
+
if (isManualSegment && (_child$userData8 = child.userData) !== null && _child$userData8 !== void 0 && _child$userData8.worldBoundingBox) {
|
|
191
|
+
console.log("\uD83D\uDD27 Removing bounding box from manual segment: ".concat(child.uuid));
|
|
192
|
+
delete child.userData.worldBoundingBox;
|
|
193
|
+
}
|
|
194
|
+
|
|
196
195
|
// If this object has children, recursively collect them before clearing
|
|
197
196
|
if (child.children && Array.isArray(child.children) && child.children.length > 0) {
|
|
198
197
|
_collectAllObjects(child.children);
|
|
@@ -222,11 +221,13 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
222
221
|
key: "_executePathfinding",
|
|
223
222
|
value: (function () {
|
|
224
223
|
var _executePathfinding2 = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee(sceneData, connections) {
|
|
224
|
+
var _simplifiedSceneData$;
|
|
225
225
|
var options,
|
|
226
226
|
_options$context,
|
|
227
227
|
context,
|
|
228
228
|
sceneDataCopy,
|
|
229
229
|
connectionsCopy,
|
|
230
|
+
simplifiedSceneData,
|
|
230
231
|
pathfindingResult,
|
|
231
232
|
_args = arguments;
|
|
232
233
|
return _rollupPluginBabelHelpers.regenerator().w(function (_context) {
|
|
@@ -243,8 +244,10 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
243
244
|
|
|
244
245
|
// Create a deep copy of scene data to avoid mutation of the original
|
|
245
246
|
sceneDataCopy = JSON.parse(JSON.stringify(sceneData)); // Deep copy connections to prevent pathfinder from mutating the original
|
|
246
|
-
connectionsCopy = JSON.parse(JSON.stringify(connections));
|
|
247
|
-
|
|
247
|
+
connectionsCopy = JSON.parse(JSON.stringify(connections));
|
|
248
|
+
simplifiedSceneData = JSON.parse(JSON.stringify(this.getSimplifiedSceneData()));
|
|
249
|
+
console.log('[Pathfinder] simplifiedSceneData length at creation:', (_simplifiedSceneData$ = simplifiedSceneData.children) === null || _simplifiedSceneData$ === void 0 ? void 0 : _simplifiedSceneData$.length);
|
|
250
|
+
console.log('[Pathfinder] simplifiedSceneData (deep clone for inspection):', JSON.parse(JSON.stringify(simplifiedSceneData)));
|
|
248
251
|
console.log('🏗️ [Pathfinder] sceneData structure before:', JSON.parse(JSON.stringify(sceneDataCopy)));
|
|
249
252
|
|
|
250
253
|
// Flatten the sceneData structure - move all connector children to root level
|
|
@@ -257,7 +260,7 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
257
260
|
|
|
258
261
|
// Find paths using v1.0.17 API (sceneData and connections separately)
|
|
259
262
|
// Pass deep copy to ensure pathfinder cannot mutate original connections
|
|
260
|
-
pathfindingResult = this.pathfinder.findPaths(
|
|
263
|
+
pathfindingResult = this.pathfinder.findPaths(simplifiedSceneData, connectionsCopy);
|
|
261
264
|
console.log('[Pathfinder] Found paths:', JSON.parse(JSON.stringify(pathfindingResult.paths)));
|
|
262
265
|
console.log('Generated gateways:', JSON.parse(JSON.stringify(pathfindingResult.gateways)));
|
|
263
266
|
console.log('Rewired connections:', JSON.parse(JSON.stringify(pathfindingResult.rewiredConnections)));
|
|
@@ -316,8 +319,6 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
316
319
|
isDeclared: false,
|
|
317
320
|
gatewayId: gateway.id,
|
|
318
321
|
originalUuid: gateway.id,
|
|
319
|
-
origin: 'computed',
|
|
320
|
-
// Keep for backward compatibility
|
|
321
322
|
// Deep copy connections to prevent mutations affecting pathfinder's internal state
|
|
322
323
|
connections: gateway.connections ? {
|
|
323
324
|
removed: gateway.connections.removed ? _rollupPluginBabelHelpers.toConsumableArray(gateway.connections.removed) : [],
|
|
@@ -337,14 +338,18 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
337
338
|
key: "getSimplifiedSceneData",
|
|
338
339
|
value: function getSimplifiedSceneData() {
|
|
339
340
|
// Collect all objects with objectType (flattened list from scene traversal)
|
|
341
|
+
// Filter out ALL computed objects - only include declared/source objects
|
|
340
342
|
var sceneDataNew = [];
|
|
341
343
|
this.sceneViewer.scene.traverse(function (obj) {
|
|
342
|
-
if (obj.userData && obj.userData.objectType
|
|
344
|
+
if (obj.userData && obj.userData.objectType) {
|
|
345
|
+
// Skip computed gateways (only include declared/manual gateways)
|
|
346
|
+
if (obj.userData.objectType === 'gateway' && !obj.userData.isDeclared) {
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
343
349
|
sceneDataNew.push(obj);
|
|
344
350
|
}
|
|
345
351
|
});
|
|
346
352
|
console.log('🔗 [Pathfinder] sceneDataNew (flattened):', sceneDataNew);
|
|
347
|
-
console.log('🔗 [Pathfinder] this.sceneViewer.scene:', this.sceneViewer.scene);
|
|
348
353
|
|
|
349
354
|
// Calculate world bounding boxes for each object individually (after flattening)
|
|
350
355
|
// This way we don't need to worry about children - each object is standalone
|
|
@@ -368,12 +373,16 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
368
373
|
bbox.applyMatrix4(obj.matrixWorld);
|
|
369
374
|
|
|
370
375
|
// Only include valid bounding boxes
|
|
371
|
-
if
|
|
376
|
+
// Check if all components of min and max are finite numbers
|
|
377
|
+
var isValidBBox = !bbox.isEmpty() && isFinite(bbox.min.x) && isFinite(bbox.min.y) && isFinite(bbox.min.z) && isFinite(bbox.max.x) && isFinite(bbox.max.y) && isFinite(bbox.max.z);
|
|
378
|
+
if (isValidBBox) {
|
|
372
379
|
worldBoundingBox = {
|
|
373
380
|
min: bbox.min.toArray(),
|
|
374
381
|
max: bbox.max.toArray()
|
|
375
382
|
};
|
|
376
383
|
console.log("\uD83D\uDCE6 Calculated worldBoundingBox for ".concat(uuid, ":"), worldBoundingBox);
|
|
384
|
+
} else {
|
|
385
|
+
console.log('🔗 [Pathfinder] sceneDataNew worldBoundingBox not calculated');
|
|
377
386
|
}
|
|
378
387
|
}
|
|
379
388
|
} catch (error) {
|
|
@@ -384,7 +393,10 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
384
393
|
else if (obj.isGroup || ((_obj$children = obj.children) === null || _obj$children === void 0 ? void 0 : _obj$children.length) > 0) {
|
|
385
394
|
try {
|
|
386
395
|
var _bbox = new THREE__namespace.Box3().setFromObject(obj);
|
|
387
|
-
|
|
396
|
+
|
|
397
|
+
// Check if all components of min and max are finite numbers
|
|
398
|
+
var _isValidBBox = !_bbox.isEmpty() && isFinite(_bbox.min.x) && isFinite(_bbox.min.y) && isFinite(_bbox.min.z) && isFinite(_bbox.max.x) && isFinite(_bbox.max.y) && isFinite(_bbox.max.z);
|
|
399
|
+
if (_isValidBBox) {
|
|
388
400
|
worldBoundingBox = {
|
|
389
401
|
min: _bbox.min.toArray(),
|
|
390
402
|
max: _bbox.max.toArray()
|
|
@@ -395,12 +407,18 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
395
407
|
console.warn("\u26A0\uFE0F Failed to calculate bounding box for ".concat(uuid, ":"), error);
|
|
396
408
|
}
|
|
397
409
|
}
|
|
398
|
-
|
|
410
|
+
var results = {
|
|
399
411
|
uuid: uuid,
|
|
400
412
|
userData: _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, obj.userData), worldBoundingBox && {
|
|
401
413
|
worldBoundingBox: worldBoundingBox
|
|
402
414
|
})
|
|
403
415
|
};
|
|
416
|
+
if (obj.userData.objectType.includes('connector') || obj.userData.objectType === 'gateway') {
|
|
417
|
+
var worldPosition = new THREE__namespace.Vector3();
|
|
418
|
+
obj.getWorldPosition(worldPosition);
|
|
419
|
+
results.userData.position = [worldPosition.x, worldPosition.y, worldPosition.z];
|
|
420
|
+
}
|
|
421
|
+
return results;
|
|
404
422
|
});
|
|
405
423
|
return simplifiedSceneData;
|
|
406
424
|
}
|
|
@@ -494,10 +512,10 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
494
512
|
*/
|
|
495
513
|
}, {
|
|
496
514
|
key: "createPipeMaterial",
|
|
497
|
-
value: function createPipeMaterial(crosscubeTextureSet
|
|
515
|
+
value: function createPipeMaterial(crosscubeTextureSet) {
|
|
498
516
|
if (crosscubeTextureSet) {
|
|
499
517
|
var materialProps = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, crosscubeTextureSet.config.materialProps), {}, {
|
|
500
|
-
color: this.getPathColor(
|
|
518
|
+
color: this.getPathColor(0),
|
|
501
519
|
map: crosscubeTextureSet.textures.diffuse,
|
|
502
520
|
normalMap: crosscubeTextureSet.textures.normal,
|
|
503
521
|
roughnessMap: crosscubeTextureSet.textures.roughness,
|
|
@@ -506,7 +524,9 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
506
524
|
clearcoat: 0.2,
|
|
507
525
|
clearcoatRoughness: 0.2,
|
|
508
526
|
envMapIntensity: 0.6,
|
|
509
|
-
reflectivity: 0.4
|
|
527
|
+
reflectivity: 0.4,
|
|
528
|
+
transparent: true,
|
|
529
|
+
opacity: 0.75
|
|
510
530
|
});
|
|
511
531
|
|
|
512
532
|
// Handle normalScale conversion to Vector2
|
|
@@ -524,7 +544,7 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
524
544
|
return material;
|
|
525
545
|
} else {
|
|
526
546
|
return new THREE__namespace.MeshPhysicalMaterial({
|
|
527
|
-
color: this.getPathColor(
|
|
547
|
+
color: this.getPathColor(0),
|
|
528
548
|
metalness: 0.9,
|
|
529
549
|
roughness: 0.7,
|
|
530
550
|
clearcoat: 0.1,
|
|
@@ -547,7 +567,7 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
547
567
|
paths.forEach(function (pathData, index) {
|
|
548
568
|
if (pathData.path && pathData.path.length >= 2) {
|
|
549
569
|
var pipeRadius = 0.1;
|
|
550
|
-
var pipeMaterial = _this4.createPipeMaterial(crosscubeTextureSet
|
|
570
|
+
var pipeMaterial = _this4.createPipeMaterial(crosscubeTextureSet);
|
|
551
571
|
|
|
552
572
|
// Convert path points to Vector3 objects for consistent handling
|
|
553
573
|
var pathPoints = pathData.path.map(function (point) {
|
|
@@ -593,12 +613,11 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
593
613
|
|
|
594
614
|
// Add userData to make pipe segments selectable and for tooltip display
|
|
595
615
|
cylinder.userData = {
|
|
596
|
-
|
|
616
|
+
objectType: 'segment',
|
|
597
617
|
segmentId: segmentId,
|
|
598
618
|
segmentIndex: globalSegmentIndex,
|
|
599
619
|
pathFrom: pathData.from,
|
|
600
|
-
pathTo: pathData.to
|
|
601
|
-
pathIndex: index
|
|
620
|
+
pathTo: pathData.to
|
|
602
621
|
};
|
|
603
622
|
|
|
604
623
|
// Increment global segment counter
|
|
@@ -624,11 +643,11 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
624
643
|
}, {
|
|
625
644
|
key: "manualizeSegment",
|
|
626
645
|
value: function manualizeSegment(segment, currentSceneData) {
|
|
627
|
-
|
|
646
|
+
var _segment$userData;
|
|
647
|
+
if (!segment || !((_segment$userData = segment.userData) !== null && _segment$userData !== void 0 && _segment$userData.objectType) === 'segment') {
|
|
628
648
|
console.log('❌ Object is not a pipe segment:', {
|
|
629
649
|
isObject: !!segment,
|
|
630
|
-
hasUserData: !!(segment && segment.userData)
|
|
631
|
-
isPipeSegment: !!(segment && segment.userData && segment.userData.isPipeSegment)
|
|
650
|
+
hasUserData: !!(segment && segment.userData)
|
|
632
651
|
});
|
|
633
652
|
return;
|
|
634
653
|
}
|
|
@@ -716,18 +735,16 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
716
735
|
var additionalSceneDataProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
717
736
|
// Mark in the scene object
|
|
718
737
|
object.userData.isDeclared = true;
|
|
719
|
-
object.userData.origin = 'declared'; // Backward compatibility
|
|
720
738
|
|
|
721
739
|
// Find and update in scene data
|
|
722
740
|
var foundInSceneData = false;
|
|
723
741
|
for (var i = 0; i < currentSceneData.scene.children.length; i++) {
|
|
724
|
-
var _object$userData, _child$
|
|
742
|
+
var _object$userData, _child$userData9;
|
|
725
743
|
var child = currentSceneData.scene.children[i];
|
|
726
|
-
if (child.uuid === object.uuid || child.uuid === ((_object$userData = object.userData) === null || _object$userData === void 0 ? void 0 : _object$userData.originalUuid) || object.uuid === ((_child$
|
|
744
|
+
if (child.uuid === object.uuid || child.uuid === ((_object$userData = object.userData) === null || _object$userData === void 0 ? void 0 : _object$userData.originalUuid) || object.uuid === ((_child$userData9 = child.userData) === null || _child$userData9 === void 0 ? void 0 : _child$userData9.originalUuid)) {
|
|
727
745
|
var _object$userData2, _object$userData3;
|
|
728
746
|
if (!child.userData) child.userData = {};
|
|
729
747
|
child.userData.isDeclared = true;
|
|
730
|
-
child.userData.origin = 'declared';
|
|
731
748
|
|
|
732
749
|
// Update position in scene data
|
|
733
750
|
if (!child.position) {
|
|
@@ -749,14 +766,13 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
749
766
|
|
|
750
767
|
// If not found in scene data, add it
|
|
751
768
|
if (!foundInSceneData) {
|
|
752
|
-
var _object$userData4, _object$userData5, _object$userData6
|
|
769
|
+
var _object$userData4, _object$userData5, _object$userData6;
|
|
753
770
|
console.log("\u26A0\uFE0F Object ".concat(object.uuid, " not found in scene data, adding it now"));
|
|
754
771
|
var sceneDataObject = _rollupPluginBabelHelpers.objectSpread2({
|
|
755
772
|
uuid: object.uuid,
|
|
756
773
|
userData: _rollupPluginBabelHelpers.objectSpread2({
|
|
757
774
|
objectType: object.userData.objectType,
|
|
758
|
-
isDeclared: true
|
|
759
|
-
origin: 'declared'
|
|
775
|
+
isDeclared: true
|
|
760
776
|
}, object.userData),
|
|
761
777
|
position: {
|
|
762
778
|
x: object.position.x,
|
|
@@ -771,20 +787,20 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
771
787
|
}
|
|
772
788
|
|
|
773
789
|
// For segments, initialize children array to hold connectors
|
|
774
|
-
if ((_object$userData6 = object.userData)
|
|
790
|
+
if (((_object$userData6 = object.userData) === null || _object$userData6 === void 0 ? void 0 : _object$userData6.objectType) === 'segment') {
|
|
775
791
|
sceneDataObject.children = [];
|
|
776
792
|
console.log("\uD83D\uDCE6 Initialized children array for segment: ".concat(object.uuid));
|
|
777
793
|
}
|
|
778
794
|
currentSceneData.scene.children.push(sceneDataObject);
|
|
779
795
|
console.log("\u2705 Added object to scene data as declared: ".concat(object.uuid));
|
|
780
796
|
} else {
|
|
781
|
-
var _object$
|
|
797
|
+
var _object$userData8;
|
|
782
798
|
// If segment was found in scene data, ensure it has a children array
|
|
783
799
|
var _child = currentSceneData.scene.children.find(function (c) {
|
|
784
|
-
var _object$
|
|
785
|
-
return c.uuid === object.uuid || c.uuid === ((_object$
|
|
800
|
+
var _object$userData7, _c$userData;
|
|
801
|
+
return c.uuid === object.uuid || c.uuid === ((_object$userData7 = object.userData) === null || _object$userData7 === void 0 ? void 0 : _object$userData7.originalUuid) || object.uuid === ((_c$userData = c.userData) === null || _c$userData === void 0 ? void 0 : _c$userData.originalUuid);
|
|
786
802
|
});
|
|
787
|
-
if (_child && ((_object$
|
|
803
|
+
if (_child && ((_object$userData8 = object.userData) === null || _object$userData8 === void 0 ? void 0 : _object$userData8.objectType) === 'segment') {
|
|
788
804
|
if (!_child.children) {
|
|
789
805
|
_child.children = [];
|
|
790
806
|
console.log("\uD83D\uDCE6 Initialized children array for existing segment: ".concat(_child.uuid));
|
|
@@ -795,7 +811,7 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
795
811
|
|
|
796
812
|
/**
|
|
797
813
|
* Check and convert gateways at the original path endpoints to manual (declared)
|
|
798
|
-
* This method now delegates to
|
|
814
|
+
* This method now delegates to manualizeGateway to ensure consistent gateway handling
|
|
799
815
|
* @param {Array} connectors - Array of connector objects (used to get segment reference)
|
|
800
816
|
* @param {Object} currentSceneData - Current scene data
|
|
801
817
|
* @returns {Array<string>} Array of converted gateway UUIDs
|
|
@@ -804,7 +820,7 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
804
820
|
key: "convertConnectedGatewaysToManual",
|
|
805
821
|
value: function convertConnectedGatewaysToManual(connectors, currentSceneData) {
|
|
806
822
|
var _connectors$,
|
|
807
|
-
_segment$
|
|
823
|
+
_segment$userData2,
|
|
808
824
|
_this5 = this;
|
|
809
825
|
console.log('🔍 Checking for connected gateways to convert to manual...');
|
|
810
826
|
var sceneViewer = this.sceneViewer;
|
|
@@ -812,7 +828,7 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
812
828
|
|
|
813
829
|
// Get the segment from the first connector's userData
|
|
814
830
|
var segment = (_connectors$ = connectors[0]) !== null && _connectors$ !== void 0 && (_connectors$ = _connectors$.userData) !== null && _connectors$ !== void 0 && _connectors$.manualSegmentUuid ? sceneViewer.scene.getObjectByProperty('uuid', connectors[0].userData.manualSegmentUuid) : null;
|
|
815
|
-
if (!segment || !((_segment$
|
|
831
|
+
if (!segment || !((_segment$userData2 = segment.userData) !== null && _segment$userData2 !== void 0 && _segment$userData2.objectType) === 'segment') {
|
|
816
832
|
console.log('❌ Could not find segment for gateway conversion');
|
|
817
833
|
return [];
|
|
818
834
|
}
|
|
@@ -833,18 +849,18 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
833
849
|
}
|
|
834
850
|
});
|
|
835
851
|
if (endpointObject) {
|
|
836
|
-
var _endpointObject$userD, _endpointObject$userD2, _endpointObject$userD3, _endpointObject$userD4, _endpointObject$userD5, _endpointObject$userD6
|
|
837
|
-
console.log("\uD83D\uDD0D Found endpoint object: ".concat(endpointObject.uuid, " - objectType: ").concat((_endpointObject$userD = endpointObject.userData) === null || _endpointObject$userD === void 0 ? void 0 : _endpointObject$userD.objectType, ", isDeclared: ").concat((_endpointObject$userD2 = endpointObject.userData) === null || _endpointObject$userD2 === void 0 ? void 0 : _endpointObject$userD2.isDeclared
|
|
852
|
+
var _endpointObject$userD, _endpointObject$userD2, _endpointObject$userD3, _endpointObject$userD4, _endpointObject$userD5, _endpointObject$userD6;
|
|
853
|
+
console.log("\uD83D\uDD0D Found endpoint object: ".concat(endpointObject.uuid, " - objectType: ").concat((_endpointObject$userD = endpointObject.userData) === null || _endpointObject$userD === void 0 ? void 0 : _endpointObject$userD.objectType, ", isDeclared: ").concat((_endpointObject$userD2 = endpointObject.userData) === null || _endpointObject$userD2 === void 0 ? void 0 : _endpointObject$userD2.isDeclared));
|
|
838
854
|
|
|
839
855
|
// Check if this endpoint is a gateway that needs to be converted to manual
|
|
840
856
|
// IMPORTANT: Only convert if it's NOT already declared to prevent double-processing
|
|
841
|
-
if (((_endpointObject$
|
|
857
|
+
if (((_endpointObject$userD3 = endpointObject.userData) === null || _endpointObject$userD3 === void 0 ? void 0 : _endpointObject$userD3.objectType) === 'gateway' && ((_endpointObject$userD4 = endpointObject.userData) === null || _endpointObject$userD4 === void 0 ? void 0 : _endpointObject$userD4.isDeclared) !== true) {
|
|
842
858
|
console.log("\uD83D\uDD27 Found computed gateway at endpoint: ".concat(endpointObject.uuid, " - converting to manual"));
|
|
843
859
|
|
|
844
860
|
// Convert gateway to manual (declared) using manualizeGateway for consistency
|
|
845
861
|
_this5.manualizeGateway(endpointObject, currentSceneData);
|
|
846
862
|
convertedGateways.push(endpointObject);
|
|
847
|
-
} else if (((_endpointObject$
|
|
863
|
+
} else if (((_endpointObject$userD5 = endpointObject.userData) === null || _endpointObject$userD5 === void 0 ? void 0 : _endpointObject$userD5.objectType) === 'gateway' && ((_endpointObject$userD6 = endpointObject.userData) === null || _endpointObject$userD6 === void 0 ? void 0 : _endpointObject$userD6.isDeclared) === true) {
|
|
848
864
|
console.log("\u2139\uFE0F Gateway ".concat(endpointObject.uuid, " is already declared (manual), skipping conversion"));
|
|
849
865
|
}
|
|
850
866
|
} else {
|
|
@@ -933,8 +949,7 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
933
949
|
if (!gateway || !gateway.userData || gateway.userData.objectType !== 'gateway') {
|
|
934
950
|
console.log('❌ Object is not a gateway:', {
|
|
935
951
|
isObject: !!gateway,
|
|
936
|
-
hasUserData: !!(gateway && gateway.userData)
|
|
937
|
-
isGateway: !!(gateway && gateway.userData && gateway.userData.objectType === 'gateway')
|
|
952
|
+
hasUserData: !!(gateway && gateway.userData)
|
|
938
953
|
});
|
|
939
954
|
return;
|
|
940
955
|
}
|
|
@@ -998,7 +1013,6 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
998
1013
|
gatewayId: gateway.userData.gatewayId || gateway.uuid,
|
|
999
1014
|
originalUuid: gateway.userData.originalUuid || gateway.uuid,
|
|
1000
1015
|
isDeclared: true,
|
|
1001
|
-
origin: 'declared',
|
|
1002
1016
|
connections: gateway.userData.connections,
|
|
1003
1017
|
position: [gateway.position.x, gateway.position.y, gateway.position.z]
|
|
1004
1018
|
},
|
|
@@ -1166,11 +1180,12 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1166
1180
|
startConnector.position.copy(localStartPosition);
|
|
1167
1181
|
startConnector.uuid = "SEGMENT-".concat(segmentIndex, "-CONNECTOR-1");
|
|
1168
1182
|
startConnector.userData = {
|
|
1169
|
-
objectType: 'connector',
|
|
1183
|
+
objectType: 'segment-connector',
|
|
1170
1184
|
isManualSegmentConnector: true,
|
|
1171
1185
|
segmentId: segmentId,
|
|
1172
1186
|
connectorType: 'start',
|
|
1173
|
-
manualSegmentUuid: segment.uuid
|
|
1187
|
+
manualSegmentUuid: segment.uuid,
|
|
1188
|
+
isDeclared: true
|
|
1174
1189
|
};
|
|
1175
1190
|
|
|
1176
1191
|
// Add start connector as child of segment
|
|
@@ -1185,11 +1200,12 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1185
1200
|
endConnector.position.copy(localEndPosition);
|
|
1186
1201
|
endConnector.uuid = "SEGMENT-".concat(segmentIndex, "-CONNECTOR-2");
|
|
1187
1202
|
endConnector.userData = {
|
|
1188
|
-
objectType: 'connector',
|
|
1203
|
+
objectType: 'segment-connector',
|
|
1189
1204
|
isManualSegmentConnector: true,
|
|
1190
1205
|
segmentId: segmentId,
|
|
1191
1206
|
connectorType: 'end',
|
|
1192
|
-
manualSegmentUuid: segment.uuid
|
|
1207
|
+
manualSegmentUuid: segment.uuid,
|
|
1208
|
+
isDeclared: true
|
|
1193
1209
|
};
|
|
1194
1210
|
|
|
1195
1211
|
// Add end connector as child of segment
|
|
@@ -1387,7 +1403,6 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1387
1403
|
elbowIndex: j,
|
|
1388
1404
|
pathFrom: pathData.from,
|
|
1389
1405
|
pathTo: pathData.to,
|
|
1390
|
-
pathIndex: index,
|
|
1391
1406
|
angle: (angle * 180 / Math.PI).toFixed(1),
|
|
1392
1407
|
// Add component data for tooltips
|
|
1393
1408
|
component: {
|
|
@@ -1485,11 +1500,11 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1485
1500
|
_step2;
|
|
1486
1501
|
try {
|
|
1487
1502
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
1488
|
-
var _object$
|
|
1503
|
+
var _object$userData9, _child$userData0;
|
|
1489
1504
|
var child = _step2.value;
|
|
1490
1505
|
// Use the centralized findObjectByHardcodedUuid logic (but for JSON objects)
|
|
1491
1506
|
// Strategy 1: Direct hardcoded UUID match (HIGHEST PRIORITY)
|
|
1492
|
-
if (child.uuid === object.uuid || child.uuid === ((_object$
|
|
1507
|
+
if (child.uuid === object.uuid || child.uuid === ((_object$userData9 = object.userData) === null || _object$userData9 === void 0 ? void 0 : _object$userData9.originalUuid) || object.uuid === ((_child$userData0 = child.userData) === null || _child$userData0 === void 0 ? void 0 : _child$userData0.originalUuid)) {
|
|
1493
1508
|
return child;
|
|
1494
1509
|
}
|
|
1495
1510
|
|