@lv-x-software-house/x_view 1.2.6-dev.76 → 1.2.6-dev.78
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/index.js +224 -170
- package/dist/index.mjs +224 -170
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -745,20 +745,20 @@ var updateSceneHighlights = (state) => {
|
|
|
745
745
|
var addNewNodeToScene = (state, newNodeData, newLinkData, position) => {
|
|
746
746
|
const {
|
|
747
747
|
graphGroup,
|
|
748
|
-
nodeObjects
|
|
748
|
+
nodeObjects,
|
|
749
749
|
clickableNodes,
|
|
750
750
|
allLinks,
|
|
751
751
|
glowTexture,
|
|
752
752
|
renderer
|
|
753
753
|
} = state;
|
|
754
|
-
const sourceNodeMesh =
|
|
754
|
+
const sourceNodeMesh = nodeObjects[String(newLinkData.source)];
|
|
755
755
|
if (!sourceNodeMesh || !graphGroup) return;
|
|
756
756
|
const mesh = createNodeMesh(newNodeData, position, glowTexture);
|
|
757
757
|
graphGroup.add(mesh);
|
|
758
758
|
if (mesh.userData.labelObject) {
|
|
759
759
|
graphGroup.add(mesh.userData.labelObject);
|
|
760
760
|
}
|
|
761
|
-
|
|
761
|
+
nodeObjects[String(newNodeData.id)] = mesh;
|
|
762
762
|
clickableNodes.push(mesh);
|
|
763
763
|
const resolution = new THREE.Vector2(
|
|
764
764
|
renderer.domElement.clientWidth,
|
|
@@ -776,9 +776,9 @@ var addNewNodeToScene = (state, newNodeData, newLinkData, position) => {
|
|
|
776
776
|
});
|
|
777
777
|
};
|
|
778
778
|
var addNewLinkToScene = (state, newLinkData) => {
|
|
779
|
-
const { graphGroup, nodeObjects
|
|
780
|
-
const sourceNodeMesh =
|
|
781
|
-
const targetNodeMesh =
|
|
779
|
+
const { graphGroup, nodeObjects, allLinks, renderer } = state;
|
|
780
|
+
const sourceNodeMesh = nodeObjects[String(newLinkData.source)];
|
|
781
|
+
const targetNodeMesh = nodeObjects[String(newLinkData.target)];
|
|
782
782
|
if (!sourceNodeMesh || !targetNodeMesh || !graphGroup) return;
|
|
783
783
|
const resolution = new THREE.Vector2(
|
|
784
784
|
renderer.domElement.clientWidth,
|
|
@@ -823,12 +823,12 @@ var removeLinkFromScene = (state, linkObject) => {
|
|
|
823
823
|
var removeNodeFromScene = (state, nodeId) => {
|
|
824
824
|
const {
|
|
825
825
|
graphGroup,
|
|
826
|
-
nodeObjects
|
|
826
|
+
nodeObjects,
|
|
827
827
|
clickableNodes,
|
|
828
828
|
allLinks,
|
|
829
829
|
timelineIntervalsGroup
|
|
830
830
|
} = state;
|
|
831
|
-
const nodeToRemove =
|
|
831
|
+
const nodeToRemove = nodeObjects[String(nodeId)];
|
|
832
832
|
if (!nodeToRemove) return;
|
|
833
833
|
const strNodeId = String(nodeId);
|
|
834
834
|
const linksToRemove = [...allLinks].filter(
|
|
@@ -837,7 +837,7 @@ var removeNodeFromScene = (state, nodeId) => {
|
|
|
837
837
|
linksToRemove.forEach((link) => removeLinkFromScene(state, link));
|
|
838
838
|
const nodeIdx = clickableNodes.indexOf(nodeToRemove);
|
|
839
839
|
if (nodeIdx > -1) clickableNodes.splice(nodeIdx, 1);
|
|
840
|
-
delete
|
|
840
|
+
delete nodeObjects[strNodeId];
|
|
841
841
|
if (graphGroup && nodeToRemove.userData.labelObject) {
|
|
842
842
|
const label = nodeToRemove.userData.labelObject;
|
|
843
843
|
graphGroup.remove(label);
|
|
@@ -872,7 +872,7 @@ var removeNodeFromScene = (state, nodeId) => {
|
|
|
872
872
|
}
|
|
873
873
|
};
|
|
874
874
|
var addStandaloneNodeToScene = (state, nodeData, position, forceShowQuestDate = false) => {
|
|
875
|
-
const { graphGroup, nodeObjects
|
|
875
|
+
const { graphGroup, nodeObjects, clickableNodes, glowTexture } = state;
|
|
876
876
|
if (!graphGroup) return;
|
|
877
877
|
const mesh = createNodeMesh(nodeData, position, glowTexture, forceShowQuestDate);
|
|
878
878
|
mesh.scale.set(0.01, 0.01, 0.01);
|
|
@@ -880,7 +880,7 @@ var addStandaloneNodeToScene = (state, nodeData, position, forceShowQuestDate =
|
|
|
880
880
|
if (mesh.userData.labelObject) {
|
|
881
881
|
graphGroup.add(mesh.userData.labelObject);
|
|
882
882
|
}
|
|
883
|
-
|
|
883
|
+
nodeObjects[String(nodeData.id)] = mesh;
|
|
884
884
|
clickableNodes.push(mesh);
|
|
885
885
|
if (state.tweenGroup) {
|
|
886
886
|
const targetScale = NODE_SCALE_FACTORS[nodeData.size || "medium"] || 1;
|
|
@@ -918,7 +918,7 @@ var userActionHandlers = {
|
|
|
918
918
|
const { stateRef, setters, tweenToTarget } = context;
|
|
919
919
|
setters.setContextMenu({ visible: false });
|
|
920
920
|
setters.setRelationshipMenu({ visible: false });
|
|
921
|
-
const { graphGroup, nodeObjects
|
|
921
|
+
const { graphGroup, nodeObjects, renderer, ghostElements, glowTexture } = stateRef.current;
|
|
922
922
|
if (ghostElements.node && graphGroup) {
|
|
923
923
|
graphGroup.remove(ghostElements.node);
|
|
924
924
|
ghostElements.node.traverse((child) => {
|
|
@@ -934,7 +934,7 @@ var userActionHandlers = {
|
|
|
934
934
|
ghostElements.line.geometry.dispose();
|
|
935
935
|
ghostElements.line.material.dispose();
|
|
936
936
|
}
|
|
937
|
-
const sourceNodeMesh =
|
|
937
|
+
const sourceNodeMesh = nodeObjects[String(sourceNodeData.id)];
|
|
938
938
|
if (!sourceNodeMesh || !graphGroup || !renderer) return;
|
|
939
939
|
stateRef.current.creation = { isActive: true, sourceNodeData };
|
|
940
940
|
const ghostGeometry = new THREE.SphereGeometry(1.5, 32, 32);
|
|
@@ -1030,14 +1030,14 @@ var userActionHandlers = {
|
|
|
1030
1030
|
},
|
|
1031
1031
|
handleSaveNode: async (context, newNodeData) => {
|
|
1032
1032
|
const {
|
|
1033
|
-
graphDataRef,
|
|
1033
|
+
graphDataRef: graphDataRef2,
|
|
1034
1034
|
sceneDataRef,
|
|
1035
1035
|
stateRef,
|
|
1036
1036
|
creationMode,
|
|
1037
1037
|
setters,
|
|
1038
1038
|
actions
|
|
1039
1039
|
} = context;
|
|
1040
|
-
if (!
|
|
1040
|
+
if (!graphDataRef2.current || !sceneDataRef.current) return;
|
|
1041
1041
|
const { sourceNodeData } = creationMode;
|
|
1042
1042
|
const { targetDatasetId, ...nodeDataToSave } = newNodeData;
|
|
1043
1043
|
const newNode = { id: import_short_uuid.default.generate(), ...nodeDataToSave };
|
|
@@ -1059,9 +1059,9 @@ var userActionHandlers = {
|
|
|
1059
1059
|
}
|
|
1060
1060
|
const isCrossDataset = String(sourceParentInfo.parentFileId) !== String(finalTargetDatasetId);
|
|
1061
1061
|
const sourceDataToUpdate = JSON.parse(
|
|
1062
|
-
JSON.stringify(
|
|
1062
|
+
JSON.stringify(graphDataRef2.current[sourceParentInfo.parentFileId])
|
|
1063
1063
|
);
|
|
1064
|
-
let targetDataToUpdate = isCrossDataset ? JSON.parse(JSON.stringify(
|
|
1064
|
+
let targetDataToUpdate = isCrossDataset ? JSON.parse(JSON.stringify(graphDataRef2.current[finalTargetDatasetId])) : sourceDataToUpdate;
|
|
1065
1065
|
targetDataToUpdate.nodes.push(newNode);
|
|
1066
1066
|
sourceDataToUpdate.links.push(newLink);
|
|
1067
1067
|
const savePromises = [];
|
|
@@ -1088,9 +1088,9 @@ var userActionHandlers = {
|
|
|
1088
1088
|
}
|
|
1089
1089
|
try {
|
|
1090
1090
|
await Promise.all(savePromises);
|
|
1091
|
-
|
|
1091
|
+
graphDataRef2.current[sourceParentInfo.parentFileId] = sourceDataToUpdate;
|
|
1092
1092
|
if (isCrossDataset) {
|
|
1093
|
-
|
|
1093
|
+
graphDataRef2.current[finalTargetDatasetId] = targetDataToUpdate;
|
|
1094
1094
|
}
|
|
1095
1095
|
if (sceneDataRef.current.parent_dbs.some((db) => String(db.db_id) === String(sourceParentInfo.parentFileId))) {
|
|
1096
1096
|
}
|
|
@@ -1112,7 +1112,7 @@ var userActionHandlers = {
|
|
|
1112
1112
|
const { stateRef, setters, tweenToTarget } = context;
|
|
1113
1113
|
setters.setContextMenu({ visible: false });
|
|
1114
1114
|
setters.setRelationshipMenu({ visible: false });
|
|
1115
|
-
const { graphGroup, nodeObjects
|
|
1115
|
+
const { graphGroup, nodeObjects, renderer, ghostElements, glowTexture } = stateRef.current;
|
|
1116
1116
|
if (ghostElements.node && graphGroup) {
|
|
1117
1117
|
if (ghostElements.node.userData.labelObject) {
|
|
1118
1118
|
graphGroup.remove(ghostElements.node.userData.labelObject);
|
|
@@ -1134,7 +1134,7 @@ var userActionHandlers = {
|
|
|
1134
1134
|
ghostElements.line.geometry.dispose();
|
|
1135
1135
|
ghostElements.line.material.dispose();
|
|
1136
1136
|
}
|
|
1137
|
-
const sourceNodeMesh =
|
|
1137
|
+
const sourceNodeMesh = nodeObjects[String(sourceNodeData.id)];
|
|
1138
1138
|
if (!sourceNodeMesh || !graphGroup || !renderer) return;
|
|
1139
1139
|
stateRef.current.creation = { isActive: true, sourceNodeData };
|
|
1140
1140
|
const ghostGeometry = new THREE.SphereGeometry(1.5, 32, 32);
|
|
@@ -1233,8 +1233,8 @@ var userActionHandlers = {
|
|
|
1233
1233
|
},
|
|
1234
1234
|
handleSaveVersionNode: async (context, newNodeData) => {
|
|
1235
1235
|
var _a;
|
|
1236
|
-
const { graphDataRef, sceneDataRef, stateRef, versionMode, setters } = context;
|
|
1237
|
-
if (!
|
|
1236
|
+
const { graphDataRef: graphDataRef2, sceneDataRef, stateRef, versionMode, setters } = context;
|
|
1237
|
+
if (!graphDataRef2.current || !sceneDataRef.current) return;
|
|
1238
1238
|
const { sourceNodeData } = versionMode;
|
|
1239
1239
|
const newNode = {
|
|
1240
1240
|
id: import_short_uuid.default.generate(),
|
|
@@ -1247,7 +1247,7 @@ var userActionHandlers = {
|
|
|
1247
1247
|
target: newNode.id
|
|
1248
1248
|
};
|
|
1249
1249
|
const parentInfo = getParentFileInfoForNode(
|
|
1250
|
-
|
|
1250
|
+
graphDataRef2.current,
|
|
1251
1251
|
sceneDataRef.current,
|
|
1252
1252
|
sourceNodeData.id,
|
|
1253
1253
|
context.sceneConfigId,
|
|
@@ -1265,7 +1265,7 @@ var userActionHandlers = {
|
|
|
1265
1265
|
}
|
|
1266
1266
|
const { parentFileId, ownerId } = parentInfo;
|
|
1267
1267
|
const specificParentData = JSON.parse(
|
|
1268
|
-
JSON.stringify(
|
|
1268
|
+
JSON.stringify(graphDataRef2.current[parentFileId])
|
|
1269
1269
|
);
|
|
1270
1270
|
specificParentData.nodes.push(newNode);
|
|
1271
1271
|
specificParentData.links.push(newLink);
|
|
@@ -1291,7 +1291,7 @@ var userActionHandlers = {
|
|
|
1291
1291
|
specificParentData
|
|
1292
1292
|
);
|
|
1293
1293
|
}
|
|
1294
|
-
|
|
1294
|
+
graphDataRef2.current[parentFileId] = specificParentData;
|
|
1295
1295
|
if (isView && parentFileId === context.sceneConfigId) {
|
|
1296
1296
|
sceneDataRef.current.quest_nodes = [...specificParentData.nodes];
|
|
1297
1297
|
}
|
|
@@ -1308,23 +1308,23 @@ var userActionHandlers = {
|
|
|
1308
1308
|
const {
|
|
1309
1309
|
stateRef,
|
|
1310
1310
|
sceneDataRef,
|
|
1311
|
-
graphDataRef,
|
|
1311
|
+
graphDataRef: graphDataRef2,
|
|
1312
1312
|
mountRef,
|
|
1313
1313
|
setters,
|
|
1314
1314
|
tweenToTarget
|
|
1315
1315
|
} = context;
|
|
1316
1316
|
const {
|
|
1317
1317
|
graphGroup,
|
|
1318
|
-
nodeObjects
|
|
1318
|
+
nodeObjects,
|
|
1319
1319
|
clickableNodes,
|
|
1320
1320
|
allLinks,
|
|
1321
1321
|
glowTexture,
|
|
1322
1322
|
renderer,
|
|
1323
1323
|
tweenGroup
|
|
1324
1324
|
} = stateRef.current;
|
|
1325
|
-
if (!graphGroup || !sceneDataRef.current || !
|
|
1325
|
+
if (!graphGroup || !sceneDataRef.current || !graphDataRef2.current || !linksToExpand || linksToExpand.length === 0)
|
|
1326
1326
|
return;
|
|
1327
|
-
const sourceNodeMesh =
|
|
1327
|
+
const sourceNodeMesh = nodeObjects[String(sourceNode.id)];
|
|
1328
1328
|
if (!sourceNodeMesh) return;
|
|
1329
1329
|
const resolution = new THREE.Vector2(
|
|
1330
1330
|
mountRef.current.clientWidth,
|
|
@@ -1336,8 +1336,8 @@ var userActionHandlers = {
|
|
|
1336
1336
|
var _a;
|
|
1337
1337
|
const isSource = String(link.source) === String(sourceNode.id);
|
|
1338
1338
|
const targetNodeId = isSource ? link.target : link.source;
|
|
1339
|
-
if (!
|
|
1340
|
-
const allParentNodes = Object.values(
|
|
1339
|
+
if (!nodeObjects[String(targetNodeId)]) {
|
|
1340
|
+
const allParentNodes = Object.values(graphDataRef2.current).flatMap(
|
|
1341
1341
|
(fileData) => fileData.nodes
|
|
1342
1342
|
);
|
|
1343
1343
|
const nodeData = allParentNodes.find(
|
|
@@ -1364,7 +1364,7 @@ var userActionHandlers = {
|
|
|
1364
1364
|
if (targetMesh.userData.labelObject) {
|
|
1365
1365
|
graphGroup.add(targetMesh.userData.labelObject);
|
|
1366
1366
|
}
|
|
1367
|
-
|
|
1367
|
+
nodeObjects[String(targetNodeId)] = targetMesh;
|
|
1368
1368
|
clickableNodes.push(targetMesh);
|
|
1369
1369
|
const posTween = new import_tween.Tween(targetMesh.position).to(endPosition, 1200).easing(import_tween.Easing.Quadratic.Out);
|
|
1370
1370
|
tweenGroup.add(posTween);
|
|
@@ -1383,8 +1383,8 @@ var userActionHandlers = {
|
|
|
1383
1383
|
(l) => String(l.userData.id) === String(link.id)
|
|
1384
1384
|
);
|
|
1385
1385
|
if (linkAlreadyInSceneObjects) return;
|
|
1386
|
-
const sourceMesh =
|
|
1387
|
-
const targetMesh =
|
|
1386
|
+
const sourceMesh = nodeObjects[String(link.source)];
|
|
1387
|
+
const targetMesh = nodeObjects[String(link.target)];
|
|
1388
1388
|
if (sourceMesh && targetMesh) {
|
|
1389
1389
|
const currentLinksBetweenNodesData = allLinks.filter(
|
|
1390
1390
|
(l) => String(l.userData.source) === String(link.source) && String(l.userData.target) === String(link.target) || String(l.userData.source) === String(link.target) && String(l.userData.target) === String(link.source)
|
|
@@ -1446,8 +1446,8 @@ var userActionHandlers = {
|
|
|
1446
1446
|
const { stateRef, mountRef, setters } = context;
|
|
1447
1447
|
setters.setContextMenu({ visible: false });
|
|
1448
1448
|
setters.setRelationshipMenu({ visible: false });
|
|
1449
|
-
const { graphGroup, nodeObjects
|
|
1450
|
-
const sourceNodeMesh =
|
|
1449
|
+
const { graphGroup, nodeObjects, renderer, controls } = stateRef.current;
|
|
1450
|
+
const sourceNodeMesh = nodeObjects[String(sourceNodeData.id)];
|
|
1451
1451
|
if (!sourceNodeMesh || !graphGroup || !renderer) return;
|
|
1452
1452
|
controls.enabled = false;
|
|
1453
1453
|
if (mountRef.current) mountRef.current.style.cursor = "crosshair";
|
|
@@ -1496,15 +1496,15 @@ var userActionHandlers = {
|
|
|
1496
1496
|
},
|
|
1497
1497
|
handleCompleteConnection: async (context, targetNodeData) => {
|
|
1498
1498
|
var _a;
|
|
1499
|
-
const { stateRef, graphDataRef, sceneDataRef } = context;
|
|
1499
|
+
const { stateRef, graphDataRef: graphDataRef2, sceneDataRef } = context;
|
|
1500
1500
|
const { sourceNodeData } = stateRef.current.connection;
|
|
1501
|
-
if (!
|
|
1501
|
+
if (!graphDataRef2.current || !sceneDataRef.current || !sourceNodeData || !targetNodeData) {
|
|
1502
1502
|
console.error("Dados insuficientes para completar a conex\xE3o.");
|
|
1503
1503
|
userActionHandlers.handleCancelConnection(context);
|
|
1504
1504
|
return;
|
|
1505
1505
|
}
|
|
1506
1506
|
const sourceParentInfo = getParentFileInfoForNode(
|
|
1507
|
-
|
|
1507
|
+
graphDataRef2.current,
|
|
1508
1508
|
sceneDataRef.current,
|
|
1509
1509
|
sourceNodeData.id,
|
|
1510
1510
|
context.sceneConfigId,
|
|
@@ -1532,7 +1532,7 @@ var userActionHandlers = {
|
|
|
1532
1532
|
try {
|
|
1533
1533
|
const isView = ((_a = context.viewType) == null ? void 0 : _a.toLowerCase()) === "view";
|
|
1534
1534
|
if (isView && parentFileIdToSave === context.sceneConfigId) {
|
|
1535
|
-
const specificParentData =
|
|
1535
|
+
const specificParentData = graphDataRef2.current[context.sceneConfigId];
|
|
1536
1536
|
specificParentData.links.push(newLink);
|
|
1537
1537
|
const viewFilePayload = {
|
|
1538
1538
|
parent_dbs: sceneDataRef.current.parent_dbs,
|
|
@@ -1548,7 +1548,7 @@ var userActionHandlers = {
|
|
|
1548
1548
|
);
|
|
1549
1549
|
} else {
|
|
1550
1550
|
const specificParentData = JSON.parse(
|
|
1551
|
-
JSON.stringify(
|
|
1551
|
+
JSON.stringify(graphDataRef2.current[parentFileIdToSave])
|
|
1552
1552
|
);
|
|
1553
1553
|
specificParentData.links.push(newLink);
|
|
1554
1554
|
const filenameForSpecificParent = `x_view_dbs/${ownerIdToSave}/${parentFileIdToSave}`;
|
|
@@ -1556,7 +1556,7 @@ var userActionHandlers = {
|
|
|
1556
1556
|
filenameForSpecificParent,
|
|
1557
1557
|
specificParentData
|
|
1558
1558
|
);
|
|
1559
|
-
|
|
1559
|
+
graphDataRef2.current[parentFileIdToSave] = specificParentData;
|
|
1560
1560
|
}
|
|
1561
1561
|
addNewLinkToScene(stateRef.current, newLink);
|
|
1562
1562
|
} catch (error) {
|
|
@@ -1619,8 +1619,8 @@ var userActionHandlers = {
|
|
|
1619
1619
|
if (mountRef.current) mountRef.current.style.cursor = "grab";
|
|
1620
1620
|
},
|
|
1621
1621
|
handleCompleteRelink: async (context, newEndNodeData) => {
|
|
1622
|
-
const { stateRef, graphDataRef, sceneDataRef } = context;
|
|
1623
|
-
const { relink, nodeObjects
|
|
1622
|
+
const { stateRef, graphDataRef: graphDataRef2, sceneDataRef } = context;
|
|
1623
|
+
const { relink, nodeObjects } = stateRef.current;
|
|
1624
1624
|
const originalLinkData = relink.originalLine.userData;
|
|
1625
1625
|
const oldSourceId = originalLinkData.source;
|
|
1626
1626
|
const oldTargetId = originalLinkData.target;
|
|
@@ -1633,28 +1633,28 @@ var userActionHandlers = {
|
|
|
1633
1633
|
newTargetId = newEndNodeData.id;
|
|
1634
1634
|
}
|
|
1635
1635
|
const oldSourceInfo = getParentFileInfoForNode(
|
|
1636
|
-
|
|
1636
|
+
graphDataRef2.current,
|
|
1637
1637
|
sceneDataRef.current,
|
|
1638
1638
|
oldSourceId,
|
|
1639
1639
|
context.sceneConfigId,
|
|
1640
1640
|
context.ownerId
|
|
1641
1641
|
);
|
|
1642
1642
|
const oldTargetInfo = getParentFileInfoForNode(
|
|
1643
|
-
|
|
1643
|
+
graphDataRef2.current,
|
|
1644
1644
|
sceneDataRef.current,
|
|
1645
1645
|
oldTargetId,
|
|
1646
1646
|
context.sceneConfigId,
|
|
1647
1647
|
context.ownerId
|
|
1648
1648
|
);
|
|
1649
1649
|
const newSourceInfo = getParentFileInfoForNode(
|
|
1650
|
-
|
|
1650
|
+
graphDataRef2.current,
|
|
1651
1651
|
sceneDataRef.current,
|
|
1652
1652
|
newSourceId,
|
|
1653
1653
|
context.sceneConfigId,
|
|
1654
1654
|
context.ownerId
|
|
1655
1655
|
);
|
|
1656
1656
|
const newTargetInfo = getParentFileInfoForNode(
|
|
1657
|
-
|
|
1657
|
+
graphDataRef2.current,
|
|
1658
1658
|
sceneDataRef.current,
|
|
1659
1659
|
newTargetId,
|
|
1660
1660
|
context.sceneConfigId,
|
|
@@ -1714,7 +1714,7 @@ var userActionHandlers = {
|
|
|
1714
1714
|
const filesToUpdate = {};
|
|
1715
1715
|
if (oldGoverningFileId !== newGoverningFileId) {
|
|
1716
1716
|
const updatedOriginalParentData = JSON.parse(
|
|
1717
|
-
JSON.stringify(
|
|
1717
|
+
JSON.stringify(graphDataRef2.current[oldGoverningFileId])
|
|
1718
1718
|
);
|
|
1719
1719
|
updatedOriginalParentData.links = updatedOriginalParentData.links.filter(
|
|
1720
1720
|
(l) => String(l.id) !== String(linkId)
|
|
@@ -1728,7 +1728,7 @@ var userActionHandlers = {
|
|
|
1728
1728
|
)
|
|
1729
1729
|
);
|
|
1730
1730
|
const updatedNewParentData = JSON.parse(
|
|
1731
|
-
JSON.stringify(
|
|
1731
|
+
JSON.stringify(graphDataRef2.current[newGoverningFileId])
|
|
1732
1732
|
);
|
|
1733
1733
|
if (!updatedNewParentData.links) updatedNewParentData.links = [];
|
|
1734
1734
|
updatedNewParentData.links.push(newLinkData);
|
|
@@ -1742,7 +1742,7 @@ var userActionHandlers = {
|
|
|
1742
1742
|
);
|
|
1743
1743
|
} else {
|
|
1744
1744
|
const updatedParentData = JSON.parse(
|
|
1745
|
-
JSON.stringify(
|
|
1745
|
+
JSON.stringify(graphDataRef2.current[oldGoverningFileId])
|
|
1746
1746
|
);
|
|
1747
1747
|
updatedParentData.links = updatedParentData.links.filter(
|
|
1748
1748
|
(l) => String(l.id) !== String(linkId)
|
|
@@ -1760,7 +1760,7 @@ var userActionHandlers = {
|
|
|
1760
1760
|
try {
|
|
1761
1761
|
await Promise.all(savePromises);
|
|
1762
1762
|
for (const fileId in filesToUpdate) {
|
|
1763
|
-
|
|
1763
|
+
graphDataRef2.current[fileId] = filesToUpdate[fileId];
|
|
1764
1764
|
}
|
|
1765
1765
|
removeLinkFromScene(stateRef.current, relink.originalLine);
|
|
1766
1766
|
addNewLinkToScene(stateRef.current, newLinkData);
|
|
@@ -1774,9 +1774,9 @@ var userActionHandlers = {
|
|
|
1774
1774
|
},
|
|
1775
1775
|
handleDeleteLink: async (context, linkObject) => {
|
|
1776
1776
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1777
|
-
const { stateRef, graphDataRef, sceneDataRef, setters } = context;
|
|
1777
|
+
const { stateRef, graphDataRef: graphDataRef2, sceneDataRef, setters } = context;
|
|
1778
1778
|
setters.setRelationshipMenu({ visible: false });
|
|
1779
|
-
if (!(linkObject == null ? void 0 : linkObject.userData) || !
|
|
1779
|
+
if (!(linkObject == null ? void 0 : linkObject.userData) || !graphDataRef2.current || !sceneDataRef.current)
|
|
1780
1780
|
return;
|
|
1781
1781
|
const linkIdToDelete = linkObject.userData.id;
|
|
1782
1782
|
if (!linkIdToDelete) {
|
|
@@ -1787,7 +1787,7 @@ var userActionHandlers = {
|
|
|
1787
1787
|
return;
|
|
1788
1788
|
}
|
|
1789
1789
|
const parentInfo = getParentFileInfoForNode(
|
|
1790
|
-
|
|
1790
|
+
graphDataRef2.current,
|
|
1791
1791
|
sceneDataRef.current,
|
|
1792
1792
|
linkObject.userData.source,
|
|
1793
1793
|
context.sceneConfigId,
|
|
@@ -1807,7 +1807,7 @@ var userActionHandlers = {
|
|
|
1807
1807
|
const srcName = ((_c = (_b = (_a = linkObject.userData) == null ? void 0 : _a.sourceNode) == null ? void 0 : _b.userData) == null ? void 0 : _c.name) ?? linkObject.userData.source;
|
|
1808
1808
|
const tgtName = ((_f = (_e = (_d = linkObject.userData) == null ? void 0 : _d.targetNode) == null ? void 0 : _e.userData) == null ? void 0 : _f.name) ?? linkObject.userData.target;
|
|
1809
1809
|
const specificParentData = JSON.parse(
|
|
1810
|
-
JSON.stringify(
|
|
1810
|
+
JSON.stringify(graphDataRef2.current[parentFileId])
|
|
1811
1811
|
);
|
|
1812
1812
|
const newLinks = (specificParentData.links || []).filter(
|
|
1813
1813
|
(l) => String(l.id) !== String(linkIdToDelete)
|
|
@@ -1835,7 +1835,7 @@ var userActionHandlers = {
|
|
|
1835
1835
|
}
|
|
1836
1836
|
try {
|
|
1837
1837
|
await context.actions.save_view_data(filenameToSave, payloadToSave);
|
|
1838
|
-
|
|
1838
|
+
graphDataRef2.current[parentFileId] = specificParentData;
|
|
1839
1839
|
setters.setDetailsLink(
|
|
1840
1840
|
(prev) => String(prev == null ? void 0 : prev.id) === String(linkIdToDelete) ? null : prev
|
|
1841
1841
|
);
|
|
@@ -1973,9 +1973,9 @@ var userActionHandlers = {
|
|
|
1973
1973
|
},
|
|
1974
1974
|
handleDeleteMultipleNodes: async (context, nodeIds) => {
|
|
1975
1975
|
var _a;
|
|
1976
|
-
const { stateRef, graphDataRef, sceneDataRef, setters, actions } = context;
|
|
1976
|
+
const { stateRef, graphDataRef: graphDataRef2, sceneDataRef, setters, actions } = context;
|
|
1977
1977
|
setters.setMultiContextMenu({ visible: false });
|
|
1978
|
-
if (!nodeIds || nodeIds.size === 0 || !
|
|
1978
|
+
if (!nodeIds || nodeIds.size === 0 || !graphDataRef2.current || !sceneDataRef.current)
|
|
1979
1979
|
return;
|
|
1980
1980
|
const strNodeIdsToDelete = Array.from(nodeIds).map(String);
|
|
1981
1981
|
if (actions.delete_file) {
|
|
@@ -1995,7 +1995,7 @@ var userActionHandlers = {
|
|
|
1995
1995
|
const changesByParentFile = {};
|
|
1996
1996
|
for (const nodeId of strNodeIdsToDelete) {
|
|
1997
1997
|
const parentInfo = getParentFileInfoForNode(
|
|
1998
|
-
|
|
1998
|
+
graphDataRef2.current,
|
|
1999
1999
|
sceneDataRef.current,
|
|
2000
2000
|
nodeId,
|
|
2001
2001
|
context.sceneConfigId,
|
|
@@ -2016,7 +2016,7 @@ var userActionHandlers = {
|
|
|
2016
2016
|
nodesToDelete: /* @__PURE__ */ new Set(),
|
|
2017
2017
|
linksToDelete: /* @__PURE__ */ new Set(),
|
|
2018
2018
|
originalData: JSON.parse(
|
|
2019
|
-
JSON.stringify(
|
|
2019
|
+
JSON.stringify(graphDataRef2.current[parentFileId])
|
|
2020
2020
|
)
|
|
2021
2021
|
};
|
|
2022
2022
|
}
|
|
@@ -2080,7 +2080,7 @@ var userActionHandlers = {
|
|
|
2080
2080
|
try {
|
|
2081
2081
|
await Promise.all(savePromises);
|
|
2082
2082
|
for (const fileId in updatedParentDataCache) {
|
|
2083
|
-
|
|
2083
|
+
graphDataRef2.current[fileId] = updatedParentDataCache[fileId];
|
|
2084
2084
|
}
|
|
2085
2085
|
strNodeIdsToDelete.forEach((nodeId) => {
|
|
2086
2086
|
setters.setDetailsNode(
|
|
@@ -2097,7 +2097,7 @@ var userActionHandlers = {
|
|
|
2097
2097
|
},
|
|
2098
2098
|
handleDeleteNode: async (context, nodeData) => {
|
|
2099
2099
|
var _a;
|
|
2100
|
-
const { stateRef, graphDataRef, sceneDataRef, setters, actions } = context;
|
|
2100
|
+
const { stateRef, graphDataRef: graphDataRef2, sceneDataRef, setters, actions } = context;
|
|
2101
2101
|
if (actions.delete_file && nodeData) {
|
|
2102
2102
|
const urls = extractFileUrlsFromProperties(nodeData);
|
|
2103
2103
|
if (urls.length > 0) {
|
|
@@ -2107,11 +2107,11 @@ var userActionHandlers = {
|
|
|
2107
2107
|
}
|
|
2108
2108
|
}
|
|
2109
2109
|
setters.setContextMenu({ visible: false });
|
|
2110
|
-
if (!nodeData || !
|
|
2110
|
+
if (!nodeData || !graphDataRef2.current || !sceneDataRef.current) return;
|
|
2111
2111
|
const nodeIdToDelete = nodeData.id;
|
|
2112
2112
|
const strNodeId = String(nodeIdToDelete);
|
|
2113
2113
|
const parentInfo = getParentFileInfoForNode(
|
|
2114
|
-
|
|
2114
|
+
graphDataRef2.current,
|
|
2115
2115
|
sceneDataRef.current,
|
|
2116
2116
|
nodeIdToDelete,
|
|
2117
2117
|
context.sceneConfigId,
|
|
@@ -2129,7 +2129,7 @@ var userActionHandlers = {
|
|
|
2129
2129
|
}
|
|
2130
2130
|
const { parentFileId, ownerId } = parentInfo;
|
|
2131
2131
|
const specificParentData = JSON.parse(
|
|
2132
|
-
JSON.stringify(
|
|
2132
|
+
JSON.stringify(graphDataRef2.current[parentFileId])
|
|
2133
2133
|
);
|
|
2134
2134
|
const newNodes = (specificParentData.nodes || []).filter(
|
|
2135
2135
|
(n) => String(n.id) !== strNodeId
|
|
@@ -2166,7 +2166,7 @@ var userActionHandlers = {
|
|
|
2166
2166
|
}
|
|
2167
2167
|
try {
|
|
2168
2168
|
await context.actions.save_view_data(filenameToSave, payloadToSave);
|
|
2169
|
-
|
|
2169
|
+
graphDataRef2.current[parentFileId] = specificParentData;
|
|
2170
2170
|
setters.setDetailsNode(
|
|
2171
2171
|
(prev) => String(prev == null ? void 0 : prev.id) === String(nodeIdToDelete) ? null : prev
|
|
2172
2172
|
);
|
|
@@ -2179,8 +2179,8 @@ var userActionHandlers = {
|
|
|
2179
2179
|
},
|
|
2180
2180
|
handleSaveNodeDetails: async (context, updatedNode, keepOpen = false) => {
|
|
2181
2181
|
var _a, _b, _c;
|
|
2182
|
-
const { graphDataRef, sceneDataRef, stateRef, setters } = context;
|
|
2183
|
-
if (!
|
|
2182
|
+
const { graphDataRef: graphDataRef2, sceneDataRef, stateRef, setters } = context;
|
|
2183
|
+
if (!graphDataRef2.current || !sceneDataRef.current) return;
|
|
2184
2184
|
const {
|
|
2185
2185
|
_baseEmissiveIntensity,
|
|
2186
2186
|
_baseScale,
|
|
@@ -2191,7 +2191,7 @@ var userActionHandlers = {
|
|
|
2191
2191
|
...nodeToSave
|
|
2192
2192
|
} = updatedNode;
|
|
2193
2193
|
const parentInfo = getParentFileInfoForNode(
|
|
2194
|
-
|
|
2194
|
+
graphDataRef2.current,
|
|
2195
2195
|
sceneDataRef.current,
|
|
2196
2196
|
nodeToSave.id,
|
|
2197
2197
|
context.sceneConfigId,
|
|
@@ -2209,7 +2209,7 @@ var userActionHandlers = {
|
|
|
2209
2209
|
}
|
|
2210
2210
|
const { parentFileId, ownerId } = parentInfo;
|
|
2211
2211
|
const specificParentData = JSON.parse(
|
|
2212
|
-
JSON.stringify(
|
|
2212
|
+
JSON.stringify(graphDataRef2.current[parentFileId])
|
|
2213
2213
|
);
|
|
2214
2214
|
const nodeIndex = specificParentData.nodes.findIndex(
|
|
2215
2215
|
(n) => String(n.id) === String(nodeToSave.id)
|
|
@@ -2325,7 +2325,7 @@ var userActionHandlers = {
|
|
|
2325
2325
|
specificParentData
|
|
2326
2326
|
);
|
|
2327
2327
|
}
|
|
2328
|
-
|
|
2328
|
+
graphDataRef2.current[parentFileId] = specificParentData;
|
|
2329
2329
|
if (isView && parentFileId === context.sceneConfigId) {
|
|
2330
2330
|
sceneDataRef.current.quest_nodes = [...specificParentData.nodes];
|
|
2331
2331
|
sceneDataRef.current.quest_counter = specificParentData.quest_counter || sceneDataRef.current.quest_counter;
|
|
@@ -2342,11 +2342,11 @@ var userActionHandlers = {
|
|
|
2342
2342
|
},
|
|
2343
2343
|
handleSaveLinkDetails: async (context, updatedLink, keepOpen = false) => {
|
|
2344
2344
|
var _a;
|
|
2345
|
-
const { graphDataRef, sceneDataRef, stateRef, setters } = context;
|
|
2346
|
-
if (!
|
|
2345
|
+
const { graphDataRef: graphDataRef2, sceneDataRef, stateRef, setters } = context;
|
|
2346
|
+
if (!graphDataRef2.current || !sceneDataRef.current) return;
|
|
2347
2347
|
const { sourceNode, targetNode, ...linkToSave } = updatedLink;
|
|
2348
2348
|
const parentInfo = getParentFileInfoForNode(
|
|
2349
|
-
|
|
2349
|
+
graphDataRef2.current,
|
|
2350
2350
|
sceneDataRef.current,
|
|
2351
2351
|
linkToSave.source,
|
|
2352
2352
|
context.sceneConfigId,
|
|
@@ -2364,7 +2364,7 @@ var userActionHandlers = {
|
|
|
2364
2364
|
}
|
|
2365
2365
|
const { parentFileId, ownerId } = parentInfo;
|
|
2366
2366
|
const specificParentData = JSON.parse(
|
|
2367
|
-
JSON.stringify(
|
|
2367
|
+
JSON.stringify(graphDataRef2.current[parentFileId])
|
|
2368
2368
|
);
|
|
2369
2369
|
const linkIndex = specificParentData.links.findIndex(
|
|
2370
2370
|
(l) => String(l.id) === String(linkToSave.id)
|
|
@@ -2402,7 +2402,7 @@ var userActionHandlers = {
|
|
|
2402
2402
|
specificParentData
|
|
2403
2403
|
);
|
|
2404
2404
|
}
|
|
2405
|
-
|
|
2405
|
+
graphDataRef2.current[parentFileId] = specificParentData;
|
|
2406
2406
|
const lineObject = stateRef.current.allLinks.find(
|
|
2407
2407
|
(l) => String(l.userData.id) === String(linkToSave.id)
|
|
2408
2408
|
);
|
|
@@ -2425,9 +2425,9 @@ var userActionHandlers = {
|
|
|
2425
2425
|
},
|
|
2426
2426
|
handleAddExistingNodeById: (context, nodeId) => {
|
|
2427
2427
|
var _a;
|
|
2428
|
-
const { stateRef, sceneDataRef, graphDataRef, tweenToTarget, setters } = context;
|
|
2428
|
+
const { stateRef, sceneDataRef, graphDataRef: graphDataRef2, tweenToTarget, setters } = context;
|
|
2429
2429
|
const state = stateRef.current;
|
|
2430
|
-
const graphFull =
|
|
2430
|
+
const graphFull = graphDataRef2.current;
|
|
2431
2431
|
if (!graphFull) return;
|
|
2432
2432
|
const strNodeId = String(nodeId);
|
|
2433
2433
|
const allParentNodes = Object.values(graphFull).flatMap(
|
|
@@ -8892,10 +8892,6 @@ function CreateQuestTreePanel({
|
|
|
8892
8892
|
}
|
|
8893
8893
|
};
|
|
8894
8894
|
const handleLocalSave = async () => {
|
|
8895
|
-
if (!hasUnsavedChanges) {
|
|
8896
|
-
onClose();
|
|
8897
|
-
return;
|
|
8898
|
-
}
|
|
8899
8895
|
try {
|
|
8900
8896
|
setIsSaving(true);
|
|
8901
8897
|
await onSave(questTreeMode.tree, questTreeMode.abstraction_tree);
|
|
@@ -8938,18 +8934,28 @@ function CreateQuestTreePanel({
|
|
|
8938
8934
|
}
|
|
8939
8935
|
),
|
|
8940
8936
|
/* @__PURE__ */ import_react12.default.createElement("div", { className: "flex-shrink-0 p-4 border-b border-slate-700 bg-slate-800/80 backdrop-blur-xl flex flex-col gap-1 z-20" }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ import_react12.default.createElement("h2", { className: "text-xl font-bold text-white flex items-center gap-2" }, /* @__PURE__ */ import_react12.default.createElement(import_fi11.FiGitBranch, { className: "text-emerald-400" }), "Quest Trees"), /* @__PURE__ */ import_react12.default.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ import_react12.default.createElement(
|
|
8937
|
+
"button",
|
|
8938
|
+
{
|
|
8939
|
+
onClick: onClose,
|
|
8940
|
+
className: "px-4 py-2 rounded-lg border border-white/15 bg-transparent hover:bg-white/5 transition-colors text-sm text-slate-300"
|
|
8941
|
+
},
|
|
8942
|
+
"Fechar"
|
|
8943
|
+
), /* @__PURE__ */ import_react12.default.createElement(
|
|
8941
8944
|
"button",
|
|
8942
8945
|
{
|
|
8943
8946
|
onClick: handleLocalSave,
|
|
8944
8947
|
disabled: isSaving,
|
|
8945
|
-
className: `flex items-center gap-2
|
|
8948
|
+
className: `px-4 py-2 rounded-lg transition-all font-semibold text-sm flex items-center gap-2 ${isSaving ? "bg-slate-700 text-slate-300 cursor-wait" : "bg-gradient-to-tr from-indigo-600 to-indigo-400 hover:from-indigo-500 hover:to-indigo-300 text-white shadow-[0_8px_24px_rgba(99,102,241,0.35)]"}`
|
|
8946
8949
|
},
|
|
8947
|
-
isSaving ? "Salvando..." :
|
|
8950
|
+
isSaving ? "Salvando..." : "Salvar Mudan\xE7as"
|
|
8948
8951
|
)))),
|
|
8949
8952
|
/* @__PURE__ */ import_react12.default.createElement("div", { className: "flex border-b border-slate-800 bg-slate-900/50 p-2 gap-2 flex-shrink-0" }, /* @__PURE__ */ import_react12.default.createElement(
|
|
8950
8953
|
"button",
|
|
8951
8954
|
{
|
|
8952
|
-
onClick: () =>
|
|
8955
|
+
onClick: () => {
|
|
8956
|
+
setActiveTab("tree");
|
|
8957
|
+
setQuestTreeMode2((prev) => ({ ...prev, isAddingNodes: true, isAddingAbstractionNodes: false }));
|
|
8958
|
+
},
|
|
8953
8959
|
className: `flex-1 flex items-center justify-center gap-2 py-2 px-3 rounded-md text-sm font-medium transition-all ${activeTab === "tree" ? "bg-indigo-600 text-white shadow-lg" : "bg-slate-800 text-slate-400 hover:bg-slate-700 hover:text-slate-200"}`
|
|
8954
8960
|
},
|
|
8955
8961
|
/* @__PURE__ */ import_react12.default.createElement(import_fi11.FiGitBranch, null),
|
|
@@ -8957,7 +8963,10 @@ function CreateQuestTreePanel({
|
|
|
8957
8963
|
), /* @__PURE__ */ import_react12.default.createElement(
|
|
8958
8964
|
"button",
|
|
8959
8965
|
{
|
|
8960
|
-
onClick: () =>
|
|
8966
|
+
onClick: () => {
|
|
8967
|
+
setActiveTab("abstraction");
|
|
8968
|
+
setQuestTreeMode2((prev) => ({ ...prev, isAddingNodes: false, isAddingAbstractionNodes: true }));
|
|
8969
|
+
},
|
|
8961
8970
|
className: `flex-1 flex items-center justify-center gap-2 py-2 px-3 rounded-md text-sm font-medium transition-all ${activeTab === "abstraction" ? "bg-indigo-600 text-white shadow-lg" : "bg-slate-800 text-slate-400 hover:bg-slate-700 hover:text-slate-200"}`
|
|
8962
8971
|
},
|
|
8963
8972
|
/* @__PURE__ */ import_react12.default.createElement(import_fi11.FiLayers, null),
|
|
@@ -8973,15 +8982,7 @@ function CreateQuestTreePanel({
|
|
|
8973
8982
|
selectedParentId
|
|
8974
8983
|
}
|
|
8975
8984
|
)) : /* @__PURE__ */ import_react12.default.createElement("div", { className: "text-center py-8 text-slate-500 text-sm italic" }, "\xC1rvore vazia. Ofertada inicializa\xE7\xE3o autom\xE1tica em breve..."))),
|
|
8976
|
-
/* @__PURE__ */ import_react12.default.createElement("div", { className: "absolute bottom-6 left-1/2 -translate-x-1/2
|
|
8977
|
-
"button",
|
|
8978
|
-
{
|
|
8979
|
-
onClick: handleToggleAddMode,
|
|
8980
|
-
className: `flex items-center gap-2 px-5 py-2.5 rounded-full font-bold shadow-xl transition-all ${isAddingModeActive ? "bg-red-500 hover:bg-red-600 text-white animate-pulse shadow-red-500/20" : "bg-indigo-500 hover:bg-indigo-600 text-white shadow-indigo-500/20"}`
|
|
8981
|
-
},
|
|
8982
|
-
isAddingModeActive ? /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null, "Clique no Cen\xE1rio 3D ", /* @__PURE__ */ import_react12.default.createElement("span", { className: "animate-bounce" }, "\u2193")) : /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null, /* @__PURE__ */ import_react12.default.createElement(import_fi11.FiPlus, null), " Adicionar \xE0 \xC1rvore")
|
|
8983
|
-
)),
|
|
8984
|
-
isAddingModeActive && selectedParentId && /* @__PURE__ */ import_react12.default.createElement("div", { className: "absolute bottom-20 left-1/2 -translate-x-1/2 bg-slate-800 px-4 py-2 rounded-full border border-slate-600 text-xs text-slate-300 shadow-lg whitespace-nowrap" }, "Destino: ", /* @__PURE__ */ import_react12.default.createElement("span", { className: "text-emerald-400 font-bold" }, ((_c = (_b = (_a = findNodePath3(currentTree, selectedParentId)) == null ? void 0 : _a.node) == null ? void 0 : _b.node) == null ? void 0 : _c.name) || "Root"))
|
|
8985
|
+
isAddingModeActive && selectedParentId && /* @__PURE__ */ import_react12.default.createElement("div", { className: "absolute bottom-6 left-1/2 -translate-x-1/2 bg-slate-800 px-4 py-2 rounded-full border border-slate-600 text-xs text-slate-300 shadow-lg whitespace-nowrap z-30" }, "Destino: ", /* @__PURE__ */ import_react12.default.createElement("span", { className: "text-emerald-400 font-bold" }, ((_c = (_b = (_a = findNodePath3(currentTree, selectedParentId)) == null ? void 0 : _a.node) == null ? void 0 : _b.node) == null ? void 0 : _c.name) || "Root"))
|
|
8985
8986
|
);
|
|
8986
8987
|
}
|
|
8987
8988
|
|
|
@@ -10783,6 +10784,7 @@ function InSceneQuestForm({
|
|
|
10783
10784
|
setQuestTreeMode((prev) => ({
|
|
10784
10785
|
...prev,
|
|
10785
10786
|
isActive: true,
|
|
10787
|
+
isAddingNodes: true,
|
|
10786
10788
|
questTempData: true
|
|
10787
10789
|
}));
|
|
10788
10790
|
}
|
|
@@ -13034,10 +13036,30 @@ ${noteText}` : noteText : entry.notes,
|
|
|
13034
13036
|
type: "button",
|
|
13035
13037
|
onClick: () => {
|
|
13036
13038
|
if (setQuestTreeMode2) {
|
|
13039
|
+
const convertPersistedTree = (storedTree) => {
|
|
13040
|
+
if (!storedTree) return null;
|
|
13041
|
+
if (storedTree.node || storedTree.is_section) return storedTree;
|
|
13042
|
+
const nodeId = storedTree.node_id;
|
|
13043
|
+
if (!nodeId) return null;
|
|
13044
|
+
const foundNode = availableNodes.find((n) => String(n.id) === String(nodeId)) || (String(nodeId) === String(node == null ? void 0 : node.id) ? node : null);
|
|
13045
|
+
return {
|
|
13046
|
+
node: foundNode ? { id: foundNode.id, name: foundNode.raw_title || foundNode.name } : { id: nodeId, name: `Node ${nodeId}` },
|
|
13047
|
+
relationship: storedTree.relationship || {},
|
|
13048
|
+
children: (storedTree.children || []).map(convertPersistedTree).filter(Boolean)
|
|
13049
|
+
};
|
|
13050
|
+
};
|
|
13051
|
+
const rootNode = { id: node == null ? void 0 : node.id, name: (node == null ? void 0 : node.raw_title) || (node == null ? void 0 : node.name) || "Quest Principal" };
|
|
13052
|
+
const existingTree = (node == null ? void 0 : node.quest_tree) ? convertPersistedTree(node.quest_tree) : { node: rootNode, children: [] };
|
|
13053
|
+
const existingAbstractionTree = (node == null ? void 0 : node.quest_abstraction_tree) ? convertPersistedTree(node.quest_abstraction_tree) : { node: rootNode, children: [] };
|
|
13037
13054
|
setQuestTreeMode2((prev) => ({
|
|
13038
13055
|
...prev,
|
|
13039
13056
|
isActive: true,
|
|
13040
|
-
|
|
13057
|
+
isAddingNodes: true,
|
|
13058
|
+
questNodeId: node == null ? void 0 : node.id,
|
|
13059
|
+
questNodeName: (node == null ? void 0 : node.raw_title) || (node == null ? void 0 : node.name),
|
|
13060
|
+
tree: existingTree,
|
|
13061
|
+
abstraction_tree: existingAbstractionTree,
|
|
13062
|
+
selectedParentId: rootNode.id
|
|
13041
13063
|
}));
|
|
13042
13064
|
}
|
|
13043
13065
|
},
|
|
@@ -15935,8 +15957,8 @@ function XViewScene({
|
|
|
15935
15957
|
[]
|
|
15936
15958
|
);
|
|
15937
15959
|
const handleActivateTimeline = (0, import_react33.useCallback)(() => {
|
|
15938
|
-
const { nodeObjects
|
|
15939
|
-
if (!
|
|
15960
|
+
const { nodeObjects, tweenGroup, timelineIntervalsGroup } = stateRef.current;
|
|
15961
|
+
if (!nodeObjects || !tweenGroup || !timelineIntervalsGroup) return;
|
|
15940
15962
|
while (timelineIntervalsGroup.children.length > 0) {
|
|
15941
15963
|
const obj = timelineIntervalsGroup.children[0];
|
|
15942
15964
|
timelineIntervalsGroup.remove(obj);
|
|
@@ -15946,7 +15968,7 @@ function XViewScene({
|
|
|
15946
15968
|
obj.material.dispose();
|
|
15947
15969
|
}
|
|
15948
15970
|
}
|
|
15949
|
-
Object.values(
|
|
15971
|
+
Object.values(nodeObjects).forEach((mesh) => {
|
|
15950
15972
|
const oldLabel = mesh.getObjectByName("timelineLabel");
|
|
15951
15973
|
if (oldLabel) {
|
|
15952
15974
|
mesh.remove(oldLabel);
|
|
@@ -15970,7 +15992,7 @@ function XViewScene({
|
|
|
15970
15992
|
}
|
|
15971
15993
|
return null;
|
|
15972
15994
|
};
|
|
15973
|
-
Object.values(
|
|
15995
|
+
Object.values(nodeObjects).forEach((mesh) => {
|
|
15974
15996
|
const dateProp = mesh.userData.Date;
|
|
15975
15997
|
let nodeInfo = { mesh, type: "point", label: "", isUndated: true };
|
|
15976
15998
|
if (dateProp) {
|
|
@@ -16345,14 +16367,14 @@ function XViewScene({
|
|
|
16345
16367
|
(nodeData, position, suppressVersionUpdate = false, forceShowQuestDate = false) => {
|
|
16346
16368
|
const {
|
|
16347
16369
|
graphGroup,
|
|
16348
|
-
nodeObjects
|
|
16370
|
+
nodeObjects,
|
|
16349
16371
|
clickableNodes,
|
|
16350
16372
|
glowTexture,
|
|
16351
16373
|
tweenGroup
|
|
16352
16374
|
} = stateRef.current;
|
|
16353
16375
|
const nodeId = String(nodeData.id);
|
|
16354
|
-
if (
|
|
16355
|
-
const existingMesh =
|
|
16376
|
+
if (nodeObjects[nodeId]) {
|
|
16377
|
+
const existingMesh = nodeObjects[nodeId];
|
|
16356
16378
|
if (position) {
|
|
16357
16379
|
const updateTween = new import_tween2.Tween(existingMesh.position).to(position, 800).easing(import_tween2.Easing.Cubic.Out);
|
|
16358
16380
|
tweenGroup.add(updateTween);
|
|
@@ -16373,7 +16395,7 @@ function XViewScene({
|
|
|
16373
16395
|
}
|
|
16374
16396
|
graphGroup.add(mesh.userData.labelObject);
|
|
16375
16397
|
}
|
|
16376
|
-
|
|
16398
|
+
nodeObjects[nodeId] = mesh;
|
|
16377
16399
|
clickableNodes.push(mesh);
|
|
16378
16400
|
if (!suppressVersionUpdate) {
|
|
16379
16401
|
setSceneVersion((v) => v + 1);
|
|
@@ -16383,15 +16405,15 @@ function XViewScene({
|
|
|
16383
16405
|
[]
|
|
16384
16406
|
);
|
|
16385
16407
|
const handleActivateReshapeLens = (0, import_react33.useCallback)(({ type, columns, centerNodeId }) => {
|
|
16386
|
-
const { nodeObjects
|
|
16387
|
-
if (!
|
|
16388
|
-
const activeNodeIds = Object.keys(
|
|
16408
|
+
const { nodeObjects, tweenGroup, camera, controls } = stateRef.current;
|
|
16409
|
+
if (!nodeObjects || !tweenGroup || !camera || !controls) return;
|
|
16410
|
+
const activeNodeIds = Object.keys(nodeObjects);
|
|
16389
16411
|
if (activeNodeIds.length === 0) return;
|
|
16390
16412
|
let sumX = 0;
|
|
16391
16413
|
let sumY = 0;
|
|
16392
16414
|
let nodeCount = 0;
|
|
16393
16415
|
activeNodeIds.forEach((id) => {
|
|
16394
|
-
const mesh =
|
|
16416
|
+
const mesh = nodeObjects[id];
|
|
16395
16417
|
if (mesh && mesh.material) {
|
|
16396
16418
|
const opacityTween = new import_tween2.Tween(mesh.material).to({ opacity: 1 }, 1200).easing(import_tween2.Easing.Cubic.Out);
|
|
16397
16419
|
tweenGroup.add(opacityTween);
|
|
@@ -16406,7 +16428,7 @@ function XViewScene({
|
|
|
16406
16428
|
const rowSpacing = 80;
|
|
16407
16429
|
const numCols = columns || 4;
|
|
16408
16430
|
activeNodeIds.forEach((id, index) => {
|
|
16409
|
-
const mesh =
|
|
16431
|
+
const mesh = nodeObjects[id];
|
|
16410
16432
|
const col = index % numCols;
|
|
16411
16433
|
const row = Math.floor(index / numCols);
|
|
16412
16434
|
const targetX = (col - (numCols - 1) / 2) * colSpacing;
|
|
@@ -16428,7 +16450,7 @@ function XViewScene({
|
|
|
16428
16450
|
const total = activeNodeIds.length;
|
|
16429
16451
|
const radius = Math.max(80, total * 8);
|
|
16430
16452
|
activeNodeIds.forEach((id, index) => {
|
|
16431
|
-
const mesh =
|
|
16453
|
+
const mesh = nodeObjects[id];
|
|
16432
16454
|
const angle = index / total * Math.PI * 2;
|
|
16433
16455
|
const targetX = Math.cos(angle) * radius;
|
|
16434
16456
|
const targetY = Math.sin(angle) * radius;
|
|
@@ -16446,7 +16468,7 @@ function XViewScene({
|
|
|
16446
16468
|
nodeCount++;
|
|
16447
16469
|
});
|
|
16448
16470
|
} else if (type === "Star") {
|
|
16449
|
-
const centerMesh = centerNodeId ?
|
|
16471
|
+
const centerMesh = centerNodeId ? nodeObjects[String(centerNodeId)] : null;
|
|
16450
16472
|
const orbitingNodeIds = activeNodeIds.filter((id) => id !== String(centerNodeId));
|
|
16451
16473
|
const totalOrbiting = orbitingNodeIds.length;
|
|
16452
16474
|
const radius = Math.max(80, totalOrbiting * 10);
|
|
@@ -16465,7 +16487,7 @@ function XViewScene({
|
|
|
16465
16487
|
nodeCount++;
|
|
16466
16488
|
}
|
|
16467
16489
|
orbitingNodeIds.forEach((id, index) => {
|
|
16468
|
-
const mesh =
|
|
16490
|
+
const mesh = nodeObjects[id];
|
|
16469
16491
|
const angle = totalOrbiting > 0 ? index / totalOrbiting * Math.PI * 2 : 0;
|
|
16470
16492
|
const targetX = Math.cos(angle) * radius;
|
|
16471
16493
|
const targetY = Math.sin(angle) * radius;
|
|
@@ -16505,8 +16527,8 @@ function XViewScene({
|
|
|
16505
16527
|
}, []);
|
|
16506
16528
|
const handleActivateQuestLens = (0, import_react33.useCallback)(({ assigneeId, status: status2, milestoneId }) => {
|
|
16507
16529
|
var _a2;
|
|
16508
|
-
const { nodeObjects
|
|
16509
|
-
if (!
|
|
16530
|
+
const { nodeObjects, tweenGroup, graphGroup } = stateRef.current;
|
|
16531
|
+
if (!nodeObjects || !tweenGroup || !graphGroup) return;
|
|
16510
16532
|
const allQuests = ((_a2 = sceneDataRef.current) == null ? void 0 : _a2.quest_nodes) || [];
|
|
16511
16533
|
const filteredQuests = allQuests.filter((q) => {
|
|
16512
16534
|
const matchAssignee = !assigneeId || String(q.assignee_id) === String(assigneeId);
|
|
@@ -16568,7 +16590,7 @@ function XViewScene({
|
|
|
16568
16590
|
positionGroups.get(posKey).push(String(q.id));
|
|
16569
16591
|
});
|
|
16570
16592
|
});
|
|
16571
|
-
Object.values(
|
|
16593
|
+
Object.values(nodeObjects).forEach((mesh) => {
|
|
16572
16594
|
const oldLabel = mesh.getObjectByName("questDateLabel") || mesh.getObjectByName("timelineLabel");
|
|
16573
16595
|
if (oldLabel) {
|
|
16574
16596
|
mesh.remove(oldLabel);
|
|
@@ -16583,13 +16605,13 @@ function XViewScene({
|
|
|
16583
16605
|
mesh.userData.timelineEndLabel = null;
|
|
16584
16606
|
}
|
|
16585
16607
|
});
|
|
16586
|
-
const nonFilteredNodeIds = Object.keys(
|
|
16608
|
+
const nonFilteredNodeIds = Object.keys(nodeObjects).filter((id) => !filteredQuests.some((q) => String(q.id) === String(id)));
|
|
16587
16609
|
const COMMON_START_X = startX - 100;
|
|
16588
16610
|
const COMMON_COL_SPACING = 30;
|
|
16589
16611
|
const COMMON_ROW_SPACING = 35;
|
|
16590
16612
|
const MAX_COMMON_ROWS = 15;
|
|
16591
16613
|
nonFilteredNodeIds.forEach((id, idx) => {
|
|
16592
|
-
const mesh =
|
|
16614
|
+
const mesh = nodeObjects[id];
|
|
16593
16615
|
if (!mesh) return;
|
|
16594
16616
|
const col = Math.floor(idx / MAX_COMMON_ROWS);
|
|
16595
16617
|
const row = idx % MAX_COMMON_ROWS;
|
|
@@ -16615,7 +16637,7 @@ function XViewScene({
|
|
|
16615
16637
|
sideTween.start();
|
|
16616
16638
|
});
|
|
16617
16639
|
filteredQuests.forEach((q) => {
|
|
16618
|
-
const mesh =
|
|
16640
|
+
const mesh = nodeObjects[String(q.id)];
|
|
16619
16641
|
if (mesh) {
|
|
16620
16642
|
if (mesh.material) {
|
|
16621
16643
|
const fadeInTween = new import_tween2.Tween(mesh.material).to({ opacity: 1 }, 1200).easing(import_tween2.Easing.Cubic.Out);
|
|
@@ -16633,7 +16655,7 @@ function XViewScene({
|
|
|
16633
16655
|
const colX = startX + colIndex * QUEST_LENS_COLUMN_SPACING;
|
|
16634
16656
|
questsInCol.forEach((q, rowIndex) => {
|
|
16635
16657
|
const nodeId = String(q.id);
|
|
16636
|
-
let mesh =
|
|
16658
|
+
let mesh = nodeObjects[nodeId];
|
|
16637
16659
|
const timeInfo = questTimeInfos.get(nodeId) || { isUndated: true };
|
|
16638
16660
|
let targetY;
|
|
16639
16661
|
if (!timeInfo.isUndated) {
|
|
@@ -16779,8 +16801,8 @@ function XViewScene({
|
|
|
16779
16801
|
stateRef.current.timelineIntervalsGroup = timelineIntervalsGroup;
|
|
16780
16802
|
const graphData = sceneDataRef.current;
|
|
16781
16803
|
const nodePositions = calculateNodePositions(graphData.nodes);
|
|
16782
|
-
const
|
|
16783
|
-
stateRef.current.nodeObjects =
|
|
16804
|
+
const nodeObjects = {};
|
|
16805
|
+
stateRef.current.nodeObjects = nodeObjects;
|
|
16784
16806
|
stateRef.current.glowTexture = makeGlowTexture();
|
|
16785
16807
|
graphData.nodes.forEach((node) => {
|
|
16786
16808
|
const position = nodePositions[node.id] || new THREE3.Vector3();
|
|
@@ -16790,7 +16812,7 @@ function XViewScene({
|
|
|
16790
16812
|
mesh.userData.labelObject.position.copy(mesh.position).add(mesh.userData.labelOffset);
|
|
16791
16813
|
graphGroup.add(mesh.userData.labelObject);
|
|
16792
16814
|
}
|
|
16793
|
-
|
|
16815
|
+
nodeObjects[String(node.id)] = mesh;
|
|
16794
16816
|
stateRef.current.clickableNodes.push(mesh);
|
|
16795
16817
|
});
|
|
16796
16818
|
const linksGroupedByNodes = /* @__PURE__ */ new Map();
|
|
@@ -16802,8 +16824,8 @@ function XViewScene({
|
|
|
16802
16824
|
linksGroupedByNodes.get(pairKey).push(link);
|
|
16803
16825
|
});
|
|
16804
16826
|
linksGroupedByNodes.forEach((linksArray) => {
|
|
16805
|
-
const sourceNode =
|
|
16806
|
-
const targetNode =
|
|
16827
|
+
const sourceNode = nodeObjects[String(linksArray[0].source)];
|
|
16828
|
+
const targetNode = nodeObjects[String(linksArray[0].target)];
|
|
16807
16829
|
if (sourceNode && targetNode) {
|
|
16808
16830
|
const resolution = new THREE3.Vector2(
|
|
16809
16831
|
currentMount.clientWidth,
|
|
@@ -17135,15 +17157,11 @@ function XViewScene({
|
|
|
17135
17157
|
let newTree = addChildToNode(activeTree, parentId, fullNodeData);
|
|
17136
17158
|
setQuestTreeMode2((prev) => ({
|
|
17137
17159
|
...prev,
|
|
17138
|
-
[activeTreeKey]: newTree
|
|
17139
|
-
isAddingNodes: false,
|
|
17140
|
-
isAddingAbstractionNodes: false
|
|
17160
|
+
[activeTreeKey]: newTree
|
|
17141
17161
|
}));
|
|
17142
17162
|
} else {
|
|
17143
17163
|
setQuestTreeMode2((prev) => ({
|
|
17144
|
-
...prev
|
|
17145
|
-
isAddingNodes: false,
|
|
17146
|
-
isAddingAbstractionNodes: false
|
|
17164
|
+
...prev
|
|
17147
17165
|
}));
|
|
17148
17166
|
}
|
|
17149
17167
|
return;
|
|
@@ -18035,17 +18053,53 @@ function XViewScene({
|
|
|
18035
18053
|
const formattedTree = convertTreeToIds(newTree);
|
|
18036
18054
|
const formattedAbstractionTree = convertTreeToIds(newAbstractionTree);
|
|
18037
18055
|
if (questNodeId && sceneConfigId) {
|
|
18038
|
-
const sceneData =
|
|
18056
|
+
const sceneData = sceneDataRef.current;
|
|
18039
18057
|
if (sceneData && sceneData.quest_nodes) {
|
|
18040
18058
|
const questIndex = sceneData.quest_nodes.findIndex((q) => String(q.id) === String(questNodeId));
|
|
18041
18059
|
if (questIndex !== -1) {
|
|
18042
18060
|
sceneData.quest_nodes[questIndex].quest_tree = formattedTree;
|
|
18043
18061
|
sceneData.quest_nodes[questIndex].quest_abstraction_tree = formattedAbstractionTree;
|
|
18044
|
-
if (
|
|
18045
|
-
|
|
18062
|
+
if (graphDataRef.current[sceneConfigId]) {
|
|
18063
|
+
const graphIndex = graphDataRef.current[sceneConfigId].nodes.findIndex(
|
|
18064
|
+
(q) => String(q.id) === String(questNodeId)
|
|
18065
|
+
);
|
|
18066
|
+
if (graphIndex !== -1) {
|
|
18067
|
+
graphDataRef.current[sceneConfigId].nodes[graphIndex].quest_tree = formattedTree;
|
|
18068
|
+
graphDataRef.current[sceneConfigId].nodes[graphIndex].quest_abstraction_tree = formattedAbstractionTree;
|
|
18069
|
+
}
|
|
18070
|
+
}
|
|
18071
|
+
if (parentDataRef.current[sceneConfigId]) {
|
|
18072
|
+
const parentIndex = parentDataRef.current[sceneConfigId].nodes.findIndex(
|
|
18073
|
+
(q) => String(q.id) === String(questNodeId)
|
|
18074
|
+
);
|
|
18075
|
+
if (parentIndex !== -1) {
|
|
18076
|
+
parentDataRef.current[sceneConfigId].nodes[parentIndex].quest_tree = formattedTree;
|
|
18077
|
+
parentDataRef.current[sceneConfigId].nodes[parentIndex].quest_abstraction_tree = formattedAbstractionTree;
|
|
18078
|
+
}
|
|
18079
|
+
}
|
|
18080
|
+
if (save_view_data && sceneSaveUrl) {
|
|
18081
|
+
const { nodeObjects: nObj, allLinks: aLinks } = stateRef.current;
|
|
18082
|
+
const currentNodes = nObj ? Object.values(nObj).map((mesh) => {
|
|
18083
|
+
const { _baseEmissiveIntensity, labelObject, labelOffset, timelineIntervalBar, timelineEndLabel, ...serializableNodeData } = mesh.userData;
|
|
18084
|
+
return serializableNodeData;
|
|
18085
|
+
}) : sceneData.nodes || [];
|
|
18086
|
+
const currentLinks = aLinks ? aLinks.map((line) => {
|
|
18087
|
+
const { sourceNode, targetNode, ...serializableLinkData } = line.userData;
|
|
18088
|
+
return serializableLinkData;
|
|
18089
|
+
}) : sceneData.links || [];
|
|
18090
|
+
const sceneFileData = {
|
|
18091
|
+
...sceneData,
|
|
18092
|
+
nodes: currentNodes,
|
|
18093
|
+
links: currentLinks,
|
|
18094
|
+
quest_nodes: sceneData.quest_nodes,
|
|
18095
|
+
quest_links: sceneData.quest_links || [],
|
|
18096
|
+
quest_counter: sceneData.quest_counter || 1,
|
|
18097
|
+
milestones: sceneData.milestones || []
|
|
18098
|
+
};
|
|
18099
|
+
await save_view_data(sceneSaveUrl, sceneFileData);
|
|
18046
18100
|
}
|
|
18047
18101
|
const updatedNodeData = sceneData.quest_nodes[questIndex];
|
|
18048
|
-
const nodeMesh = nodeObjects[String(questNodeId)];
|
|
18102
|
+
const nodeMesh = (_a2 = stateRef.current.nodeObjects) == null ? void 0 : _a2[String(questNodeId)];
|
|
18049
18103
|
if (nodeMesh) {
|
|
18050
18104
|
nodeMesh.userData.questData = updatedNodeData;
|
|
18051
18105
|
}
|
|
@@ -18087,7 +18141,7 @@ function XViewScene({
|
|
|
18087
18141
|
};
|
|
18088
18142
|
const handleSaveQuestNode = async (context, newQuestData) => {
|
|
18089
18143
|
const {
|
|
18090
|
-
graphDataRef,
|
|
18144
|
+
graphDataRef: graphDataRef2,
|
|
18091
18145
|
sceneDataRef: sceneDataRef2,
|
|
18092
18146
|
stateRef: stateRef2,
|
|
18093
18147
|
setters,
|
|
@@ -18097,7 +18151,7 @@ function XViewScene({
|
|
|
18097
18151
|
sceneConfigId: sceneConfigId2,
|
|
18098
18152
|
ownerId: ownerId2
|
|
18099
18153
|
} = context;
|
|
18100
|
-
if (!
|
|
18154
|
+
if (!graphDataRef2.current || (viewType == null ? void 0 : viewType.toLowerCase()) !== "view") return;
|
|
18101
18155
|
const currentCounter = sceneDataRef2.current.quest_counter || 1;
|
|
18102
18156
|
const newNode = {
|
|
18103
18157
|
id: import_short_uuid2.default.generate(),
|
|
@@ -18105,14 +18159,14 @@ function XViewScene({
|
|
|
18105
18159
|
is_quest: true,
|
|
18106
18160
|
type: ["quest", ...newQuestData.type.filter((t) => t !== "quest")]
|
|
18107
18161
|
};
|
|
18108
|
-
if (!
|
|
18109
|
-
|
|
18162
|
+
if (!graphDataRef2.current[sceneConfigId2]) {
|
|
18163
|
+
graphDataRef2.current[sceneConfigId2] = { nodes: [], links: [] };
|
|
18110
18164
|
}
|
|
18111
|
-
|
|
18165
|
+
graphDataRef2.current[sceneConfigId2].nodes.push(newNode);
|
|
18112
18166
|
const sceneFileData = {
|
|
18113
18167
|
...sceneDataRef2.current,
|
|
18114
|
-
quest_nodes:
|
|
18115
|
-
quest_links:
|
|
18168
|
+
quest_nodes: graphDataRef2.current[sceneConfigId2].nodes,
|
|
18169
|
+
quest_links: graphDataRef2.current[sceneConfigId2].links,
|
|
18116
18170
|
quest_counter: currentCounter + 1
|
|
18117
18171
|
};
|
|
18118
18172
|
try {
|
|
@@ -18123,9 +18177,9 @@ function XViewScene({
|
|
|
18123
18177
|
ownerId: ownerId2,
|
|
18124
18178
|
datasetName: "Quests Internas (View)"
|
|
18125
18179
|
});
|
|
18126
|
-
sceneDataRef2.current.quest_nodes = [...
|
|
18180
|
+
sceneDataRef2.current.quest_nodes = [...graphDataRef2.current[sceneConfigId2].nodes];
|
|
18127
18181
|
if (parentDataRef.current[sceneConfigId2]) {
|
|
18128
|
-
parentDataRef.current[sceneConfigId2].nodes = [...
|
|
18182
|
+
parentDataRef.current[sceneConfigId2].nodes = [...graphDataRef2.current[sceneConfigId2].nodes];
|
|
18129
18183
|
}
|
|
18130
18184
|
const finalPosition = stateRef2.current.ghostElements.node ? stateRef2.current.ghostElements.node.position.clone() : stateRef2.current.controls.target.clone();
|
|
18131
18185
|
const { graphGroup, ghostElements } = stateRef2.current;
|
|
@@ -18147,26 +18201,26 @@ function XViewScene({
|
|
|
18147
18201
|
userActionHandlers.handleCompleteConnection = async (context, targetNodeData) => {
|
|
18148
18202
|
const {
|
|
18149
18203
|
stateRef: stateRef2,
|
|
18150
|
-
graphDataRef,
|
|
18204
|
+
graphDataRef: graphDataRef2,
|
|
18151
18205
|
sceneDataRef: sceneDataRef2,
|
|
18152
18206
|
sceneConfigId: sceneConfigId2,
|
|
18153
18207
|
sceneSaveUrl: sceneSaveUrl2,
|
|
18154
18208
|
ownerId: ownerId2
|
|
18155
18209
|
} = context;
|
|
18156
18210
|
const { sourceNodeData } = stateRef2.current.connection;
|
|
18157
|
-
if (!
|
|
18211
|
+
if (!graphDataRef2.current || !sceneDataRef2.current || !sourceNodeData || !targetNodeData) {
|
|
18158
18212
|
userActionHandlers.handleCancelConnection(context);
|
|
18159
18213
|
return;
|
|
18160
18214
|
}
|
|
18161
18215
|
const sourceParentInfo = getParentFileInfoForNode(
|
|
18162
|
-
|
|
18216
|
+
graphDataRef2.current,
|
|
18163
18217
|
sceneDataRef2.current,
|
|
18164
18218
|
sourceNodeData.id,
|
|
18165
18219
|
sceneConfigId2,
|
|
18166
18220
|
ownerId2
|
|
18167
18221
|
);
|
|
18168
18222
|
const targetParentInfo = getParentFileInfoForNode(
|
|
18169
|
-
|
|
18223
|
+
graphDataRef2.current,
|
|
18170
18224
|
sceneDataRef2.current,
|
|
18171
18225
|
targetNodeData.id,
|
|
18172
18226
|
sceneConfigId2,
|
|
@@ -18186,7 +18240,7 @@ function XViewScene({
|
|
|
18186
18240
|
};
|
|
18187
18241
|
try {
|
|
18188
18242
|
if (parentFileIdToSave === sceneConfigId2) {
|
|
18189
|
-
const specificParentData =
|
|
18243
|
+
const specificParentData = graphDataRef2.current[sceneConfigId2];
|
|
18190
18244
|
specificParentData.links.push(newLink);
|
|
18191
18245
|
const viewFilePayload = {
|
|
18192
18246
|
...sceneDataRef2.current,
|
|
@@ -18197,7 +18251,7 @@ function XViewScene({
|
|
|
18197
18251
|
await context.actions.save_view_data(sceneSaveUrl2, viewFilePayload);
|
|
18198
18252
|
} else {
|
|
18199
18253
|
const specificParentData = JSON.parse(
|
|
18200
|
-
JSON.stringify(
|
|
18254
|
+
JSON.stringify(graphDataRef2.current[parentFileIdToSave])
|
|
18201
18255
|
);
|
|
18202
18256
|
specificParentData.links.push(newLink);
|
|
18203
18257
|
const filenameForSpecificParent = `x_view_dbs/${ownerIdToSave}/${parentFileIdToSave}`;
|
|
@@ -18205,7 +18259,7 @@ function XViewScene({
|
|
|
18205
18259
|
filenameForSpecificParent,
|
|
18206
18260
|
specificParentData
|
|
18207
18261
|
);
|
|
18208
|
-
|
|
18262
|
+
graphDataRef2.current[parentFileIdToSave] = specificParentData;
|
|
18209
18263
|
}
|
|
18210
18264
|
addNewLinkToScene(stateRef2.current, newLink);
|
|
18211
18265
|
} catch (error) {
|
|
@@ -18252,7 +18306,7 @@ function XViewScene({
|
|
|
18252
18306
|
}
|
|
18253
18307
|
});
|
|
18254
18308
|
}
|
|
18255
|
-
const { ancestryGroup, nodeObjects
|
|
18309
|
+
const { ancestryGroup, nodeObjects, renderer, renderedAncestries } = stateRef.current;
|
|
18256
18310
|
const currentRenderLimit = stateRef.current.maxAncestryRenderIndex || 0;
|
|
18257
18311
|
const isFullRenderRequest = !normalizedAllowedIds;
|
|
18258
18312
|
const checkShouldRender = (section) => {
|
|
@@ -18356,10 +18410,10 @@ function XViewScene({
|
|
|
18356
18410
|
);
|
|
18357
18411
|
if (!fullTree) return;
|
|
18358
18412
|
const rootNodeId = String(ancestryObject.ancestral_node);
|
|
18359
|
-
let rootNodeMesh =
|
|
18413
|
+
let rootNodeMesh = nodeObjects[rootNodeId];
|
|
18360
18414
|
let originMesh = null;
|
|
18361
18415
|
if (ancestryObject._originNodeId) {
|
|
18362
|
-
originMesh =
|
|
18416
|
+
originMesh = nodeObjects[String(ancestryObject._originNodeId)];
|
|
18363
18417
|
}
|
|
18364
18418
|
let rootTargetPos = null;
|
|
18365
18419
|
if (originMesh) {
|
|
@@ -18573,7 +18627,7 @@ function XViewScene({
|
|
|
18573
18627
|
} else {
|
|
18574
18628
|
const traverseAndCollect = (item) => {
|
|
18575
18629
|
if (item.node) {
|
|
18576
|
-
const mesh =
|
|
18630
|
+
const mesh = nodeObjects[String(item.node.id)];
|
|
18577
18631
|
if (mesh) allRenderedNodePositions.push(mesh.position.clone());
|
|
18578
18632
|
}
|
|
18579
18633
|
if (item.children) item.children.forEach(traverseAndCollect);
|
|
@@ -18621,7 +18675,7 @@ function XViewScene({
|
|
|
18621
18675
|
const nodeIds = collectNodeIdsInSection(targetSectionForZone);
|
|
18622
18676
|
const vectors = [];
|
|
18623
18677
|
nodeIds.forEach((id) => {
|
|
18624
|
-
const mesh =
|
|
18678
|
+
const mesh = nodeObjects[String(id)];
|
|
18625
18679
|
if (mesh) {
|
|
18626
18680
|
const targetPos = targetPositionsCache.get(String(id));
|
|
18627
18681
|
vectors.push(targetPos ? targetPos.clone() : mesh.position.clone());
|
|
@@ -18680,8 +18734,8 @@ function XViewScene({
|
|
|
18680
18734
|
focusTargetPosition = targetPositionsCache.get(anchorId) || currentAnchorMesh.position.clone();
|
|
18681
18735
|
focusTargetRotation = baseRotation;
|
|
18682
18736
|
}
|
|
18683
|
-
} else if (activeSectionIdForFocus &&
|
|
18684
|
-
const directNode =
|
|
18737
|
+
} else if (activeSectionIdForFocus && nodeObjects[String(activeSectionIdForFocus)]) {
|
|
18738
|
+
const directNode = nodeObjects[String(activeSectionIdForFocus)];
|
|
18685
18739
|
const tPos = targetPositionsCache.get(String(activeSectionIdForFocus));
|
|
18686
18740
|
focusTargetPosition = tPos ? tPos.clone() : directNode.position.clone();
|
|
18687
18741
|
focusTargetRotation = baseRotation;
|
|
@@ -18732,7 +18786,7 @@ function XViewScene({
|
|
|
18732
18786
|
(prev) => prev.visible ? { ...prev, visible: false } : prev
|
|
18733
18787
|
);
|
|
18734
18788
|
if (!ancestryObject || !ancestryObject.abstraction_tree) return;
|
|
18735
|
-
const { ancestryGroup, nodeObjects
|
|
18789
|
+
const { ancestryGroup, nodeObjects, renderer, renderedAncestries } = stateRef.current;
|
|
18736
18790
|
const allParentNodes = Object.values(parentDataRef.current).flatMap(
|
|
18737
18791
|
(f) => f.nodes
|
|
18738
18792
|
);
|
|
@@ -18773,7 +18827,7 @@ function XViewScene({
|
|
|
18773
18827
|
const ancestryEntry = { id: absId, lines: [], isFullRender: true };
|
|
18774
18828
|
renderedAncestries.push(ancestryEntry);
|
|
18775
18829
|
const rootNodeId = String(fullTree.node.id);
|
|
18776
|
-
let rootNodeMesh =
|
|
18830
|
+
let rootNodeMesh = nodeObjects[rootNodeId];
|
|
18777
18831
|
let rootTargetPos = rootNodeMesh ? rootNodeMesh.position.clone() : new THREE3.Vector3(0, 0, 0);
|
|
18778
18832
|
if (!rootNodeMesh) {
|
|
18779
18833
|
rootNodeMesh = addOrUpdateNodeMesh(fullTree.node, rootTargetPos, true);
|
|
@@ -19885,8 +19939,8 @@ function XViewScene({
|
|
|
19885
19939
|
setSceneVersion((v) => v + 1);
|
|
19886
19940
|
const isView = ((_a2 = viewParams == null ? void 0 : viewParams.type) == null ? void 0 : _a2.toLowerCase()) === "view";
|
|
19887
19941
|
if (!isView || !save_view_data || !sceneSaveUrl) return;
|
|
19888
|
-
const { nodeObjects
|
|
19889
|
-
const currentNodes = Object.values(
|
|
19942
|
+
const { nodeObjects, allLinks } = stateRef.current;
|
|
19943
|
+
const currentNodes = Object.values(nodeObjects || {}).map((mesh) => {
|
|
19890
19944
|
const {
|
|
19891
19945
|
_baseEmissiveIntensity,
|
|
19892
19946
|
labelObject,
|
|
@@ -19925,15 +19979,15 @@ function XViewScene({
|
|
|
19925
19979
|
);
|
|
19926
19980
|
const handleSaveCurrentView = (0, import_react33.useCallback)(async () => {
|
|
19927
19981
|
var _a2, _b2, _c2;
|
|
19928
|
-
const { nodeObjects
|
|
19929
|
-
if (!
|
|
19982
|
+
const { nodeObjects, allLinks } = stateRef.current;
|
|
19983
|
+
if (!nodeObjects || !allLinks || !sceneSaveUrl || !parentDataRef.current) {
|
|
19930
19984
|
console.warn(
|
|
19931
19985
|
"N\xE3o \xE9 poss\xEDvel salvar a cena: estado n\xE3o inicializado ou URL de salvamento ausente."
|
|
19932
19986
|
);
|
|
19933
19987
|
return;
|
|
19934
19988
|
}
|
|
19935
19989
|
if (!save_view_data) return;
|
|
19936
|
-
const currentNodes = Object.values(
|
|
19990
|
+
const currentNodes = Object.values(nodeObjects).map((mesh) => {
|
|
19937
19991
|
const {
|
|
19938
19992
|
_baseEmissiveIntensity,
|
|
19939
19993
|
labelObject,
|
|
@@ -19988,8 +20042,8 @@ function XViewScene({
|
|
|
19988
20042
|
const detailsNodeDatasetInfo = detailsNode ? stateRef.current.nodeIdToParentFileMap.get(String(detailsNode.id)) : null;
|
|
19989
20043
|
(0, import_react33.useEffect)(() => {
|
|
19990
20044
|
if (isInitialized && focusNodeId && !hasFocusedInitial) {
|
|
19991
|
-
const
|
|
19992
|
-
const targetMesh =
|
|
20045
|
+
const nodeObjects = stateRef.current.nodeObjects || {};
|
|
20046
|
+
const targetMesh = nodeObjects[String(focusNodeId)];
|
|
19993
20047
|
if (targetMesh) {
|
|
19994
20048
|
setTimeout(() => {
|
|
19995
20049
|
tweenToTarget(targetMesh, 1.2);
|
|
@@ -20078,10 +20132,10 @@ function XViewScene({
|
|
|
20078
20132
|
if (isUiClear) {
|
|
20079
20133
|
const isView = ((_c2 = viewParams == null ? void 0 : viewParams.type) == null ? void 0 : _c2.toLowerCase()) === "view";
|
|
20080
20134
|
if (!isView) return;
|
|
20081
|
-
const { graphGroup, glowTexture, controls: sceneControls, nodeObjects
|
|
20135
|
+
const { graphGroup, glowTexture, controls: sceneControls, nodeObjects } = stateRef.current;
|
|
20082
20136
|
if (graphGroup) {
|
|
20083
20137
|
let ghostPosition = sceneControls.target.clone();
|
|
20084
|
-
const existingNodes = Object.values(
|
|
20138
|
+
const existingNodes = Object.values(nodeObjects);
|
|
20085
20139
|
let isOccupied = true;
|
|
20086
20140
|
let radius = 18;
|
|
20087
20141
|
let angle = 0;
|