@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.
Files changed (45) hide show
  1. package/dist/bundle/index.js +7991 -7054
  2. package/dist/cjs/src/core/centralPlant.js +48 -3
  3. package/dist/cjs/src/core/centralPlantInternals.js +75 -566
  4. package/dist/cjs/src/core/sceneViewer.js +38 -13
  5. package/dist/cjs/src/index.js +6 -4
  6. package/dist/cjs/src/managers/components/pathfindingManager.js +75 -60
  7. package/dist/cjs/src/managers/components/transformOperationsManager.js +929 -0
  8. package/dist/cjs/src/managers/controls/keyboardControlsManager.js +57 -1
  9. package/dist/cjs/src/managers/controls/transformControls.js +11 -3
  10. package/dist/cjs/src/managers/controls/transformControlsManager.js +563 -263
  11. package/dist/cjs/src/managers/pathfinding/ConnectorManager.js +385 -0
  12. package/dist/cjs/src/managers/pathfinding/PathIntersectionDetector.js +387 -0
  13. package/dist/cjs/src/managers/pathfinding/PathRenderingManager.js +401 -0
  14. package/dist/cjs/src/managers/pathfinding/pathfindingManager.js +378 -0
  15. package/dist/cjs/src/managers/pathfinding/sceneDataManager.js +256 -0
  16. package/dist/cjs/src/managers/scene/animationManager.js +145 -0
  17. package/dist/cjs/src/managers/scene/sceneExportManager.js +14 -13
  18. package/dist/cjs/src/managers/scene/sceneOperationsManager.js +516 -21
  19. package/dist/cjs/src/managers/scene/sceneTooltipsManager.js +1 -8
  20. package/dist/cjs/src/managers/system/operationHistoryManager.js +414 -0
  21. package/dist/cjs/src/managers/system/settingsManager.js +2 -1
  22. package/dist/cjs/src/utils/objectTypes.js +5 -7
  23. package/dist/esm/src/core/centralPlant.js +48 -3
  24. package/dist/esm/src/core/centralPlantInternals.js +76 -567
  25. package/dist/esm/src/core/sceneViewer.js +38 -13
  26. package/dist/esm/src/index.js +4 -3
  27. package/dist/esm/src/managers/components/pathfindingManager.js +75 -60
  28. package/dist/esm/src/managers/components/transformOperationsManager.js +904 -0
  29. package/dist/esm/src/managers/controls/keyboardControlsManager.js +57 -1
  30. package/dist/esm/src/managers/controls/transformControls.js +11 -3
  31. package/dist/esm/src/managers/controls/transformControlsManager.js +564 -264
  32. package/dist/esm/src/managers/pathfinding/ConnectorManager.js +361 -0
  33. package/dist/esm/src/managers/pathfinding/PathIntersectionDetector.js +363 -0
  34. package/dist/esm/src/managers/pathfinding/PathRenderingManager.js +377 -0
  35. package/dist/esm/src/managers/pathfinding/pathfindingManager.js +374 -0
  36. package/dist/esm/src/managers/pathfinding/sceneDataManager.js +232 -0
  37. package/dist/esm/src/managers/scene/animationManager.js +141 -0
  38. package/dist/esm/src/managers/scene/sceneExportManager.js +14 -13
  39. package/dist/esm/src/managers/scene/sceneOperationsManager.js +516 -21
  40. package/dist/esm/src/managers/scene/sceneTooltipsManager.js +1 -8
  41. package/dist/esm/src/managers/system/operationHistoryManager.js +409 -0
  42. package/dist/esm/src/managers/system/settingsManager.js +2 -1
  43. package/dist/esm/src/utils/objectTypes.js +5 -7
  44. package/dist/index.d.ts +2 -2
  45. package/package.json +1 -1
@@ -9,15 +9,17 @@ var transformControlsManager = require('../managers/controls/transformControlsMa
9
9
  var threeJSResourceManager = require('../managers/system/threeJSResourceManager.js');
10
10
  var performanceMonitorManager = require('../managers/system/performanceMonitorManager.js');
11
11
  var settingsManager = require('../managers/system/settingsManager.js');
12
+ var operationHistoryManager = require('../managers/system/operationHistoryManager.js');
12
13
  var sceneExportManager = require('../managers/scene/sceneExportManager.js');
13
14
  var componentManager = require('../managers/components/componentManager.js');
14
15
  var componentDataManager = require('../managers/components/componentDataManager.js');
16
+ var transformOperationsManager = require('../managers/components/transformOperationsManager.js');
15
17
  var sceneInitializationManager = require('../managers/scene/sceneInitializationManager.js');
16
18
  var environmentManager = require('../managers/environment/environmentManager.js');
17
19
  var keyboardControlsManager = require('../managers/controls/keyboardControlsManager.js');
18
- var pathfindingManager = require('../managers/components/pathfindingManager.js');
20
+ var pathfindingManager = require('../managers/pathfinding/pathfindingManager.js');
19
21
  var sceneOperationsManager = require('../managers/scene/sceneOperationsManager.js');
20
- var animationManager = require('../managers/components/animationManager.js');
22
+ var animationManager = require('../managers/scene/animationManager.js');
21
23
  var cameraControlsManager = require('../managers/controls/cameraControlsManager.js');
22
24
  var componentDragManager = require('../managers/controls/componentDragManager.js');
23
25
  var sceneTooltipsManager = require('../managers/scene/sceneTooltipsManager.js');
@@ -97,9 +99,11 @@ var CentralPlantInternals = /*#__PURE__*/function () {
97
99
  this.centralPlant.managers.threeJSResourceManager = new threeJSResourceManager.ThreeJSResourceManager(this.centralPlant.sceneViewer);
98
100
  this.centralPlant.managers.performanceMonitorManager = new performanceMonitorManager.PerformanceMonitorManager(this.centralPlant.sceneViewer);
99
101
  this.centralPlant.managers.settingsManager = new settingsManager.SettingsManager(this.centralPlant.sceneViewer);
102
+ this.centralPlant.managers.operationHistoryManager = new operationHistoryManager.OperationHistoryManager(this.centralPlant.sceneViewer);
100
103
  this.centralPlant.managers.sceneExportManager = new sceneExportManager.SceneExportManager(this.centralPlant.sceneViewer);
101
104
  this.centralPlant.managers.componentManager = new componentManager.ComponentManager(this.centralPlant.sceneViewer);
102
105
  this.centralPlant.managers.componentDataManager = new componentDataManager.ComponentDataManager(this.centralPlant.sceneViewer);
106
+ this.centralPlant.managers.transformOperationsManager = new transformOperationsManager.TransformOperationsManager(this.centralPlant.sceneViewer);
103
107
  this.centralPlant.managers.sceneInitializationManager = new sceneInitializationManager.SceneInitializationManager(this.centralPlant.sceneViewer);
104
108
  this.centralPlant.managers.environmentManager = new environmentManager.EnvironmentManager(this.centralPlant.sceneViewer);
105
109
  this.centralPlant.managers.keyboardControlsManager = new keyboardControlsManager.KeyboardControlsManager(this.centralPlant.sceneViewer);
@@ -397,7 +401,7 @@ var CentralPlantInternals = /*#__PURE__*/function () {
397
401
  // ===== TRANSFORM OPERATIONS =====
398
402
 
399
403
  /**
400
- * Translate a component by componentId (internal implementation)
404
+ * Translate a component by componentId (delegates to TransformOperationsManager)
401
405
  * @param {string} componentId - The UUID of the component to translate
402
406
  * @param {string} axis - The axis to translate on ('x', 'y', or 'z')
403
407
  * @param {number} value - The value to translate by
@@ -406,78 +410,16 @@ var CentralPlantInternals = /*#__PURE__*/function () {
406
410
  }, {
407
411
  key: "translateComponent",
408
412
  value: function translateComponent(componentId, axis, value) {
409
- var _this$centralPlant$sc2, _this$centralPlant$sc3;
410
- // Use centralized validator for parameter validation
411
- var validation = this.validator.validateTransformationParams(componentId, axis, value, {
412
- operation: 'translate'
413
- });
414
- if (!validation.isValid) {
415
- return false; // Validator already logged the error
416
- }
417
-
418
- // Validate scene availability
419
- var sceneValidation = this.validator.validateSceneViewer(this.centralPlant.sceneViewer, (_this$centralPlant$sc2 = this.centralPlant.sceneViewer) === null || _this$centralPlant$sc2 === void 0 ? void 0 : _this$centralPlant$sc2.scene);
420
- if (!sceneValidation.isValid) {
421
- return false;
422
- }
423
-
424
- // Find the component in the scene
425
- var component = null;
426
- this.centralPlant.sceneViewer.scene.traverse(function (child) {
427
- var _child$userData;
428
- if (child.uuid === componentId || ((_child$userData = child.userData) === null || _child$userData === void 0 ? void 0 : _child$userData.originalUuid) === componentId) {
429
- component = child;
430
- }
431
- });
432
- if (!component) {
433
- console.error("\u274C translateComponent(): Component with ID '".concat(componentId, "' not found in scene"));
434
- return false;
435
- }
436
-
437
- // Validate that it's actually a component
438
- if (!component.userData || !component.userData.objectType) {
439
- console.error("\u274C translateComponent(): Object with ID '".concat(componentId, "' is not a valid component"));
413
+ var _this$centralPlant$ma;
414
+ if (!((_this$centralPlant$ma = this.centralPlant.managers) !== null && _this$centralPlant$ma !== void 0 && _this$centralPlant$ma.transformOperationsManager)) {
415
+ console.error('❌ translateComponent(): TransformOperationsManager not available');
440
416
  return false;
441
417
  }
442
-
443
- // Apply the translation
444
- console.log("\uD83D\uDD04 translateComponent(): Translating component ".concat(componentId, " on ").concat(axis, " axis by ").concat(value));
445
-
446
- // Update the Three.js object position
447
- component.position[axis] += value;
448
-
449
- // Update world bounding boxes for the component and its children
450
- this.updateWorldBoundingBoxes(component);
451
-
452
- // Update matrices
453
- component.updateMatrix();
454
- component.updateMatrixWorld(true);
455
-
456
- // Check if component is underground and fix if needed (based on settings)
457
- var checkUnderground = (_this$centralPlant$sc3 = this.centralPlant.sceneViewer) === null || _this$centralPlant$sc3 === void 0 || (_this$centralPlant$sc3 = _this$centralPlant$sc3.managers) === null || _this$centralPlant$sc3 === void 0 || (_this$centralPlant$sc3 = _this$centralPlant$sc3.settingsManager) === null || _this$centralPlant$sc3 === void 0 ? void 0 : _this$centralPlant$sc3.getSetting('scene', 'checkUnderground');
458
- if (checkUnderground) {
459
- var wasFixed = this.fixUndergroundComponent(component);
460
- if (wasFixed) {
461
- // Update bounding boxes again after fixing position
462
- this.updateWorldBoundingBoxes(component);
463
- }
464
- }
465
-
466
- // Emit transform event if available
467
- if (this.centralPlant.sceneViewer.emit && typeof this.centralPlant.sceneViewer.emit === 'function') {
468
- this.centralPlant.sceneViewer.emit('objectTransformed', {
469
- object: component,
470
- transformType: 'translate',
471
- axis: axis,
472
- value: value
473
- });
474
- }
475
- console.log("\u2705 translateComponent(): Component ".concat(componentId, " translated successfully"));
476
- return true;
418
+ return this.centralPlant.managers.transformOperationsManager.translateComponent(componentId, axis, value);
477
419
  }
478
420
 
479
421
  /**
480
- * Translate a pipe segment by segmentId (internal implementation)
422
+ * Translate a pipe segment by segmentId (delegates to TransformOperationsManager)
481
423
  * @param {string} segmentId - The UUID of the pipe segment to translate
482
424
  * @param {string} axis - The axis to translate on ('x', 'y', or 'z')
483
425
  * @param {number} value - The value to translate by
@@ -486,129 +428,16 @@ var CentralPlantInternals = /*#__PURE__*/function () {
486
428
  }, {
487
429
  key: "translateSegment",
488
430
  value: function translateSegment(segmentId, axis, value) {
489
- var _this$centralPlant$sc4, _this$centralPlant$ma;
490
- // Use centralized validator for parameter validation
491
- var validation = this.validator.validateTransformationParams(segmentId, axis, value, {
492
- operation: 'translate'
493
- });
494
- if (!validation.isValid) {
495
- return false; // Validator already logged the error
496
- }
497
-
498
- // Validate scene availability
499
- var sceneValidation = this.validator.validateSceneViewer(this.centralPlant.sceneViewer, (_this$centralPlant$sc4 = this.centralPlant.sceneViewer) === null || _this$centralPlant$sc4 === void 0 ? void 0 : _this$centralPlant$sc4.scene);
500
- if (!sceneValidation.isValid) {
501
- return false;
502
- }
503
-
504
- // Find the segment in the scene
505
- var segment = null;
506
- this.centralPlant.sceneViewer.scene.traverse(function (child) {
507
- var _child$userData2;
508
- if (child.uuid === segmentId || ((_child$userData2 = child.userData) === null || _child$userData2 === void 0 ? void 0 : _child$userData2.originalUuid) === segmentId) {
509
- segment = child;
510
- }
511
- });
512
- if (!segment) {
513
- console.error("\u274C translateSegment(): Segment with ID '".concat(segmentId, "' not found in scene"));
514
- return false;
515
- }
516
-
517
- // Validate that it's actually a pipe segment
518
- if (!segment.userData || !segment.userData.isPipeSegment) {
519
- console.error("\u274C translateSegment(): Object with ID '".concat(segmentId, "' is not a valid pipe segment"));
520
- return false;
521
- }
522
-
523
- // Check if segment is horizontal (only horizontal segments can be translated)
524
- if (!this.isSegmentHorizontal(segment)) {
525
- console.warn("\u26A0\uFE0F translateSegment(): Segment '".concat(segmentId, "' is not horizontal. Only horizontal segments can be translated."));
526
- console.log(' Segment orientation: vertical or diagonal');
431
+ var _this$centralPlant$ma2;
432
+ if (!((_this$centralPlant$ma2 = this.centralPlant.managers) !== null && _this$centralPlant$ma2 !== void 0 && _this$centralPlant$ma2.transformOperationsManager)) {
433
+ console.error('❌ translateSegment(): TransformOperationsManager not available');
527
434
  return false;
528
435
  }
529
- console.log('[translateSegment] segment:', segment);
530
-
531
- // Calculate segment endpoints to check for nearby connectors
532
- var segmentEndpoints = this.calculateSegmentEndpoints(segment);
533
-
534
- // Check if there are any connectors (component or manual) at segment endpoints
535
- var connectorsAtEndpoints = this.findConnectorsAtPositions([segmentEndpoints.start, segmentEndpoints.end], 0.15 // tolerance for position matching
536
- );
537
-
538
- // Filter out segment connectors - we only care about component connectors
539
- var componentConnectorsAtEndpoints = connectorsAtEndpoints.filter(function (connector) {
540
- var _connector$userData;
541
- return !((_connector$userData = connector.userData) !== null && _connector$userData !== void 0 && _connector$userData.isManualSegmentConnector);
542
- });
543
- if (componentConnectorsAtEndpoints.length > 0) {
544
- console.warn("\u26A0\uFE0F translateSegment(): Segment '".concat(segmentId, "' has component connectors at endpoints. Cannot translate."));
545
- console.log(" Found ".concat(componentConnectorsAtEndpoints.length, " component connector(s):"), componentConnectorsAtEndpoints.map(function (c) {
546
- var _c$parent;
547
- return {
548
- uuid: c.uuid,
549
- parent: (_c$parent = c.parent) === null || _c$parent === void 0 ? void 0 : _c$parent.uuid
550
- };
551
- }));
552
- return false;
553
- }
554
- console.log("\uD83D\uDD04 translateSegment(): Translating segment ".concat(segmentId, " on ").concat(axis, " axis by ").concat(value));
555
-
556
- // Apply the translation to the Three.js object
557
- segment.position[axis] += value;
558
-
559
- // Update matrices
560
- segment.updateMatrix();
561
- segment.updateMatrixWorld(true);
562
- var pathfindingManager = (_this$centralPlant$ma = this.centralPlant.managers) === null || _this$centralPlant$ma === void 0 ? void 0 : _this$centralPlant$ma.pathfindingManager;
563
- if (!pathfindingManager) {
564
- console.error('❌ translateSegment(): PathfindingManager not available');
565
- return false;
566
- }
567
-
568
- // Check if segment is already declared - if not, manualize it first
569
- if (segment.userData.isDeclared !== true) {
570
- console.log('🔌 Handling manual segment transformation via PathfindingManager (first move)');
571
- try {
572
- pathfindingManager.manualizeSegment(segment, this.centralPlant.sceneViewer.currentSceneData);
573
- } catch (error) {
574
- console.error('❌ translateSegment(): Error in manualizeSegment:', error);
575
- return false;
576
- }
577
- } else {
578
- console.log('🔄 Segment already declared, updating connector positions (subsequent move)');
579
- }
580
-
581
- // ALWAYS update connector positions after segment movement (first or subsequent moves)
582
- this.updateSegmentConnectorPositions(segment);
583
-
584
- // Regenerate paths to create new pipe segments that connect to the moved segment
585
- console.log('🔄 Regenerating paths to create connecting pipe segments...');
586
- try {
587
- if (this.centralPlant.sceneViewer && typeof this.centralPlant.sceneViewer.updatePaths === 'function') {
588
- this.centralPlant.sceneViewer.updatePaths();
589
- console.log('✅ Paths regenerated successfully - new connecting segments created');
590
- } else {
591
- console.warn('⚠️ updatePaths method not available on sceneViewer');
592
- }
593
- } catch (error) {
594
- console.error('❌ Error regenerating paths:', error);
595
- }
596
-
597
- // Emit transform event if available
598
- if (this.centralPlant.sceneViewer.emit && typeof this.centralPlant.sceneViewer.emit === 'function') {
599
- this.centralPlant.sceneViewer.emit('objectTransformed', {
600
- object: segment,
601
- transformType: 'translateSegment',
602
- axis: axis,
603
- value: value
604
- });
605
- }
606
- console.log("\u2705 translateSegment(): Segment ".concat(segmentId, " translated and connections restructured successfully"));
607
- return true;
436
+ return this.centralPlant.managers.transformOperationsManager.translateSegment(segmentId, axis, value);
608
437
  }
609
438
 
610
439
  /**
611
- * Translate a gateway by gatewayId (internal implementation)
440
+ * Translate a gateway by gatewayId (delegates to TransformOperationsManager)
612
441
  * @param {string} gatewayId - The UUID of the gateway to translate
613
442
  * @param {string} axis - The axis to translate on ('x', 'y', or 'z')
614
443
  * @param {number} value - The value to translate by
@@ -617,95 +446,16 @@ var CentralPlantInternals = /*#__PURE__*/function () {
617
446
  }, {
618
447
  key: "translateGateway",
619
448
  value: function translateGateway(gatewayId, axis, value) {
620
- var _this$centralPlant$sc5, _this$centralPlant$ma2;
621
- console.log("[Pathfinder] translateGateway started");
622
- // Use centralized validator for parameter validation
623
- var validation = this.validator.validateTransformationParams(gatewayId, axis, value, {
624
- operation: 'translate'
625
- });
626
- if (!validation.isValid) {
627
- return false; // Validator already logged the error
628
- }
629
-
630
- // Validate scene availability
631
- var sceneValidation = this.validator.validateSceneViewer(this.centralPlant.sceneViewer, (_this$centralPlant$sc5 = this.centralPlant.sceneViewer) === null || _this$centralPlant$sc5 === void 0 ? void 0 : _this$centralPlant$sc5.scene);
632
- if (!sceneValidation.isValid) {
633
- return false;
634
- }
635
-
636
- // Find the gateway in the scene
637
- var gateway = null;
638
- this.centralPlant.sceneViewer.scene.traverse(function (child) {
639
- var _child$userData3;
640
- if (child.uuid === gatewayId || ((_child$userData3 = child.userData) === null || _child$userData3 === void 0 ? void 0 : _child$userData3.originalUuid) === gatewayId) {
641
- gateway = child;
642
- }
643
- });
644
- if (!gateway) {
645
- console.error("\u274C translateGateway(): Gateway with ID '".concat(gatewayId, "' not found in scene"));
646
- return false;
647
- }
648
-
649
- // Validate that it's actually a gateway
650
- if (!gateway.userData || gateway.userData.objectType !== 'gateway') {
651
- console.error("\u274C translateGateway(): Object with ID '".concat(gatewayId, "' is not a valid gateway"));
652
- return false;
653
- }
654
-
655
- // Check if gateway is already declared - allow re-translation of declared gateways
656
- // (unlike segments, gateways can be moved multiple times)
657
-
658
- console.log("\uD83D\uDD04 translateGateway(): Translating gateway ".concat(gatewayId, " on ").concat(axis, " axis by ").concat(value));
659
-
660
- // Apply the translation to the Three.js object
661
- gateway.position[axis] += value;
662
-
663
- // Update matrices
664
- gateway.updateMatrix();
665
- gateway.updateMatrixWorld(true);
666
-
667
- // Handle manual gateway transformation (convert to declared and process connections)
668
- console.log('🔧 Handling manual gateway transformation via PathfindingManager');
669
- var pathfindingManager = (_this$centralPlant$ma2 = this.centralPlant.managers) === null || _this$centralPlant$ma2 === void 0 ? void 0 : _this$centralPlant$ma2.pathfindingManager;
670
- if (!pathfindingManager) {
671
- console.error('❌ translateGateway(): PathfindingManager not available');
449
+ var _this$centralPlant$ma3;
450
+ if (!((_this$centralPlant$ma3 = this.centralPlant.managers) !== null && _this$centralPlant$ma3 !== void 0 && _this$centralPlant$ma3.transformOperationsManager)) {
451
+ console.error('❌ translateGateway(): TransformOperationsManager not available');
672
452
  return false;
673
453
  }
674
- try {
675
- pathfindingManager.manualizeGateway(gateway, this.centralPlant.sceneViewer.currentSceneData);
676
- } catch (error) {
677
- console.error('❌ translateGateway(): Error in manualizeGateway:', error);
678
- return false;
679
- }
680
-
681
- // Regenerate paths to reflect the gateway's new position
682
- console.log('🔄 Regenerating paths to reflect gateway movement...');
683
- try {
684
- if (this.centralPlant.sceneViewer && typeof this.centralPlant.sceneViewer.updatePaths === 'function') {
685
- this.centralPlant.sceneViewer.updatePaths();
686
- console.log('✅ Paths regenerated successfully - routing updated for new gateway position');
687
- } else {
688
- console.warn('⚠️ updatePaths method not available on sceneViewer');
689
- }
690
- } catch (error) {
691
- console.error('❌ Error regenerating paths:', error);
692
- }
693
-
694
- // Emit transform event if available
695
- if (this.centralPlant.sceneViewer.emit && typeof this.centralPlant.sceneViewer.emit === 'function') {
696
- this.centralPlant.sceneViewer.emit('objectTransformed', {
697
- object: gateway,
698
- transformType: 'translateGateway',
699
- axis: axis,
700
- value: value
701
- });
702
- }
703
- console.log("\u2705 translateGateway(): Gateway ".concat(gatewayId, " translated and marked as declared successfully"));
704
- return true;
454
+ return this.centralPlant.managers.transformOperationsManager.translateGateway(gatewayId, axis, value);
705
455
  }
706
456
 
707
457
  /**
708
- * Rotate a component by componentId (internal implementation)
458
+ * Rotate a component by componentId (delegates to TransformOperationsManager)
709
459
  * @param {string} componentId - The UUID of the component to rotate
710
460
  * @param {string} axis - The axis to rotate around ('x', 'y', or 'z')
711
461
  * @param {number} value - The value to rotate by in degrees
@@ -714,81 +464,16 @@ var CentralPlantInternals = /*#__PURE__*/function () {
714
464
  }, {
715
465
  key: "rotateComponent",
716
466
  value: function rotateComponent(componentId, axis, value) {
717
- var _this$centralPlant$sc6;
718
- // Use centralized validator for parameter validation
719
- var validation = this.validator.validateTransformationParams(componentId, axis, value, {
720
- operation: 'rotate'
721
- });
722
- if (!validation.isValid) {
723
- return false; // Validator already logged the error
724
- }
725
-
726
- // Validate scene availability
727
- var sceneValidation = this.validator.validateSceneViewer(this.centralPlant.sceneViewer, (_this$centralPlant$sc6 = this.centralPlant.sceneViewer) === null || _this$centralPlant$sc6 === void 0 ? void 0 : _this$centralPlant$sc6.scene);
728
- if (!sceneValidation.isValid) {
467
+ var _this$centralPlant$ma4;
468
+ if (!((_this$centralPlant$ma4 = this.centralPlant.managers) !== null && _this$centralPlant$ma4 !== void 0 && _this$centralPlant$ma4.transformOperationsManager)) {
469
+ console.error('❌ rotateComponent(): TransformOperationsManager not available');
729
470
  return false;
730
471
  }
731
-
732
- // Find the component in the scene
733
- var component = null;
734
- this.centralPlant.sceneViewer.scene.traverse(function (child) {
735
- var _child$userData4;
736
- if (child.uuid === componentId || ((_child$userData4 = child.userData) === null || _child$userData4 === void 0 ? void 0 : _child$userData4.originalUuid) === componentId) {
737
- component = child;
738
- }
739
- });
740
- if (!component) {
741
- console.error("\u274C rotateComponent(): Component with ID '".concat(componentId, "' not found in scene"));
742
- return false;
743
- }
744
- if (!component.userData.libraryId) {
745
- console.error("\u274C rotateComponent(): Object with ID '".concat(componentId, "' is not a valid component"));
746
- return false;
747
- }
748
-
749
- // Store previous rotation for potential undo
750
- var previousRotation = {
751
- x: component.rotation.x,
752
- y: component.rotation.y,
753
- z: component.rotation.z
754
- };
755
-
756
- // Convert degrees to radians
757
- var radians = value * Math.PI / 180;
758
- console.log("\uD83D\uDD04 rotateComponent(): Rotating component ".concat(componentId, " around ").concat(axis, " axis by ").concat(value, " degrees (").concat(radians, " radians)"));
759
-
760
- // Apply the rotation
761
- component.rotation[axis] += radians;
762
-
763
- // Update direction vectors for connectors if this is a 90-degree rotation
764
- if (value % 90 === 0) {
765
- this.updateConnectorDirections(component, axis, value);
766
- }
767
-
768
- // Update world bounding boxes for the component and its children
769
- this.updateWorldBoundingBoxes(component);
770
-
771
- // Update matrices
772
- component.updateMatrix();
773
- component.updateMatrixWorld(true);
774
-
775
- // Emit transform event if available
776
- if (this.centralPlant.sceneViewer.emit && typeof this.centralPlant.sceneViewer.emit === 'function') {
777
- this.centralPlant.sceneViewer.emit('objectTransformed', {
778
- object: component,
779
- transformType: 'rotate',
780
- axis: axis,
781
- value: value,
782
- radians: radians,
783
- previousRotation: previousRotation
784
- });
785
- }
786
- console.log("\u2705 rotateComponent(): Component ".concat(componentId, " rotated successfully"));
787
- return true;
472
+ return this.centralPlant.managers.transformOperationsManager.rotateComponent(componentId, axis, value);
788
473
  }
789
474
 
790
475
  /**
791
- * Update connector direction vectors after component rotation
476
+ * Update connector direction vectors after component rotation (delegates to TransformOperationsManager)
792
477
  * @param {THREE.Object3D} component - The component that was rotated
793
478
  * @param {string} axis - The axis of rotation ('x', 'y', or 'z')
794
479
  * @param {number} degrees - The rotation angle in degrees (should be multiple of 90)
@@ -797,121 +482,52 @@ var CentralPlantInternals = /*#__PURE__*/function () {
797
482
  }, {
798
483
  key: "updateConnectorDirections",
799
484
  value: function updateConnectorDirections(component, axis, degrees) {
800
- if (!component || degrees % 90 !== 0) {
485
+ var _this$centralPlant$ma5;
486
+ if (!((_this$centralPlant$ma5 = this.centralPlant.managers) !== null && _this$centralPlant$ma5 !== void 0 && _this$centralPlant$ma5.transformOperationsManager)) {
487
+ console.warn('⚠️ updateConnectorDirections(): TransformOperationsManager not available');
801
488
  return;
802
489
  }
803
- console.log("\uD83D\uDD04 Updating connector directions after ".concat(degrees, "\xB0 rotation around ").concat(axis, " axis"));
804
-
805
- // Simple approach: just log that directions may need manual verification
806
- // In most cases, Three.js world matrices handle the actual positioning correctly
807
- component.traverse(function (child) {
808
- var _child$userData5, _child$userData6;
809
- if (((_child$userData5 = child.userData) === null || _child$userData5 === void 0 ? void 0 : _child$userData5.objectType) === 'connector' && (_child$userData6 = child.userData) !== null && _child$userData6 !== void 0 && _child$userData6.direction) {
810
- console.log("\uD83D\uDCCD Connector ".concat(child.uuid, " direction may need verification after rotation"));
811
- }
812
- });
490
+ return this.centralPlant.managers.transformOperationsManager.updateConnectorDirections(component, axis, degrees);
813
491
  }
814
492
 
815
493
  /**
816
- * Update world bounding boxes for a component after transformation
817
- * @param {THREE.Object3D} component - The component that was transformed
818
- * @private
819
- */
820
- }, {
821
- key: "updateWorldBoundingBoxes",
822
- value: function updateWorldBoundingBoxes(component) {
823
- if (!component) {
824
- return;
825
- }
826
- try {
827
- var _this$centralPlant$sc7, _this$centralPlant$sc8;
828
- // Force matrix updates to ensure accurate bounding box calculation
829
- component.updateMatrix();
830
- component.updateMatrixWorld(true);
831
-
832
- // Trigger the pathfinding manager's recompute method if available
833
- if ((_this$centralPlant$sc7 = this.centralPlant.sceneViewer) !== null && _this$centralPlant$sc7 !== void 0 && _this$centralPlant$sc7.pathfindingManager && (_this$centralPlant$sc8 = this.centralPlant.sceneViewer) !== null && _this$centralPlant$sc8 !== void 0 && _this$centralPlant$sc8.currentSceneData && typeof this.centralPlant.sceneViewer.pathfindingManager.recomputeWorldBoundingBoxes === 'function') {
834
- this.centralPlant.sceneViewer.pathfindingManager.recomputeWorldBoundingBoxes(this.centralPlant.sceneViewer.currentSceneData);
835
- console.log('📦 Updated bounding boxes for pathfinding after transform');
836
- }
837
- } catch (error) {
838
- console.warn('⚠️ Error updating bounding boxes:', error);
839
- }
840
- }
841
-
842
- /**
843
- * Check if a component is positioned underground (below Z=0 in Z-up coordinate system)
494
+ * Check if a component is positioned underground (delegates to TransformOperationsManager)
844
495
  * @param {THREE.Object3D} component - The component to check
845
496
  * @returns {Object} Object with { isUnderground: boolean, lowestZ: number, correction: number }
846
497
  */
847
498
  }, {
848
499
  key: "checkComponentUnderground",
849
500
  value: function checkComponentUnderground(component) {
850
- if (!component) {
851
- return {
852
- isUnderground: false,
853
- lowestZ: 0,
854
- correction: 0
855
- };
856
- }
857
- try {
858
- // Calculate bounding box in world coordinates
859
- var boundingBox = new THREE__namespace.Box3().setFromObject(component);
860
-
861
- // In Z-up coordinate system, ground is at z=0
862
- // Check the lowest Z point of the bounding box
863
- var lowestZ = boundingBox.min.z;
864
- var isUnderground = lowestZ < 0;
865
-
866
- // Calculate how much we need to move up to put the lowest point at ground level
867
- var correction = isUnderground ? Math.abs(lowestZ) : 0;
868
- return {
869
- isUnderground: isUnderground,
870
- lowestZ: lowestZ,
871
- correction: correction
872
- };
873
- } catch (error) {
874
- console.warn('⚠️ Error checking component underground status:', error);
501
+ var _this$centralPlant$ma6;
502
+ if (!((_this$centralPlant$ma6 = this.centralPlant.managers) !== null && _this$centralPlant$ma6 !== void 0 && _this$centralPlant$ma6.transformOperationsManager)) {
503
+ console.warn('⚠️ checkComponentUnderground(): TransformOperationsManager not available');
875
504
  return {
876
505
  isUnderground: false,
877
506
  lowestZ: 0,
878
507
  correction: 0
879
508
  };
880
509
  }
510
+ return this.centralPlant.managers.transformOperationsManager.checkComponentUnderground(component);
881
511
  }
882
512
 
883
513
  /**
884
- * Fix component position if it's underground
514
+ * Fix component position if it's underground (delegates to TransformOperationsManager)
885
515
  * @param {THREE.Object3D} component - The component to fix
886
516
  * @returns {boolean} True if component was adjusted, false otherwise
887
517
  */
888
518
  }, {
889
519
  key: "fixUndergroundComponent",
890
520
  value: function fixUndergroundComponent(component) {
891
- if (!component) {
521
+ var _this$centralPlant$ma7;
522
+ if (!((_this$centralPlant$ma7 = this.centralPlant.managers) !== null && _this$centralPlant$ma7 !== void 0 && _this$centralPlant$ma7.transformOperationsManager)) {
523
+ console.warn('⚠️ fixUndergroundComponent(): TransformOperationsManager not available');
892
524
  return false;
893
525
  }
894
- var checkResult = this.checkComponentUnderground(component);
895
- if (checkResult.isUnderground) {
896
- var _component$userData;
897
- var componentId = component.uuid || ((_component$userData = component.userData) === null || _component$userData === void 0 ? void 0 : _component$userData.originalUuid) || 'unknown';
898
- console.log("\uD83D\uDD27 Component ".concat(componentId, " is underground (lowest Z: ").concat(checkResult.lowestZ.toFixed(3), "), moving up by ").concat(checkResult.correction.toFixed(3)));
899
-
900
- // Move the component up so its lowest point is at ground level (z=0)
901
- component.position.z += checkResult.correction;
902
-
903
- // Update matrices
904
- component.updateMatrix();
905
- component.updateMatrixWorld(true);
906
- console.log("\u2705 Component ".concat(componentId, " moved to surface (new position Z: ").concat(component.position.z.toFixed(3), ")"));
907
- return true;
908
- }
909
- return false;
526
+ return this.centralPlant.managers.transformOperationsManager.fixUndergroundComponent(component);
910
527
  }
911
528
 
912
529
  /**
913
- * Check if a pipe segment is horizontal (Z-axis aligned in Z-up coordinate system)
914
- * A segment is considered horizontal if its direction vector has minimal Z component
530
+ * Check if a pipe segment is horizontal (delegates to TransformOperationsManager)
915
531
  * @param {THREE.Object3D} segment - The pipe segment to check
916
532
  * @param {number} tolerance - Angular tolerance in radians (default: ~5.7 degrees)
917
533
  * @returns {boolean} True if segment is horizontal, false otherwise
@@ -920,27 +536,17 @@ var CentralPlantInternals = /*#__PURE__*/function () {
920
536
  }, {
921
537
  key: "isSegmentHorizontal",
922
538
  value: function isSegmentHorizontal(segment) {
539
+ var _this$centralPlant$ma8;
923
540
  var tolerance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.1;
924
- if (!segment || !segment.geometry || !segment.quaternion) {
925
- console.warn('⚠️ Invalid segment provided to isSegmentHorizontal');
541
+ if (!((_this$centralPlant$ma8 = this.centralPlant.managers) !== null && _this$centralPlant$ma8 !== void 0 && _this$centralPlant$ma8.transformOperationsManager)) {
542
+ console.warn('⚠️ isSegmentHorizontal(): TransformOperationsManager not available');
926
543
  return false;
927
544
  }
928
-
929
- // Get the segment's direction vector (cylinder aligned with Y-axis by default)
930
- var direction = new THREE__namespace.Vector3(0, 1, 0);
931
- direction.applyQuaternion(segment.quaternion);
932
- direction.normalize();
933
-
934
- // In Z-up coordinate system, horizontal segments should have Z component near 0
935
- // A perfectly horizontal segment would have direction.z = 0
936
- var zComponent = Math.abs(direction.z);
937
-
938
- // Allow small tolerance for floating point precision
939
- return zComponent < tolerance;
545
+ return this.centralPlant.managers.transformOperationsManager.isSegmentHorizontal(segment, tolerance);
940
546
  }
941
547
 
942
548
  /**
943
- * Calculate segment endpoints in world coordinates
549
+ * Calculate segment endpoints in world coordinates (delegates to TransformOperationsManager)
944
550
  * @param {THREE.Object3D} segment - The pipe segment
945
551
  * @returns {Object} Object with start and end Vector3 points
946
552
  * @private
@@ -948,31 +554,19 @@ var CentralPlantInternals = /*#__PURE__*/function () {
948
554
  }, {
949
555
  key: "calculateSegmentEndpoints",
950
556
  value: function calculateSegmentEndpoints(segment) {
951
- // Get the segment's geometry to determine its length and orientation
952
- var geometry = segment.geometry;
953
- var length = geometry.parameters.height || 1;
954
-
955
- // Calculate start and end points based on segment position and orientation
956
- var startPoint = new THREE__namespace.Vector3();
957
- var endPoint = new THREE__namespace.Vector3();
958
-
959
- // Get the segment's direction vector
960
- var direction = new THREE__namespace.Vector3(0, 1, 0);
961
- direction.applyQuaternion(segment.quaternion);
962
-
963
- // Calculate start point (half length back from center)
964
- startPoint.copy(segment.position).sub(direction.clone().multiplyScalar(length / 2));
965
-
966
- // Calculate end point (half length forward from center)
967
- endPoint.copy(segment.position).add(direction.clone().multiplyScalar(length / 2));
968
- return {
969
- start: startPoint,
970
- end: endPoint
971
- };
557
+ var _this$centralPlant$ma9;
558
+ if (!((_this$centralPlant$ma9 = this.centralPlant.managers) !== null && _this$centralPlant$ma9 !== void 0 && _this$centralPlant$ma9.transformOperationsManager)) {
559
+ console.warn('⚠️ calculateSegmentEndpoints(): TransformOperationsManager not available');
560
+ return {
561
+ start: new THREE__namespace.Vector3(),
562
+ end: new THREE__namespace.Vector3()
563
+ };
564
+ }
565
+ return this.centralPlant.managers.transformOperationsManager.calculateSegmentEndpoints(segment);
972
566
  }
973
567
 
974
568
  /**
975
- * Find all connectors (component or manual) at given positions
569
+ * Find all connectors at given positions (delegates to TransformOperationsManager)
976
570
  * @param {Array<THREE.Vector3>} positions - Array of positions to check
977
571
  * @param {number} tolerance - Distance tolerance for position matching
978
572
  * @returns {Array<THREE.Object3D>} Array of connector objects found at positions
@@ -981,112 +575,29 @@ var CentralPlantInternals = /*#__PURE__*/function () {
981
575
  }, {
982
576
  key: "findConnectorsAtPositions",
983
577
  value: function findConnectorsAtPositions(positions) {
984
- var _this$centralPlant$sc9;
578
+ var _this$centralPlant$ma0;
985
579
  var tolerance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.15;
986
- if (!((_this$centralPlant$sc9 = this.centralPlant.sceneViewer) !== null && _this$centralPlant$sc9 !== void 0 && _this$centralPlant$sc9.scene)) {
580
+ if (!((_this$centralPlant$ma0 = this.centralPlant.managers) !== null && _this$centralPlant$ma0 !== void 0 && _this$centralPlant$ma0.transformOperationsManager)) {
581
+ console.warn('⚠️ findConnectorsAtPositions(): TransformOperationsManager not available');
987
582
  return [];
988
583
  }
989
- var foundConnectors = [];
990
-
991
- // Traverse scene to find all connectors
992
- this.centralPlant.sceneViewer.scene.traverse(function (child) {
993
- var _child$userData7;
994
- // Check if this is a connector (component connector or manual segment connector)
995
- if (((_child$userData7 = child.userData) === null || _child$userData7 === void 0 ? void 0 : _child$userData7.objectType) === 'connector') {
996
- // Get world position of connector
997
- var connectorWorldPos = new THREE__namespace.Vector3();
998
- child.getWorldPosition(connectorWorldPos);
999
-
1000
- // Check if connector is near any of the target positions
1001
- var _iterator = _rollupPluginBabelHelpers.createForOfIteratorHelper(positions),
1002
- _step;
1003
- try {
1004
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
1005
- var position = _step.value;
1006
- var distance = connectorWorldPos.distanceTo(position);
1007
- if (distance <= tolerance) {
1008
- foundConnectors.push(child);
1009
- break; // Don't count the same connector twice
1010
- }
1011
- }
1012
- } catch (err) {
1013
- _iterator.e(err);
1014
- } finally {
1015
- _iterator.f();
1016
- }
1017
- }
1018
- });
1019
- return foundConnectors;
584
+ return this.centralPlant.managers.transformOperationsManager.findConnectorsAtPositions(positions, tolerance);
1020
585
  }
1021
586
 
1022
587
  /**
1023
- * Update connector positions in scene data after a declared segment is moved
588
+ * Update connector positions in scene data after a declared segment is moved (delegates to TransformOperationsManager)
1024
589
  * @param {THREE.Object3D} segment - The segment whose connectors need updating
1025
590
  * @private
1026
591
  */
1027
592
  }, {
1028
593
  key: "updateSegmentConnectorPositions",
1029
594
  value: function updateSegmentConnectorPositions(segment) {
1030
- var _this$centralPlant$sc0;
1031
- console.log("updateSegmentConnectorPositions started:", segment);
1032
- if (!segment || !((_this$centralPlant$sc0 = this.centralPlant.sceneViewer) !== null && _this$centralPlant$sc0 !== void 0 && (_this$centralPlant$sc0 = _this$centralPlant$sc0.currentSceneData) !== null && _this$centralPlant$sc0 !== void 0 && _this$centralPlant$sc0.scene)) {
1033
- console.warn('⚠️ updateSegmentConnectorPositions(): Missing segment or scene data');
595
+ var _this$centralPlant$ma1;
596
+ if (!((_this$centralPlant$ma1 = this.centralPlant.managers) !== null && _this$centralPlant$ma1 !== void 0 && _this$centralPlant$ma1.transformOperationsManager)) {
597
+ console.warn('⚠️ updateSegmentConnectorPositions(): TransformOperationsManager not available');
1034
598
  return;
1035
599
  }
1036
-
1037
- // Helper function to clean up floating-point precision errors
1038
- var cleanPosition = function cleanPosition(value) {
1039
- return Math.abs(value) < 1e-10 ? 0 : value;
1040
- };
1041
-
1042
- // Find all child connectors of the segment
1043
- var connectors = [];
1044
- segment.traverse(function (child) {
1045
- var _child$userData8, _child$userData9;
1046
- if (((_child$userData8 = child.userData) === null || _child$userData8 === void 0 ? void 0 : _child$userData8.objectType) === 'connector' && (_child$userData9 = child.userData) !== null && _child$userData9 !== void 0 && _child$userData9.isManualSegmentConnector) {
1047
- connectors.push(child);
1048
- }
1049
- });
1050
- if (connectors.length === 0) {
1051
- console.warn("\u26A0\uFE0F No connectors found for segment ".concat(segment.uuid));
1052
- return;
1053
- }
1054
- console.log("\uD83D\uDCCD Updating ".concat(connectors.length, " connector positions in scene data for segment ").concat(segment.uuid));
1055
-
1056
- // First, find the segment in scene data
1057
- var sceneDataSegment = this.centralPlant.sceneViewer.currentSceneData.scene.children.find(function (child) {
1058
- var _segment$userData;
1059
- return child.uuid === segment.uuid || child.uuid === ((_segment$userData = segment.userData) === null || _segment$userData === void 0 ? void 0 : _segment$userData.originalUuid);
1060
- });
1061
- if (!sceneDataSegment) {
1062
- console.warn("\u26A0\uFE0F Segment ".concat(segment.uuid, " not found in scene data"));
1063
- return;
1064
- }
1065
- if (!sceneDataSegment.children || !Array.isArray(sceneDataSegment.children)) {
1066
- console.warn("\u26A0\uFE0F Segment ".concat(segment.uuid, " has no children array in scene data"));
1067
- return;
1068
- }
1069
- console.log("\u2705 Found segment in scene data with ".concat(sceneDataSegment.children.length, " children"));
1070
-
1071
- // Update each connector's position in scene data
1072
- connectors.forEach(function (connector) {
1073
- // Get world position
1074
- var worldPosition = new THREE__namespace.Vector3();
1075
- connector.getWorldPosition(worldPosition);
1076
-
1077
- // Find the connector in the segment's children array (not root scene.children)
1078
- var sceneDataConnector = sceneDataSegment.children.find(function (child) {
1079
- var _connector$userData2;
1080
- return child.uuid === connector.uuid || child.uuid === ((_connector$userData2 = connector.userData) === null || _connector$userData2 === void 0 ? void 0 : _connector$userData2.originalUuid);
1081
- });
1082
- if (sceneDataConnector && sceneDataConnector.userData) {
1083
- // Update position as array [x, y, z] for pathfinder compatibility
1084
- sceneDataConnector.userData.position = [cleanPosition(worldPosition.x), cleanPosition(worldPosition.y), cleanPosition(worldPosition.z)];
1085
- console.log("\u2705 Updated connector ".concat(connector.uuid, " position to [").concat(sceneDataConnector.userData.position.join(', '), "]"));
1086
- } else {
1087
- console.warn("\u26A0\uFE0F Connector ".concat(connector.uuid, " not found in segment's children in scene data"));
1088
- }
1089
- });
600
+ return this.centralPlant.managers.transformOperationsManager.updateSegmentConnectorPositions(segment);
1090
601
  }
1091
602
 
1092
603
  // ===== COMPONENT AND CONNECTION OPERATIONS =====
@@ -1100,9 +611,9 @@ var CentralPlantInternals = /*#__PURE__*/function () {
1100
611
  }, {
1101
612
  key: "addConnection",
1102
613
  value: function addConnection(fromConnectorId, toConnectorId) {
1103
- var _this$centralPlant$sc1;
614
+ var _this$centralPlant$sc2;
1104
615
  // Use centralized validation for connection parameters
1105
- var existingConnections = ((_this$centralPlant$sc1 = this.centralPlant.sceneViewer) === null || _this$centralPlant$sc1 === void 0 || (_this$centralPlant$sc1 = _this$centralPlant$sc1.currentSceneData) === null || _this$centralPlant$sc1 === void 0 ? void 0 : _this$centralPlant$sc1.connections) || [];
616
+ var existingConnections = ((_this$centralPlant$sc2 = this.centralPlant.sceneViewer) === null || _this$centralPlant$sc2 === void 0 || (_this$centralPlant$sc2 = _this$centralPlant$sc2.currentSceneData) === null || _this$centralPlant$sc2 === void 0 ? void 0 : _this$centralPlant$sc2.connections) || [];
1106
617
  var validation = this.validator.validateConnectionParams(fromConnectorId, toConnectorId, existingConnections);
1107
618
  if (!validation.isValid) {
1108
619
  return false; // Validator already logged the error
@@ -1228,7 +739,7 @@ var CentralPlantInternals = /*#__PURE__*/function () {
1228
739
  }, {
1229
740
  key: "addComponent",
1230
741
  value: function addComponent(libraryId) {
1231
- var _this$centralPlant$sc10;
742
+ var _this$centralPlant$sc3;
1232
743
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1233
744
  // Use centralized validation for component addition parameters
1234
745
  var existingIds = this.getComponentIds();
@@ -1238,7 +749,7 @@ var CentralPlantInternals = /*#__PURE__*/function () {
1238
749
  }
1239
750
 
1240
751
  // Validate scene availability
1241
- var sceneValidation = this.validator.validateSceneViewer(this.centralPlant.sceneViewer, (_this$centralPlant$sc10 = this.centralPlant.sceneViewer) === null || _this$centralPlant$sc10 === void 0 ? void 0 : _this$centralPlant$sc10.scene);
752
+ var sceneValidation = this.validator.validateSceneViewer(this.centralPlant.sceneViewer, (_this$centralPlant$sc3 = this.centralPlant.sceneViewer) === null || _this$centralPlant$sc3 === void 0 ? void 0 : _this$centralPlant$sc3.scene);
1242
753
  if (!sceneValidation.isValid) {
1243
754
  return false;
1244
755
  }
@@ -1257,7 +768,7 @@ var CentralPlantInternals = /*#__PURE__*/function () {
1257
768
  return false;
1258
769
  }
1259
770
  try {
1260
- var _this$centralPlant$sc11;
771
+ var _this$centralPlant$sc4;
1261
772
  // Generate a unique component ID if not provided
1262
773
  var componentId = options.customId || this.generateUniqueComponentId(libraryId);
1263
774
 
@@ -1320,9 +831,7 @@ var CentralPlantInternals = /*#__PURE__*/function () {
1320
831
  originalUuid: componentId,
1321
832
  addedTimestamp: new Date().toISOString(),
1322
833
  addedBy: 'centralPlant.addComponent()',
1323
- isUserAdded: true,
1324
- initialPosition: _rollupPluginBabelHelpers.objectSpread2({}, position),
1325
- initialRotation: _rollupPluginBabelHelpers.objectSpread2({}, rotation)
834
+ initialPosition: _rollupPluginBabelHelpers.objectSpread2({}, position)
1326
835
  };
1327
836
 
1328
837
  // Add the component to the scene
@@ -1333,7 +842,7 @@ var CentralPlantInternals = /*#__PURE__*/function () {
1333
842
  componentModel.updateMatrixWorld(true);
1334
843
 
1335
844
  // Check if component is underground and fix if needed (based on settings)
1336
- var checkUnderground = (_this$centralPlant$sc11 = this.centralPlant.sceneViewer) === null || _this$centralPlant$sc11 === void 0 || (_this$centralPlant$sc11 = _this$centralPlant$sc11.managers) === null || _this$centralPlant$sc11 === void 0 || (_this$centralPlant$sc11 = _this$centralPlant$sc11.settingsManager) === null || _this$centralPlant$sc11 === void 0 ? void 0 : _this$centralPlant$sc11.getSetting('scene', 'checkUnderground');
845
+ var checkUnderground = (_this$centralPlant$sc4 = this.centralPlant.sceneViewer) === null || _this$centralPlant$sc4 === void 0 || (_this$centralPlant$sc4 = _this$centralPlant$sc4.managers) === null || _this$centralPlant$sc4 === void 0 || (_this$centralPlant$sc4 = _this$centralPlant$sc4.settingsManager) === null || _this$centralPlant$sc4 === void 0 ? void 0 : _this$centralPlant$sc4.getSetting('scene', 'checkUnderground');
1337
846
  if (checkUnderground) {
1338
847
  var wasFixed = this.fixUndergroundComponent(componentModel);
1339
848
  if (wasFixed) {
@@ -1453,8 +962,8 @@ var CentralPlantInternals = /*#__PURE__*/function () {
1453
962
  }
1454
963
  var componentIds = [];
1455
964
  this.centralPlant.sceneViewer.scene.traverse(function (child) {
1456
- var _child$userData0;
1457
- if (((_child$userData0 = child.userData) === null || _child$userData0 === void 0 ? void 0 : _child$userData0.objectType) === 'component') {
965
+ var _child$userData;
966
+ if (((_child$userData = child.userData) === null || _child$userData === void 0 ? void 0 : _child$userData.objectType) === 'component') {
1458
967
  componentIds.push(child.uuid || child.userData.originalUuid);
1459
968
  }
1460
969
  });