@2112-lab/central-plant 0.3.33 → 0.3.35
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 +621 -95
- package/dist/cjs/src/core/centralPlant.js +40 -14
- package/dist/cjs/src/core/centralPlantInternals.js +6 -0
- package/dist/cjs/src/core/sceneViewer.js +6 -24
- package/dist/cjs/src/managers/behaviors/IoBehaviorManager.js +515 -41
- package/dist/cjs/src/managers/controls/transformControlsManager.js +32 -10
- package/dist/cjs/src/managers/scene/modelManager.js +11 -5
- package/dist/cjs/src/managers/scene/sceneOperationsManager.js +11 -1
- package/dist/esm/src/core/centralPlant.js +40 -14
- package/dist/esm/src/core/centralPlantInternals.js +6 -0
- package/dist/esm/src/core/sceneViewer.js +6 -24
- package/dist/esm/src/managers/behaviors/IoBehaviorManager.js +516 -42
- package/dist/esm/src/managers/controls/transformControlsManager.js +32 -10
- package/dist/esm/src/managers/scene/modelManager.js +11 -5
- package/dist/esm/src/managers/scene/sceneOperationsManager.js +11 -1
- package/package.json +1 -1
|
@@ -463,6 +463,7 @@ var TransformControlsManager = /*#__PURE__*/function () {
|
|
|
463
463
|
// Detect pointerdown on an IO device mesh and convert a drag gesture into
|
|
464
464
|
// state changes. Up/right = positive direction, down/left = negative.
|
|
465
465
|
this.eventHandlers.pointerdown = function (event) {
|
|
466
|
+
var _ioDeviceObject$userD, _this4$sceneViewer;
|
|
466
467
|
if (_this4.transformState.isTransforming) return;
|
|
467
468
|
if (!_this4.callbacks.onIODeviceDrag) return;
|
|
468
469
|
_this4._calculateMousePosition(event, mouse);
|
|
@@ -475,14 +476,14 @@ var TransformControlsManager = /*#__PURE__*/function () {
|
|
|
475
476
|
try {
|
|
476
477
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
477
478
|
var hit = _step.value;
|
|
478
|
-
var
|
|
479
|
-
while (
|
|
480
|
-
var _obj$
|
|
481
|
-
if (((_obj$
|
|
482
|
-
ioDeviceObject =
|
|
479
|
+
var _obj = hit.object;
|
|
480
|
+
while (_obj) {
|
|
481
|
+
var _obj$userData2;
|
|
482
|
+
if (((_obj$userData2 = _obj.userData) === null || _obj$userData2 === void 0 ? void 0 : _obj$userData2.objectType) === 'io-device') {
|
|
483
|
+
ioDeviceObject = _obj;
|
|
483
484
|
break;
|
|
484
485
|
}
|
|
485
|
-
|
|
486
|
+
_obj = _obj.parent;
|
|
486
487
|
}
|
|
487
488
|
if (ioDeviceObject) {
|
|
488
489
|
hitMesh = hit.object;
|
|
@@ -496,6 +497,27 @@ var TransformControlsManager = /*#__PURE__*/function () {
|
|
|
496
497
|
}
|
|
497
498
|
if (!ioDeviceObject) return;
|
|
498
499
|
|
|
500
|
+
// Only allow drag if the clicked mesh is animated (not the parent io-device group)
|
|
501
|
+
// Resolve parentUuid and attachmentId
|
|
502
|
+
var parentUuid = null;
|
|
503
|
+
var obj = ioDeviceObject.parent;
|
|
504
|
+
while (obj) {
|
|
505
|
+
var _obj$userData;
|
|
506
|
+
if (((_obj$userData = obj.userData) === null || _obj$userData === void 0 ? void 0 : _obj$userData.objectType) === 'component') {
|
|
507
|
+
parentUuid = obj.userData.originalUuid || obj.uuid;
|
|
508
|
+
break;
|
|
509
|
+
}
|
|
510
|
+
obj = obj.parent;
|
|
511
|
+
}
|
|
512
|
+
var attachmentId = (_ioDeviceObject$userD = ioDeviceObject.userData) === null || _ioDeviceObject$userD === void 0 ? void 0 : _ioDeviceObject$userD.attachmentId;
|
|
513
|
+
if (parentUuid && attachmentId && (_this4$sceneViewer = _this4.sceneViewer) !== null && _this4$sceneViewer !== void 0 && (_this4$sceneViewer = _this4$sceneViewer.managers) !== null && _this4$sceneViewer !== void 0 && _this4$sceneViewer.ioBehaviorManager) {
|
|
514
|
+
var animatedMeshes = _this4.sceneViewer.managers.ioBehaviorManager.getAnimatedMeshes(parentUuid, attachmentId);
|
|
515
|
+
// If there are animated meshes registered, only allow drag if hitMesh is one of them
|
|
516
|
+
if (animatedMeshes.length > 0 && !animatedMeshes.includes(hitMesh)) {
|
|
517
|
+
return; // Clicked on non-draggable part of the io-device
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
|
|
499
521
|
// Begin session
|
|
500
522
|
_this4._ioDragMesh = ioDeviceObject;
|
|
501
523
|
_this4._ioDragStartX = event.clientX;
|
|
@@ -558,8 +580,8 @@ var TransformControlsManager = /*#__PURE__*/function () {
|
|
|
558
580
|
var hit = _step2.value;
|
|
559
581
|
var obj = hit.object;
|
|
560
582
|
while (obj) {
|
|
561
|
-
var _obj$
|
|
562
|
-
if (((_obj$
|
|
583
|
+
var _obj$userData3;
|
|
584
|
+
if (((_obj$userData3 = obj.userData) === null || _obj$userData3 === void 0 ? void 0 : _obj$userData3.objectType) === 'io-device') {
|
|
563
585
|
_this4.callbacks.onIODeviceClick(obj);
|
|
564
586
|
return;
|
|
565
587
|
}
|
|
@@ -2219,8 +2241,8 @@ var TransformControlsManager = /*#__PURE__*/function () {
|
|
|
2219
2241
|
key: "_updateSegmentReference",
|
|
2220
2242
|
value: function _updateSegmentReference(oldSegment, newSegment, index) {
|
|
2221
2243
|
var selectedIndex = this.selectedObjects.findIndex(function (obj) {
|
|
2222
|
-
var _obj$
|
|
2223
|
-
return obj.uuid === oldSegment.uuid || ((_obj$
|
|
2244
|
+
var _obj$userData4;
|
|
2245
|
+
return obj.uuid === oldSegment.uuid || ((_obj$userData4 = obj.userData) === null || _obj$userData4 === void 0 ? void 0 : _obj$userData4.originalUuid) === oldSegment.uuid;
|
|
2224
2246
|
});
|
|
2225
2247
|
if (selectedIndex !== -1 && newSegment) {
|
|
2226
2248
|
// Clear bounding box cache
|
|
@@ -114,7 +114,7 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
114
114
|
|
|
115
115
|
// Attach IO devices for smart components (import flow)
|
|
116
116
|
if (!(componentData.isSmart && componentData.attachedDevices)) {
|
|
117
|
-
_context2.n =
|
|
117
|
+
_context2.n = 9;
|
|
118
118
|
break;
|
|
119
119
|
}
|
|
120
120
|
_context2.n = 4;
|
|
@@ -123,7 +123,7 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
123
123
|
// Register behavior configs for each attached device
|
|
124
124
|
ioBehavMgr = (_this$sceneViewer = this.sceneViewer) === null || _this$sceneViewer === void 0 || (_this$sceneViewer = _this$sceneViewer.managers) === null || _this$sceneViewer === void 0 ? void 0 : _this$sceneViewer.ioBehaviorManager;
|
|
125
125
|
if (!ioBehavMgr) {
|
|
126
|
-
_context2.n =
|
|
126
|
+
_context2.n = 9;
|
|
127
127
|
break;
|
|
128
128
|
}
|
|
129
129
|
_loop = /*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _loop() {
|
|
@@ -172,6 +172,12 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
172
172
|
_context2.n = 5;
|
|
173
173
|
break;
|
|
174
174
|
case 8:
|
|
175
|
+
// Register component-level behaviors (intra-component io-device linking)
|
|
176
|
+
if (componentData.behaviors && componentData.behaviors.length > 0) {
|
|
177
|
+
console.log("[ModelManager] Registering ".concat(componentData.behaviors.length, " component-level behavior(s) for ").concat(originalProps.uuid));
|
|
178
|
+
ioBehavMgr.registerComponentBehaviors(originalProps.uuid, componentData.behaviors);
|
|
179
|
+
}
|
|
180
|
+
case 9:
|
|
175
181
|
// Replace mesh in scene
|
|
176
182
|
this._replaceMeshInScene(targetMesh, libraryModel, originalProps.parent, component);
|
|
177
183
|
|
|
@@ -190,13 +196,13 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
190
196
|
}
|
|
191
197
|
console.log("\uD83C\uDF89 ".concat((_jsonEntry$userData3 = jsonEntry.userData) === null || _jsonEntry$userData3 === void 0 ? void 0 : _jsonEntry$userData3.libraryId, " GLB model successfully rendered in scene"));
|
|
192
198
|
return _context2.a(2, libraryModel);
|
|
193
|
-
case
|
|
194
|
-
_context2.p =
|
|
199
|
+
case 10:
|
|
200
|
+
_context2.p = 10;
|
|
195
201
|
_t = _context2.v;
|
|
196
202
|
console.error("\u274C Error loading ".concat((_jsonEntry$userData4 = jsonEntry.userData) === null || _jsonEntry$userData4 === void 0 ? void 0 : _jsonEntry$userData4.libraryId, " GLB model:"), _t);
|
|
197
203
|
return _context2.a(2, targetMesh);
|
|
198
204
|
}
|
|
199
|
-
}, _callee, this, [[1,
|
|
205
|
+
}, _callee, this, [[1, 10]]);
|
|
200
206
|
}));
|
|
201
207
|
function loadLibraryModel(_x, _x2, _x3) {
|
|
202
208
|
return _loadLibraryModel.apply(this, arguments);
|
|
@@ -792,7 +792,7 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
792
792
|
key: "_prepareSceneForLoading",
|
|
793
793
|
value: (function () {
|
|
794
794
|
var _prepareSceneForLoading2 = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee5(data, isImported) {
|
|
795
|
-
var component, _component$managers;
|
|
795
|
+
var component, _component$managers, _component$managers2, ioBehavMgr;
|
|
796
796
|
return _rollupPluginBabelHelpers.regenerator().w(function (_context5) {
|
|
797
797
|
while (1) switch (_context5.n) {
|
|
798
798
|
case 0:
|
|
@@ -809,6 +809,16 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
809
809
|
if ((_component$managers = component.managers) !== null && _component$managers !== void 0 && (_component$managers = _component$managers.pathfinding) !== null && _component$managers !== void 0 && _component$managers.snapshotManager) {
|
|
810
810
|
component.managers.pathfinding.snapshotManager.reset();
|
|
811
811
|
}
|
|
812
|
+
|
|
813
|
+
// Register behaviors with IoBehaviorManager
|
|
814
|
+
ioBehavMgr = (_component$managers2 = component.managers) === null || _component$managers2 === void 0 ? void 0 : _component$managers2.ioBehaviorManager;
|
|
815
|
+
if (ioBehavMgr && data.behaviors) {
|
|
816
|
+
console.log("[Behavior] Registering ".concat(data.behaviors.length, " behavior(s) from scene data"));
|
|
817
|
+
ioBehavMgr.setCrossComponentBehaviors(data.behaviors);
|
|
818
|
+
} else if (ioBehavMgr) {
|
|
819
|
+
console.log('[Behavior] No behaviors in scene data, clearing cross-component behaviors');
|
|
820
|
+
ioBehavMgr.setCrossComponentBehaviors([]);
|
|
821
|
+
}
|
|
812
822
|
case 2:
|
|
813
823
|
// Mark all imported objects as declared in the scene data
|
|
814
824
|
// This ensures manual segment connectors and other objects are recognized as declared
|
|
@@ -31,7 +31,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
31
31
|
* Initialize the CentralPlant manager
|
|
32
32
|
*
|
|
33
33
|
* @constructor
|
|
34
|
-
* @version 0.3.
|
|
34
|
+
* @version 0.3.35
|
|
35
35
|
* @updated 2025-10-22
|
|
36
36
|
*
|
|
37
37
|
* @description Creates a new CentralPlant instance and initializes internal managers and utilities.
|
|
@@ -205,7 +205,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
205
205
|
key: "setImportedSceneData",
|
|
206
206
|
value: (function () {
|
|
207
207
|
var _setImportedSceneData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(sceneData) {
|
|
208
|
-
var _this$importedSceneDa, _this$importedSceneDa2;
|
|
208
|
+
var _this$importedSceneDa, _this$importedSceneDa2, _this$importedSceneDa3, _this$sceneViewer;
|
|
209
|
+
var ioBehavMgr;
|
|
209
210
|
return _regenerator().w(function (_context2) {
|
|
210
211
|
while (1) switch (_context2.n) {
|
|
211
212
|
case 0:
|
|
@@ -216,8 +217,19 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
216
217
|
console.log('📥 Imported scene data stored in CentralPlant:', {
|
|
217
218
|
connections: ((_this$importedSceneDa = this.importedSceneData.connections) === null || _this$importedSceneDa === void 0 ? void 0 : _this$importedSceneDa.length) || 0,
|
|
218
219
|
sceneObjects: ((_this$importedSceneDa2 = this.importedSceneData.scene) === null || _this$importedSceneDa2 === void 0 || (_this$importedSceneDa2 = _this$importedSceneDa2.children) === null || _this$importedSceneDa2 === void 0 ? void 0 : _this$importedSceneDa2.length) || 0,
|
|
220
|
+
behaviors: ((_this$importedSceneDa3 = this.importedSceneData.behaviors) === null || _this$importedSceneDa3 === void 0 ? void 0 : _this$importedSceneDa3.length) || 0,
|
|
219
221
|
timestamp: new Date().toISOString()
|
|
220
222
|
});
|
|
223
|
+
console.log('[Behavior] Scene behaviors detail:', this.importedSceneData.behaviors);
|
|
224
|
+
|
|
225
|
+
// Register behaviors with IoBehaviorManager
|
|
226
|
+
ioBehavMgr = (_this$sceneViewer = this.sceneViewer) === null || _this$sceneViewer === void 0 || (_this$sceneViewer = _this$sceneViewer.managers) === null || _this$sceneViewer === void 0 ? void 0 : _this$sceneViewer.ioBehaviorManager;
|
|
227
|
+
if (ioBehavMgr) {
|
|
228
|
+
console.log('[Behavior] Calling setCrossComponentBehaviors with:', this.importedSceneData.behaviors || []);
|
|
229
|
+
ioBehavMgr.setCrossComponentBehaviors(this.importedSceneData.behaviors || []);
|
|
230
|
+
} else {
|
|
231
|
+
console.warn('[Behavior] ioBehaviorManager not available!');
|
|
232
|
+
}
|
|
221
233
|
|
|
222
234
|
// Reset component counter based on imported components to avoid ID conflicts
|
|
223
235
|
this.internals.resetComponentCounter();
|
|
@@ -398,8 +410,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
398
410
|
}, {
|
|
399
411
|
key: "selectObject",
|
|
400
412
|
value: function selectObject(objectOrId) {
|
|
401
|
-
var _this$
|
|
402
|
-
if (!((_this$
|
|
413
|
+
var _this$sceneViewer2, _object;
|
|
414
|
+
if (!((_this$sceneViewer2 = this.sceneViewer) !== null && _this$sceneViewer2 !== void 0 && _this$sceneViewer2.transformManager)) {
|
|
403
415
|
console.warn('⚠️ Transform manager not initialized');
|
|
404
416
|
return false;
|
|
405
417
|
}
|
|
@@ -445,8 +457,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
445
457
|
}, {
|
|
446
458
|
key: "toggleObject",
|
|
447
459
|
value: function toggleObject(objectOrId) {
|
|
448
|
-
var _this$
|
|
449
|
-
if (!((_this$
|
|
460
|
+
var _this$sceneViewer3, _object2;
|
|
461
|
+
if (!((_this$sceneViewer3 = this.sceneViewer) !== null && _this$sceneViewer3 !== void 0 && _this$sceneViewer3.transformManager)) {
|
|
450
462
|
console.warn('⚠️ Transform manager not initialized');
|
|
451
463
|
return false;
|
|
452
464
|
}
|
|
@@ -482,8 +494,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
482
494
|
}, {
|
|
483
495
|
key: "deselectObject",
|
|
484
496
|
value: function deselectObject() {
|
|
485
|
-
var _this$
|
|
486
|
-
if (!((_this$
|
|
497
|
+
var _this$sceneViewer4;
|
|
498
|
+
if (!((_this$sceneViewer4 = this.sceneViewer) !== null && _this$sceneViewer4 !== void 0 && _this$sceneViewer4.transformManager)) {
|
|
487
499
|
console.warn('⚠️ Transform manager not initialized');
|
|
488
500
|
return false;
|
|
489
501
|
}
|
|
@@ -1097,9 +1109,9 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1097
1109
|
}, {
|
|
1098
1110
|
key: "setIoDeviceState",
|
|
1099
1111
|
value: function setIoDeviceState(attachmentId, stateId, value, parentUuid) {
|
|
1100
|
-
var _this$
|
|
1112
|
+
var _this$sceneViewer5, _this$sceneViewer6, _this$sceneViewer7;
|
|
1101
1113
|
// 1. Persist via state adapter if one has been configured
|
|
1102
|
-
var stateAdapter = (_this$
|
|
1114
|
+
var stateAdapter = (_this$sceneViewer5 = this.sceneViewer) === null || _this$sceneViewer5 === void 0 || (_this$sceneViewer5 = _this$sceneViewer5.managers) === null || _this$sceneViewer5 === void 0 || (_this$sceneViewer5 = _this$sceneViewer5.componentTooltipManager) === null || _this$sceneViewer5 === void 0 ? void 0 : _this$sceneViewer5._stateAdapter;
|
|
1103
1115
|
if (stateAdapter !== null && stateAdapter !== void 0 && stateAdapter.setState) {
|
|
1104
1116
|
var scopedKey = parentUuid ? "".concat(parentUuid, "::").concat(attachmentId) : attachmentId;
|
|
1105
1117
|
try {
|
|
@@ -1110,10 +1122,19 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1110
1122
|
}
|
|
1111
1123
|
|
|
1112
1124
|
// 2. Apply io-behavior changes
|
|
1113
|
-
(_this$
|
|
1125
|
+
var ioBehavMgr = (_this$sceneViewer6 = this.sceneViewer) === null || _this$sceneViewer6 === void 0 || (_this$sceneViewer6 = _this$sceneViewer6.managers) === null || _this$sceneViewer6 === void 0 ? void 0 : _this$sceneViewer6.ioBehaviorManager;
|
|
1126
|
+
if (ioBehavMgr) {
|
|
1127
|
+
var _this$importedSceneDa4;
|
|
1128
|
+
ioBehavMgr.triggerState(attachmentId, stateId, value, parentUuid);
|
|
1129
|
+
|
|
1130
|
+
// Evaluate cross-component behaviors if they exist in the imported scene
|
|
1131
|
+
if ((_this$importedSceneDa4 = this.importedSceneData) !== null && _this$importedSceneDa4 !== void 0 && _this$importedSceneDa4.behaviors) {
|
|
1132
|
+
ioBehavMgr.triggerCrossComponentBehaviors(this.importedSceneData.behaviors, parentUuid, attachmentId, stateId, value);
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1114
1135
|
|
|
1115
1136
|
// 3. Emit event for host apps that don't use the state adapter (e.g. cp3d-viewer)
|
|
1116
|
-
(_this$
|
|
1137
|
+
(_this$sceneViewer7 = this.sceneViewer) === null || _this$sceneViewer7 === void 0 || _this$sceneViewer7.emit('io-device-state-changed', {
|
|
1117
1138
|
attachmentId: attachmentId,
|
|
1118
1139
|
stateId: stateId,
|
|
1119
1140
|
value: value,
|
|
@@ -1135,8 +1156,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1135
1156
|
}, {
|
|
1136
1157
|
key: "getSceneAttachments",
|
|
1137
1158
|
value: function getSceneAttachments() {
|
|
1138
|
-
var _this$
|
|
1139
|
-
var scene = (_this$
|
|
1159
|
+
var _this$sceneViewer8;
|
|
1160
|
+
var scene = (_this$sceneViewer8 = this.sceneViewer) === null || _this$sceneViewer8 === void 0 ? void 0 : _this$sceneViewer8.scene;
|
|
1140
1161
|
if (!scene) return [];
|
|
1141
1162
|
var results = [];
|
|
1142
1163
|
scene.traverse(function (obj) {
|
|
@@ -2763,7 +2784,12 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
2763
2784
|
}, {
|
|
2764
2785
|
key: "clearScene",
|
|
2765
2786
|
value: function clearScene() {
|
|
2787
|
+
var _this$sceneViewer9;
|
|
2766
2788
|
this.importedSceneData = null;
|
|
2789
|
+
var ioBehavMgr = (_this$sceneViewer9 = this.sceneViewer) === null || _this$sceneViewer9 === void 0 || (_this$sceneViewer9 = _this$sceneViewer9.managers) === null || _this$sceneViewer9 === void 0 ? void 0 : _this$sceneViewer9.ioBehaviorManager;
|
|
2790
|
+
if (ioBehavMgr) {
|
|
2791
|
+
ioBehavMgr.setCrossComponentBehaviors([]);
|
|
2792
|
+
}
|
|
2767
2793
|
if (this.sceneViewer && this.sceneViewer.scene) {
|
|
2768
2794
|
this.sceneViewer.scene.clear();
|
|
2769
2795
|
}
|
|
@@ -1150,6 +1150,12 @@ var CentralPlantInternals = /*#__PURE__*/function () {
|
|
|
1150
1150
|
for (var _i = 0, _Object$entries = Object.entries(componentData.attachedDevices); _i < _Object$entries.length; _i++) {
|
|
1151
1151
|
if (_loop()) continue;
|
|
1152
1152
|
}
|
|
1153
|
+
|
|
1154
|
+
// Register component-level behaviors (intra-component io-device linking)
|
|
1155
|
+
if (componentData.behaviors && componentData.behaviors.length > 0) {
|
|
1156
|
+
console.log("[DragDrop] Registering ".concat(componentData.behaviors.length, " component-level behavior(s) for ").concat(componentId));
|
|
1157
|
+
ioBehavMgr.registerComponentBehaviors(componentId, componentData.behaviors);
|
|
1158
|
+
}
|
|
1153
1159
|
}
|
|
1154
1160
|
}
|
|
1155
1161
|
|
|
@@ -430,28 +430,10 @@ var sceneViewer = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
430
430
|
},
|
|
431
431
|
onIODeviceDrag: function onIODeviceDrag(ioDeviceObject, signedDelta, isStart, hitMesh) {
|
|
432
432
|
if (isStart) {
|
|
433
|
-
var
|
|
434
|
-
//
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
var parentUuid = null;
|
|
438
|
-
var obj = ioDeviceObject.parent;
|
|
439
|
-
while (obj) {
|
|
440
|
-
var _obj$userData;
|
|
441
|
-
if (((_obj$userData = obj.userData) === null || _obj$userData === void 0 ? void 0 : _obj$userData.objectType) === 'component') {
|
|
442
|
-
parentUuid = obj.userData.originalUuid || obj.uuid;
|
|
443
|
-
break;
|
|
444
|
-
}
|
|
445
|
-
obj = obj.parent;
|
|
446
|
-
}
|
|
447
|
-
var attachmentId = (_ioDeviceObject$userD = ioDeviceObject.userData) === null || _ioDeviceObject$userD === void 0 ? void 0 : _ioDeviceObject$userD.attachmentId;
|
|
448
|
-
// When animated meshes are available, outline ONLY them so their
|
|
449
|
-
// silhouette is isolated and the outline ring is visible around
|
|
450
|
-
// them specifically (not swallowed by the larger device body).
|
|
451
|
-
// Fall back to the whole device group when none are registered.
|
|
452
|
-
var animatedMeshes = attachmentId && parentUuid ? (_this4$managers$ioBeh = (_this4$managers = _this4.managers) === null || _this4$managers === void 0 || (_this4$managers = _this4$managers.ioBehaviorManager) === null || _this4$managers === void 0 ? void 0 : _this4$managers.getAnimatedMeshes(parentUuid, attachmentId)) !== null && _this4$managers$ioBeh !== void 0 ? _this4$managers$ioBeh : [] : [];
|
|
453
|
-
var targets = animatedMeshes.length > 0 ? animatedMeshes : [ioDeviceObject];
|
|
454
|
-
(_this4$managers2 = _this4.managers) === null || _this4$managers2 === void 0 || (_this4$managers2 = _this4$managers2.ioOutlineManager) === null || _this4$managers2 === void 0 || _this4$managers2.setTargets(targets);
|
|
433
|
+
var _this4$managers;
|
|
434
|
+
// Outline only the specific mesh that was clicked
|
|
435
|
+
var targets = hitMesh ? [hitMesh] : [ioDeviceObject];
|
|
436
|
+
(_this4$managers = _this4.managers) === null || _this4$managers === void 0 || (_this4$managers = _this4$managers.ioOutlineManager) === null || _this4$managers === void 0 || _this4$managers.setTargets(targets);
|
|
455
437
|
}
|
|
456
438
|
if (!_this4.componentTooltipManager) return;
|
|
457
439
|
if (isStart) {
|
|
@@ -461,8 +443,8 @@ var sceneViewer = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
461
443
|
}
|
|
462
444
|
},
|
|
463
445
|
onIODeviceDragEnd: function onIODeviceDragEnd(ioDeviceObject) {
|
|
464
|
-
var _this4$
|
|
465
|
-
(_this4$
|
|
446
|
+
var _this4$managers2;
|
|
447
|
+
(_this4$managers2 = _this4.managers) === null || _this4$managers2 === void 0 || (_this4$managers2 = _this4$managers2.ioOutlineManager) === null || _this4$managers2 === void 0 || _this4$managers2.setTargets([]);
|
|
466
448
|
if (_this4.componentTooltipManager) {
|
|
467
449
|
_this4.componentTooltipManager.endIODeviceDrag();
|
|
468
450
|
}
|