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