@2112-lab/central-plant 0.3.10 → 0.3.11

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.
@@ -36199,14 +36199,26 @@ var Viewport2DManager = /*#__PURE__*/function (_BaseDisposable2) {
36199
36199
  var deltaZ = newPosition.z - currentPos.z;
36200
36200
  if ((_this6$sceneViewer2 = _this6.sceneViewer) !== null && _this6$sceneViewer2 !== void 0 && _this6$sceneViewer2.centralPlant && component.uuid) {
36201
36201
  var success = true;
36202
- if (Math.abs(deltaX) > 0.01) {
36203
- success = success && _this6.sceneViewer.centralPlant.translate(component.uuid, 'x', deltaX);
36204
- }
36205
- if (Math.abs(deltaY) > 0.01) {
36206
- success = success && _this6.sceneViewer.centralPlant.translate(component.uuid, 'y', deltaY);
36207
- }
36208
- if (Math.abs(deltaZ) > 0.01) {
36209
- success = success && _this6.sceneViewer.centralPlant.translate(component.uuid, 'z', deltaZ);
36202
+
36203
+ // Suppress per-axis path updates so the pathfinder only runs once,
36204
+ // after ALL axes have been translated, with the final combined position.
36205
+ // Running updatePaths() after each individual axis (the default
36206
+ // translateComponent behaviour) produces intermediate wrong results on
36207
+ // the first drag because no cached fingerprint exists yet to skip them.
36208
+ var wasAutoUpdate = _this6.sceneViewer.shouldUpdatePaths;
36209
+ _this6.sceneViewer.shouldUpdatePaths = false;
36210
+ try {
36211
+ if (Math.abs(deltaX) > 0.01) {
36212
+ success = success && _this6.sceneViewer.centralPlant.translate(component.uuid, 'x', deltaX);
36213
+ }
36214
+ if (Math.abs(deltaY) > 0.01) {
36215
+ success = success && _this6.sceneViewer.centralPlant.translate(component.uuid, 'y', deltaY);
36216
+ }
36217
+ if (Math.abs(deltaZ) > 0.01) {
36218
+ success = success && _this6.sceneViewer.centralPlant.translate(component.uuid, 'z', deltaZ);
36219
+ }
36220
+ } finally {
36221
+ _this6.sceneViewer.shouldUpdatePaths = wasAutoUpdate;
36210
36222
  }
36211
36223
  if (!success && _this6.dragStartPosition) {
36212
36224
  console.warn('⚠️ Failed to translate component, reverting position');
@@ -36214,8 +36226,8 @@ var Viewport2DManager = /*#__PURE__*/function (_BaseDisposable2) {
36214
36226
  } else {
36215
36227
  console.log("\u2705 Component ".concat(component.name, " translated successfully in 2D viewport"));
36216
36228
 
36217
- // Auto-update paths if enabled
36218
- if (_this6.sceneViewer && _this6.sceneViewer.shouldUpdatePaths) {
36229
+ // Single path update with the final combined position
36230
+ if (wasAutoUpdate && _this6.sceneViewer) {
36219
36231
  console.log('🔄 Auto-updating paths after 2D viewport translation...');
36220
36232
  try {
36221
36233
  _this6.sceneViewer.updatePaths();
@@ -37934,7 +37946,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
37934
37946
  * Initialize the CentralPlant manager
37935
37947
  *
37936
37948
  * @constructor
37937
- * @version 0.3.10
37949
+ * @version 0.3.11
37938
37950
  * @updated 2025-10-22
37939
37951
  *
37940
37952
  * @description Creates a new CentralPlant instance and initializes internal managers and utilities.
@@ -35,7 +35,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
35
35
  * Initialize the CentralPlant manager
36
36
  *
37
37
  * @constructor
38
- * @version 0.3.10
38
+ * @version 0.3.11
39
39
  * @updated 2025-10-22
40
40
  *
41
41
  * @description Creates a new CentralPlant instance and initializes internal managers and utilities.
@@ -882,14 +882,26 @@ var Viewport2DManager = /*#__PURE__*/function (_BaseDisposable2) {
882
882
  var deltaZ = newPosition.z - currentPos.z;
883
883
  if ((_this6$sceneViewer2 = _this6.sceneViewer) !== null && _this6$sceneViewer2 !== void 0 && _this6$sceneViewer2.centralPlant && component.uuid) {
884
884
  var success = true;
885
- if (Math.abs(deltaX) > 0.01) {
886
- success = success && _this6.sceneViewer.centralPlant.translate(component.uuid, 'x', deltaX);
887
- }
888
- if (Math.abs(deltaY) > 0.01) {
889
- success = success && _this6.sceneViewer.centralPlant.translate(component.uuid, 'y', deltaY);
890
- }
891
- if (Math.abs(deltaZ) > 0.01) {
892
- success = success && _this6.sceneViewer.centralPlant.translate(component.uuid, 'z', deltaZ);
885
+
886
+ // Suppress per-axis path updates so the pathfinder only runs once,
887
+ // after ALL axes have been translated, with the final combined position.
888
+ // Running updatePaths() after each individual axis (the default
889
+ // translateComponent behaviour) produces intermediate wrong results on
890
+ // the first drag because no cached fingerprint exists yet to skip them.
891
+ var wasAutoUpdate = _this6.sceneViewer.shouldUpdatePaths;
892
+ _this6.sceneViewer.shouldUpdatePaths = false;
893
+ try {
894
+ if (Math.abs(deltaX) > 0.01) {
895
+ success = success && _this6.sceneViewer.centralPlant.translate(component.uuid, 'x', deltaX);
896
+ }
897
+ if (Math.abs(deltaY) > 0.01) {
898
+ success = success && _this6.sceneViewer.centralPlant.translate(component.uuid, 'y', deltaY);
899
+ }
900
+ if (Math.abs(deltaZ) > 0.01) {
901
+ success = success && _this6.sceneViewer.centralPlant.translate(component.uuid, 'z', deltaZ);
902
+ }
903
+ } finally {
904
+ _this6.sceneViewer.shouldUpdatePaths = wasAutoUpdate;
893
905
  }
894
906
  if (!success && _this6.dragStartPosition) {
895
907
  console.warn('⚠️ Failed to translate component, reverting position');
@@ -897,8 +909,8 @@ var Viewport2DManager = /*#__PURE__*/function (_BaseDisposable2) {
897
909
  } else {
898
910
  console.log("\u2705 Component ".concat(component.name, " translated successfully in 2D viewport"));
899
911
 
900
- // Auto-update paths if enabled
901
- if (_this6.sceneViewer && _this6.sceneViewer.shouldUpdatePaths) {
912
+ // Single path update with the final combined position
913
+ if (wasAutoUpdate && _this6.sceneViewer) {
902
914
  console.log('🔄 Auto-updating paths after 2D viewport translation...');
903
915
  try {
904
916
  _this6.sceneViewer.updatePaths();
@@ -31,7 +31,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
31
31
  * Initialize the CentralPlant manager
32
32
  *
33
33
  * @constructor
34
- * @version 0.3.10
34
+ * @version 0.3.11
35
35
  * @updated 2025-10-22
36
36
  *
37
37
  * @description Creates a new CentralPlant instance and initializes internal managers and utilities.
@@ -858,14 +858,26 @@ var Viewport2DManager = /*#__PURE__*/function (_BaseDisposable2) {
858
858
  var deltaZ = newPosition.z - currentPos.z;
859
859
  if ((_this6$sceneViewer2 = _this6.sceneViewer) !== null && _this6$sceneViewer2 !== void 0 && _this6$sceneViewer2.centralPlant && component.uuid) {
860
860
  var success = true;
861
- if (Math.abs(deltaX) > 0.01) {
862
- success = success && _this6.sceneViewer.centralPlant.translate(component.uuid, 'x', deltaX);
863
- }
864
- if (Math.abs(deltaY) > 0.01) {
865
- success = success && _this6.sceneViewer.centralPlant.translate(component.uuid, 'y', deltaY);
866
- }
867
- if (Math.abs(deltaZ) > 0.01) {
868
- success = success && _this6.sceneViewer.centralPlant.translate(component.uuid, 'z', deltaZ);
861
+
862
+ // Suppress per-axis path updates so the pathfinder only runs once,
863
+ // after ALL axes have been translated, with the final combined position.
864
+ // Running updatePaths() after each individual axis (the default
865
+ // translateComponent behaviour) produces intermediate wrong results on
866
+ // the first drag because no cached fingerprint exists yet to skip them.
867
+ var wasAutoUpdate = _this6.sceneViewer.shouldUpdatePaths;
868
+ _this6.sceneViewer.shouldUpdatePaths = false;
869
+ try {
870
+ if (Math.abs(deltaX) > 0.01) {
871
+ success = success && _this6.sceneViewer.centralPlant.translate(component.uuid, 'x', deltaX);
872
+ }
873
+ if (Math.abs(deltaY) > 0.01) {
874
+ success = success && _this6.sceneViewer.centralPlant.translate(component.uuid, 'y', deltaY);
875
+ }
876
+ if (Math.abs(deltaZ) > 0.01) {
877
+ success = success && _this6.sceneViewer.centralPlant.translate(component.uuid, 'z', deltaZ);
878
+ }
879
+ } finally {
880
+ _this6.sceneViewer.shouldUpdatePaths = wasAutoUpdate;
869
881
  }
870
882
  if (!success && _this6.dragStartPosition) {
871
883
  console.warn('⚠️ Failed to translate component, reverting position');
@@ -873,8 +885,8 @@ var Viewport2DManager = /*#__PURE__*/function (_BaseDisposable2) {
873
885
  } else {
874
886
  console.log("\u2705 Component ".concat(component.name, " translated successfully in 2D viewport"));
875
887
 
876
- // Auto-update paths if enabled
877
- if (_this6.sceneViewer && _this6.sceneViewer.shouldUpdatePaths) {
888
+ // Single path update with the final combined position
889
+ if (wasAutoUpdate && _this6.sceneViewer) {
878
890
  console.log('🔄 Auto-updating paths after 2D viewport translation...');
879
891
  try {
880
892
  _this6.sceneViewer.updatePaths();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@2112-lab/central-plant",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
4
4
  "description": "Utility modules for the Central Plant Application",
5
5
  "main": "dist/bundle/index.js",
6
6
  "module": "dist/esm/src/index.js",