@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.
- package/dist/bundle/index.js +337 -119
- package/dist/cjs/src/core/centralPlant.js +1 -1
- package/dist/cjs/src/managers/controls/transformControls.js +68 -30
- package/dist/cjs/src/managers/controls/transformControlsManager.js +265 -87
- package/dist/cjs/src/managers/pathfinding/pathfindingManager.js +3 -1
- package/dist/esm/src/core/centralPlant.js +1 -1
- package/dist/esm/src/managers/controls/transformControls.js +69 -31
- package/dist/esm/src/managers/controls/transformControlsManager.js +265 -87
- package/dist/esm/src/managers/pathfinding/pathfindingManager.js +3 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineProperty as _defineProperty, inherits as _inherits, createClass as _createClass, objectSpread2 as _objectSpread2, createForOfIteratorHelper as _createForOfIteratorHelper, superPropGet as _superPropGet, classCallCheck as _classCallCheck, callSuper as _callSuper } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
2
|
import * as THREE from 'three';
|
|
3
3
|
|
|
4
4
|
// Reusable objects to avoid garbage collection
|
|
@@ -64,6 +64,11 @@ var transformControls = /*#__PURE__*/function (_THREE$Object3D) {
|
|
|
64
64
|
_this.showY = true;
|
|
65
65
|
_this.showZ = true;
|
|
66
66
|
|
|
67
|
+
// Axis interactivity (pickers). Visual handles can remain visible when false.
|
|
68
|
+
_this.pickX = true;
|
|
69
|
+
_this.pickY = true;
|
|
70
|
+
_this.pickZ = true;
|
|
71
|
+
|
|
67
72
|
// Click timing for interaction delays
|
|
68
73
|
_this.clickDelay = null;
|
|
69
74
|
_this.lastInteractionTime = 0;
|
|
@@ -217,6 +222,9 @@ var transformControls = /*#__PURE__*/function (_THREE$Object3D) {
|
|
|
217
222
|
this.lastInteractionTime = currentTime;
|
|
218
223
|
}
|
|
219
224
|
if (this.axis !== null) {
|
|
225
|
+
if (!this._isAxisPickable(this.axis)) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
220
228
|
_raycaster.setFromCamera(pointer, this.camera);
|
|
221
229
|
var planeIntersect = this._intersectObjectWithRay(this._plane, _raycaster, true);
|
|
222
230
|
if (planeIntersect) {
|
|
@@ -487,10 +495,19 @@ var transformControls = /*#__PURE__*/function (_THREE$Object3D) {
|
|
|
487
495
|
value: function getMode() {
|
|
488
496
|
return this.mode;
|
|
489
497
|
}
|
|
498
|
+
}, {
|
|
499
|
+
key: "_isAxisPickable",
|
|
500
|
+
value: function _isAxisPickable(axisName) {
|
|
501
|
+
if (!axisName) return false;
|
|
502
|
+
if (axisName.indexOf('X') !== -1) return this.pickX !== false;
|
|
503
|
+
if (axisName.indexOf('Y') !== -1) return this.pickY !== false;
|
|
504
|
+
if (axisName.indexOf('Z') !== -1) return this.pickZ !== false;
|
|
505
|
+
return true;
|
|
506
|
+
}
|
|
490
507
|
}, {
|
|
491
508
|
key: "setMode",
|
|
492
509
|
value: function setMode(mode) {
|
|
493
|
-
if (mode !== 'translate') {
|
|
510
|
+
if (mode !== 'translate' && mode !== 'rotate') {
|
|
494
511
|
console.warn("transformControls: ".concat(mode, " mode is disabled. Locking to translate."));
|
|
495
512
|
mode = 'translate';
|
|
496
513
|
}
|
|
@@ -731,6 +748,7 @@ var SimpleTransformGizmo = /*#__PURE__*/function (_THREE$Object3D2) {
|
|
|
731
748
|
}, {
|
|
732
749
|
key: "updateGizmoState",
|
|
733
750
|
value: function updateGizmoState(controls) {
|
|
751
|
+
var _this$gizmo$controls$, _this$gizmo$controls$2, _this$picker$controls, _this$picker$controls2;
|
|
734
752
|
// Show only the gizmo for current mode
|
|
735
753
|
this.gizmo['translate'].visible = controls.mode === 'translate';
|
|
736
754
|
this.gizmo['rotate'].visible = controls.mode === 'rotate';
|
|
@@ -748,43 +766,62 @@ var SimpleTransformGizmo = /*#__PURE__*/function (_THREE$Object3D2) {
|
|
|
748
766
|
// Force maximum render priority for all gizmo objects
|
|
749
767
|
this._forceMaxRenderOrder();
|
|
750
768
|
|
|
751
|
-
//
|
|
752
|
-
var
|
|
769
|
+
// Scale based on camera distance
|
|
770
|
+
var factor;
|
|
771
|
+
if (controls.camera.isOrthographicCamera) {
|
|
772
|
+
factor = (controls.camera.top - controls.camera.bottom) / controls.camera.zoom;
|
|
773
|
+
} else {
|
|
774
|
+
factor = controls.worldPosition.distanceTo(controls.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * controls.camera.fov / 360) / controls.camera.zoom, 7);
|
|
775
|
+
}
|
|
776
|
+
this.scale.setScalar(factor * controls.size / 4);
|
|
777
|
+
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);
|
|
778
|
+
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);
|
|
779
|
+
}
|
|
780
|
+
}, {
|
|
781
|
+
key: "_isAxisShown",
|
|
782
|
+
value: function _isAxisShown(controls, axisName) {
|
|
783
|
+
if (axisName.indexOf('X') !== -1 && !controls.showX) return false;
|
|
784
|
+
if (axisName.indexOf('Y') !== -1 && !controls.showY) return false;
|
|
785
|
+
if (axisName.indexOf('Z') !== -1 && !controls.showZ) return false;
|
|
786
|
+
return true;
|
|
787
|
+
}
|
|
788
|
+
}, {
|
|
789
|
+
key: "_isAxisPickable",
|
|
790
|
+
value: function _isAxisPickable(controls, axisName) {
|
|
791
|
+
if (axisName.indexOf('X') !== -1) return controls.pickX !== false;
|
|
792
|
+
if (axisName.indexOf('Y') !== -1) return controls.pickY !== false;
|
|
793
|
+
if (axisName.indexOf('Z') !== -1) return controls.pickZ !== false;
|
|
794
|
+
return true;
|
|
795
|
+
}
|
|
796
|
+
}, {
|
|
797
|
+
key: "_updateModeHandles",
|
|
798
|
+
value: function _updateModeHandles(controls, handles, isPicker) {
|
|
753
799
|
var _iterator = _createForOfIteratorHelper(handles),
|
|
754
800
|
_step;
|
|
755
801
|
try {
|
|
756
802
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
803
|
+
var _handle$material$_ori;
|
|
757
804
|
var handle = _step.value;
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
} else {
|
|
765
|
-
factor = controls.worldPosition.distanceTo(controls.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * controls.camera.fov / 360) / controls.camera.zoom, 7);
|
|
805
|
+
var axisName = handle.name;
|
|
806
|
+
var shown = this._isAxisShown(controls, axisName);
|
|
807
|
+
var pickable = this._isAxisPickable(controls, axisName);
|
|
808
|
+
if (isPicker) {
|
|
809
|
+
handle.visible = shown && pickable;
|
|
810
|
+
continue;
|
|
766
811
|
}
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
if (
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
handle.material._originalColor = handle.material._originalColor || handle.material.color.clone();
|
|
779
|
-
handle.material._originalOpacity = handle.material._originalOpacity || handle.material.opacity;
|
|
812
|
+
handle.visible = shown;
|
|
813
|
+
if (!handle.material) continue;
|
|
814
|
+
handle.material._originalColor = handle.material._originalColor || handle.material.color.clone();
|
|
815
|
+
handle.material._originalOpacity = (_handle$material$_ori = handle.material._originalOpacity) !== null && _handle$material$_ori !== void 0 ? _handle$material$_ori : handle.material.opacity;
|
|
816
|
+
if (shown && pickable && controls.enabled && controls.axis === axisName) {
|
|
817
|
+
handle.material.color.setHex(0xffff00);
|
|
818
|
+
handle.material.opacity = 1.0;
|
|
819
|
+
} else if (shown && !pickable) {
|
|
820
|
+
handle.material.color.copy(handle.material._originalColor);
|
|
821
|
+
handle.material.opacity = SimpleTransformGizmo.DISABLED_AXIS_OPACITY;
|
|
822
|
+
} else {
|
|
780
823
|
handle.material.color.copy(handle.material._originalColor);
|
|
781
824
|
handle.material.opacity = handle.material._originalOpacity;
|
|
782
|
-
if (controls.enabled && controls.axis) {
|
|
783
|
-
if (handle.name === controls.axis) {
|
|
784
|
-
handle.material.color.setHex(0xffff00);
|
|
785
|
-
handle.material.opacity = 1.0;
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
825
|
}
|
|
789
826
|
}
|
|
790
827
|
} catch (err) {
|
|
@@ -834,6 +871,7 @@ var SimpleTransformGizmo = /*#__PURE__*/function (_THREE$Object3D2) {
|
|
|
834
871
|
* Optimized plane for transformation interactions
|
|
835
872
|
* Simplified geometry and material for better performance
|
|
836
873
|
*/
|
|
874
|
+
_defineProperty(SimpleTransformGizmo, "DISABLED_AXIS_OPACITY", 0.3);
|
|
837
875
|
var SimpleTransformPlane = /*#__PURE__*/function (_THREE$Mesh) {
|
|
838
876
|
function SimpleTransformPlane() {
|
|
839
877
|
var _this4;
|