@2112-lab/central-plant 0.3.50 → 0.3.52

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.
@@ -58,7 +58,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
58
58
  * Initialize the CentralPlant manager
59
59
  *
60
60
  * @constructor
61
- * @version 0.3.50
61
+ * @version 0.3.52
62
62
  * @updated 2025-10-22
63
63
  *
64
64
  * @description Creates a new CentralPlant instance and initializes internal managers and utilities.
@@ -88,6 +88,11 @@ var transformControls = /*#__PURE__*/function (_THREE$Object3D) {
88
88
  _this.showY = true;
89
89
  _this.showZ = true;
90
90
 
91
+ // Axis interactivity (pickers). Visual handles can remain visible when false.
92
+ _this.pickX = true;
93
+ _this.pickY = true;
94
+ _this.pickZ = true;
95
+
91
96
  // Click timing for interaction delays
92
97
  _this.clickDelay = null;
93
98
  _this.lastInteractionTime = 0;
@@ -241,6 +246,9 @@ var transformControls = /*#__PURE__*/function (_THREE$Object3D) {
241
246
  this.lastInteractionTime = currentTime;
242
247
  }
243
248
  if (this.axis !== null) {
249
+ if (!this._isAxisPickable(this.axis)) {
250
+ return;
251
+ }
244
252
  _raycaster.setFromCamera(pointer, this.camera);
245
253
  var planeIntersect = this._intersectObjectWithRay(this._plane, _raycaster, true);
246
254
  if (planeIntersect) {
@@ -511,10 +519,19 @@ var transformControls = /*#__PURE__*/function (_THREE$Object3D) {
511
519
  value: function getMode() {
512
520
  return this.mode;
513
521
  }
522
+ }, {
523
+ key: "_isAxisPickable",
524
+ value: function _isAxisPickable(axisName) {
525
+ if (!axisName) return false;
526
+ if (axisName.indexOf('X') !== -1) return this.pickX !== false;
527
+ if (axisName.indexOf('Y') !== -1) return this.pickY !== false;
528
+ if (axisName.indexOf('Z') !== -1) return this.pickZ !== false;
529
+ return true;
530
+ }
514
531
  }, {
515
532
  key: "setMode",
516
533
  value: function setMode(mode) {
517
- if (mode !== 'translate') {
534
+ if (mode !== 'translate' && mode !== 'rotate') {
518
535
  console.warn("transformControls: ".concat(mode, " mode is disabled. Locking to translate."));
519
536
  mode = 'translate';
520
537
  }
@@ -755,6 +772,7 @@ var SimpleTransformGizmo = /*#__PURE__*/function (_THREE$Object3D2) {
755
772
  }, {
756
773
  key: "updateGizmoState",
757
774
  value: function updateGizmoState(controls) {
775
+ var _this$gizmo$controls$, _this$gizmo$controls$2, _this$picker$controls, _this$picker$controls2;
758
776
  // Show only the gizmo for current mode
759
777
  this.gizmo['translate'].visible = controls.mode === 'translate';
760
778
  this.gizmo['rotate'].visible = controls.mode === 'rotate';
@@ -772,43 +790,62 @@ var SimpleTransformGizmo = /*#__PURE__*/function (_THREE$Object3D2) {
772
790
  // Force maximum render priority for all gizmo objects
773
791
  this._forceMaxRenderOrder();
774
792
 
775
- // Update all handles for the current mode
776
- var handles = [].concat(_rollupPluginBabelHelpers.toConsumableArray(this.picker[controls.mode].children), _rollupPluginBabelHelpers.toConsumableArray(this.gizmo[controls.mode].children));
793
+ // Scale based on camera distance
794
+ var factor;
795
+ if (controls.camera.isOrthographicCamera) {
796
+ factor = (controls.camera.top - controls.camera.bottom) / controls.camera.zoom;
797
+ } else {
798
+ factor = controls.worldPosition.distanceTo(controls.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * controls.camera.fov / 360) / controls.camera.zoom, 7);
799
+ }
800
+ this.scale.setScalar(factor * controls.size / 4);
801
+ this._updateModeHandles(controls, (_this$gizmo$controls$ = (_this$gizmo$controls$2 = this.gizmo[controls.mode]) === null || _this$gizmo$controls$2 === void 0 ? void 0 : _this$gizmo$controls$2.children) !== null && _this$gizmo$controls$ !== void 0 ? _this$gizmo$controls$ : [], false);
802
+ this._updateModeHandles(controls, (_this$picker$controls = (_this$picker$controls2 = this.picker[controls.mode]) === null || _this$picker$controls2 === void 0 ? void 0 : _this$picker$controls2.children) !== null && _this$picker$controls !== void 0 ? _this$picker$controls : [], true);
803
+ }
804
+ }, {
805
+ key: "_isAxisShown",
806
+ value: function _isAxisShown(controls, axisName) {
807
+ if (axisName.indexOf('X') !== -1 && !controls.showX) return false;
808
+ if (axisName.indexOf('Y') !== -1 && !controls.showY) return false;
809
+ if (axisName.indexOf('Z') !== -1 && !controls.showZ) return false;
810
+ return true;
811
+ }
812
+ }, {
813
+ key: "_isAxisPickable",
814
+ value: function _isAxisPickable(controls, axisName) {
815
+ if (axisName.indexOf('X') !== -1) return controls.pickX !== false;
816
+ if (axisName.indexOf('Y') !== -1) return controls.pickY !== false;
817
+ if (axisName.indexOf('Z') !== -1) return controls.pickZ !== false;
818
+ return true;
819
+ }
820
+ }, {
821
+ key: "_updateModeHandles",
822
+ value: function _updateModeHandles(controls, handles, isPicker) {
777
823
  var _iterator = _rollupPluginBabelHelpers.createForOfIteratorHelper(handles),
778
824
  _step;
779
825
  try {
780
826
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
827
+ var _handle$material$_ori;
781
828
  var handle = _step.value;
782
- handle.visible = true;
783
-
784
- // Scale based on camera distance
785
- var factor = void 0;
786
- if (controls.camera.isOrthographicCamera) {
787
- factor = (controls.camera.top - controls.camera.bottom) / controls.camera.zoom;
788
- } else {
789
- factor = controls.worldPosition.distanceTo(controls.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * controls.camera.fov / 360) / controls.camera.zoom, 7);
829
+ var axisName = handle.name;
830
+ var shown = this._isAxisShown(controls, axisName);
831
+ var pickable = this._isAxisPickable(controls, axisName);
832
+ if (isPicker) {
833
+ handle.visible = shown && pickable;
834
+ continue;
790
835
  }
791
-
792
- // Apply scale to the entire gizmo, not individual handles
793
- this.scale.setScalar(factor * controls.size / 4);
794
-
795
- // Apply axis visibility constraints
796
- if (handle.name.indexOf('X') !== -1 && !controls.showX) handle.visible = false;
797
- if (handle.name.indexOf('Y') !== -1 && !controls.showY) handle.visible = false;
798
- if (handle.name.indexOf('Z') !== -1 && !controls.showZ) handle.visible = false;
799
-
800
- // Highlight selected axis
801
- if (handle.material) {
802
- handle.material._originalColor = handle.material._originalColor || handle.material.color.clone();
803
- handle.material._originalOpacity = handle.material._originalOpacity || handle.material.opacity;
836
+ handle.visible = shown;
837
+ if (!handle.material) continue;
838
+ handle.material._originalColor = handle.material._originalColor || handle.material.color.clone();
839
+ handle.material._originalOpacity = (_handle$material$_ori = handle.material._originalOpacity) !== null && _handle$material$_ori !== void 0 ? _handle$material$_ori : handle.material.opacity;
840
+ if (shown && pickable && controls.enabled && controls.axis === axisName) {
841
+ handle.material.color.setHex(0xffff00);
842
+ handle.material.opacity = 1.0;
843
+ } else if (shown && !pickable) {
844
+ handle.material.color.copy(handle.material._originalColor);
845
+ handle.material.opacity = SimpleTransformGizmo.DISABLED_AXIS_OPACITY;
846
+ } else {
804
847
  handle.material.color.copy(handle.material._originalColor);
805
848
  handle.material.opacity = handle.material._originalOpacity;
806
- if (controls.enabled && controls.axis) {
807
- if (handle.name === controls.axis) {
808
- handle.material.color.setHex(0xffff00);
809
- handle.material.opacity = 1.0;
810
- }
811
- }
812
849
  }
813
850
  }
814
851
  } catch (err) {
@@ -858,6 +895,7 @@ var SimpleTransformGizmo = /*#__PURE__*/function (_THREE$Object3D2) {
858
895
  * Optimized plane for transformation interactions
859
896
  * Simplified geometry and material for better performance
860
897
  */
898
+ _rollupPluginBabelHelpers.defineProperty(SimpleTransformGizmo, "DISABLED_AXIS_OPACITY", 0.3);
861
899
  var SimpleTransformPlane = /*#__PURE__*/function (_THREE$Mesh) {
862
900
  function SimpleTransformPlane() {
863
901
  var _this4;