@lv-x-software-house/x_view 1.2.6-dev.77 → 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 +212 -163
- package/dist/index.mjs +212 -163
- 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,13 +8934,20 @@ 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",
|
|
@@ -8979,16 +8982,7 @@ function CreateQuestTreePanel({
|
|
|
8979
8982
|
selectedParentId
|
|
8980
8983
|
}
|
|
8981
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..."))),
|
|
8982
|
-
/* @__PURE__ */ import_react12.default.createElement("div", { className: "absolute bottom-6 left-1/2 -translate-x-1/2
|
|
8983
|
-
"button",
|
|
8984
|
-
{
|
|
8985
|
-
onClick: handleLocalSave,
|
|
8986
|
-
disabled: isSaving,
|
|
8987
|
-
className: "flex items-center gap-2 px-8 py-3 rounded-full font-bold shadow-2xl transition-all scale-110 bg-emerald-600 hover:bg-emerald-500 text-white shadow-emerald-500/20 active:scale-100"
|
|
8988
|
-
},
|
|
8989
|
-
isSaving ? "Salvando..." : /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null, /* @__PURE__ */ import_react12.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ import_react12.default.createElement("path", { d: "M20 6L9 17l-5-5" })), " Salvar Mudan\xE7as")
|
|
8990
|
-
)),
|
|
8991
|
-
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"))
|
|
8992
8986
|
);
|
|
8993
8987
|
}
|
|
8994
8988
|
|
|
@@ -13042,11 +13036,30 @@ ${noteText}` : noteText : entry.notes,
|
|
|
13042
13036
|
type: "button",
|
|
13043
13037
|
onClick: () => {
|
|
13044
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: [] };
|
|
13045
13054
|
setQuestTreeMode2((prev) => ({
|
|
13046
13055
|
...prev,
|
|
13047
13056
|
isActive: true,
|
|
13048
13057
|
isAddingNodes: true,
|
|
13049
|
-
questNodeId: node == null ? void 0 : node.id
|
|
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
|
|
13050
13063
|
}));
|
|
13051
13064
|
}
|
|
13052
13065
|
},
|
|
@@ -15944,8 +15957,8 @@ function XViewScene({
|
|
|
15944
15957
|
[]
|
|
15945
15958
|
);
|
|
15946
15959
|
const handleActivateTimeline = (0, import_react33.useCallback)(() => {
|
|
15947
|
-
const { nodeObjects
|
|
15948
|
-
if (!
|
|
15960
|
+
const { nodeObjects, tweenGroup, timelineIntervalsGroup } = stateRef.current;
|
|
15961
|
+
if (!nodeObjects || !tweenGroup || !timelineIntervalsGroup) return;
|
|
15949
15962
|
while (timelineIntervalsGroup.children.length > 0) {
|
|
15950
15963
|
const obj = timelineIntervalsGroup.children[0];
|
|
15951
15964
|
timelineIntervalsGroup.remove(obj);
|
|
@@ -15955,7 +15968,7 @@ function XViewScene({
|
|
|
15955
15968
|
obj.material.dispose();
|
|
15956
15969
|
}
|
|
15957
15970
|
}
|
|
15958
|
-
Object.values(
|
|
15971
|
+
Object.values(nodeObjects).forEach((mesh) => {
|
|
15959
15972
|
const oldLabel = mesh.getObjectByName("timelineLabel");
|
|
15960
15973
|
if (oldLabel) {
|
|
15961
15974
|
mesh.remove(oldLabel);
|
|
@@ -15979,7 +15992,7 @@ function XViewScene({
|
|
|
15979
15992
|
}
|
|
15980
15993
|
return null;
|
|
15981
15994
|
};
|
|
15982
|
-
Object.values(
|
|
15995
|
+
Object.values(nodeObjects).forEach((mesh) => {
|
|
15983
15996
|
const dateProp = mesh.userData.Date;
|
|
15984
15997
|
let nodeInfo = { mesh, type: "point", label: "", isUndated: true };
|
|
15985
15998
|
if (dateProp) {
|
|
@@ -16354,14 +16367,14 @@ function XViewScene({
|
|
|
16354
16367
|
(nodeData, position, suppressVersionUpdate = false, forceShowQuestDate = false) => {
|
|
16355
16368
|
const {
|
|
16356
16369
|
graphGroup,
|
|
16357
|
-
nodeObjects
|
|
16370
|
+
nodeObjects,
|
|
16358
16371
|
clickableNodes,
|
|
16359
16372
|
glowTexture,
|
|
16360
16373
|
tweenGroup
|
|
16361
16374
|
} = stateRef.current;
|
|
16362
16375
|
const nodeId = String(nodeData.id);
|
|
16363
|
-
if (
|
|
16364
|
-
const existingMesh =
|
|
16376
|
+
if (nodeObjects[nodeId]) {
|
|
16377
|
+
const existingMesh = nodeObjects[nodeId];
|
|
16365
16378
|
if (position) {
|
|
16366
16379
|
const updateTween = new import_tween2.Tween(existingMesh.position).to(position, 800).easing(import_tween2.Easing.Cubic.Out);
|
|
16367
16380
|
tweenGroup.add(updateTween);
|
|
@@ -16382,7 +16395,7 @@ function XViewScene({
|
|
|
16382
16395
|
}
|
|
16383
16396
|
graphGroup.add(mesh.userData.labelObject);
|
|
16384
16397
|
}
|
|
16385
|
-
|
|
16398
|
+
nodeObjects[nodeId] = mesh;
|
|
16386
16399
|
clickableNodes.push(mesh);
|
|
16387
16400
|
if (!suppressVersionUpdate) {
|
|
16388
16401
|
setSceneVersion((v) => v + 1);
|
|
@@ -16392,15 +16405,15 @@ function XViewScene({
|
|
|
16392
16405
|
[]
|
|
16393
16406
|
);
|
|
16394
16407
|
const handleActivateReshapeLens = (0, import_react33.useCallback)(({ type, columns, centerNodeId }) => {
|
|
16395
|
-
const { nodeObjects
|
|
16396
|
-
if (!
|
|
16397
|
-
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);
|
|
16398
16411
|
if (activeNodeIds.length === 0) return;
|
|
16399
16412
|
let sumX = 0;
|
|
16400
16413
|
let sumY = 0;
|
|
16401
16414
|
let nodeCount = 0;
|
|
16402
16415
|
activeNodeIds.forEach((id) => {
|
|
16403
|
-
const mesh =
|
|
16416
|
+
const mesh = nodeObjects[id];
|
|
16404
16417
|
if (mesh && mesh.material) {
|
|
16405
16418
|
const opacityTween = new import_tween2.Tween(mesh.material).to({ opacity: 1 }, 1200).easing(import_tween2.Easing.Cubic.Out);
|
|
16406
16419
|
tweenGroup.add(opacityTween);
|
|
@@ -16415,7 +16428,7 @@ function XViewScene({
|
|
|
16415
16428
|
const rowSpacing = 80;
|
|
16416
16429
|
const numCols = columns || 4;
|
|
16417
16430
|
activeNodeIds.forEach((id, index) => {
|
|
16418
|
-
const mesh =
|
|
16431
|
+
const mesh = nodeObjects[id];
|
|
16419
16432
|
const col = index % numCols;
|
|
16420
16433
|
const row = Math.floor(index / numCols);
|
|
16421
16434
|
const targetX = (col - (numCols - 1) / 2) * colSpacing;
|
|
@@ -16437,7 +16450,7 @@ function XViewScene({
|
|
|
16437
16450
|
const total = activeNodeIds.length;
|
|
16438
16451
|
const radius = Math.max(80, total * 8);
|
|
16439
16452
|
activeNodeIds.forEach((id, index) => {
|
|
16440
|
-
const mesh =
|
|
16453
|
+
const mesh = nodeObjects[id];
|
|
16441
16454
|
const angle = index / total * Math.PI * 2;
|
|
16442
16455
|
const targetX = Math.cos(angle) * radius;
|
|
16443
16456
|
const targetY = Math.sin(angle) * radius;
|
|
@@ -16455,7 +16468,7 @@ function XViewScene({
|
|
|
16455
16468
|
nodeCount++;
|
|
16456
16469
|
});
|
|
16457
16470
|
} else if (type === "Star") {
|
|
16458
|
-
const centerMesh = centerNodeId ?
|
|
16471
|
+
const centerMesh = centerNodeId ? nodeObjects[String(centerNodeId)] : null;
|
|
16459
16472
|
const orbitingNodeIds = activeNodeIds.filter((id) => id !== String(centerNodeId));
|
|
16460
16473
|
const totalOrbiting = orbitingNodeIds.length;
|
|
16461
16474
|
const radius = Math.max(80, totalOrbiting * 10);
|
|
@@ -16474,7 +16487,7 @@ function XViewScene({
|
|
|
16474
16487
|
nodeCount++;
|
|
16475
16488
|
}
|
|
16476
16489
|
orbitingNodeIds.forEach((id, index) => {
|
|
16477
|
-
const mesh =
|
|
16490
|
+
const mesh = nodeObjects[id];
|
|
16478
16491
|
const angle = totalOrbiting > 0 ? index / totalOrbiting * Math.PI * 2 : 0;
|
|
16479
16492
|
const targetX = Math.cos(angle) * radius;
|
|
16480
16493
|
const targetY = Math.sin(angle) * radius;
|
|
@@ -16514,8 +16527,8 @@ function XViewScene({
|
|
|
16514
16527
|
}, []);
|
|
16515
16528
|
const handleActivateQuestLens = (0, import_react33.useCallback)(({ assigneeId, status: status2, milestoneId }) => {
|
|
16516
16529
|
var _a2;
|
|
16517
|
-
const { nodeObjects
|
|
16518
|
-
if (!
|
|
16530
|
+
const { nodeObjects, tweenGroup, graphGroup } = stateRef.current;
|
|
16531
|
+
if (!nodeObjects || !tweenGroup || !graphGroup) return;
|
|
16519
16532
|
const allQuests = ((_a2 = sceneDataRef.current) == null ? void 0 : _a2.quest_nodes) || [];
|
|
16520
16533
|
const filteredQuests = allQuests.filter((q) => {
|
|
16521
16534
|
const matchAssignee = !assigneeId || String(q.assignee_id) === String(assigneeId);
|
|
@@ -16577,7 +16590,7 @@ function XViewScene({
|
|
|
16577
16590
|
positionGroups.get(posKey).push(String(q.id));
|
|
16578
16591
|
});
|
|
16579
16592
|
});
|
|
16580
|
-
Object.values(
|
|
16593
|
+
Object.values(nodeObjects).forEach((mesh) => {
|
|
16581
16594
|
const oldLabel = mesh.getObjectByName("questDateLabel") || mesh.getObjectByName("timelineLabel");
|
|
16582
16595
|
if (oldLabel) {
|
|
16583
16596
|
mesh.remove(oldLabel);
|
|
@@ -16592,13 +16605,13 @@ function XViewScene({
|
|
|
16592
16605
|
mesh.userData.timelineEndLabel = null;
|
|
16593
16606
|
}
|
|
16594
16607
|
});
|
|
16595
|
-
const nonFilteredNodeIds = Object.keys(
|
|
16608
|
+
const nonFilteredNodeIds = Object.keys(nodeObjects).filter((id) => !filteredQuests.some((q) => String(q.id) === String(id)));
|
|
16596
16609
|
const COMMON_START_X = startX - 100;
|
|
16597
16610
|
const COMMON_COL_SPACING = 30;
|
|
16598
16611
|
const COMMON_ROW_SPACING = 35;
|
|
16599
16612
|
const MAX_COMMON_ROWS = 15;
|
|
16600
16613
|
nonFilteredNodeIds.forEach((id, idx) => {
|
|
16601
|
-
const mesh =
|
|
16614
|
+
const mesh = nodeObjects[id];
|
|
16602
16615
|
if (!mesh) return;
|
|
16603
16616
|
const col = Math.floor(idx / MAX_COMMON_ROWS);
|
|
16604
16617
|
const row = idx % MAX_COMMON_ROWS;
|
|
@@ -16624,7 +16637,7 @@ function XViewScene({
|
|
|
16624
16637
|
sideTween.start();
|
|
16625
16638
|
});
|
|
16626
16639
|
filteredQuests.forEach((q) => {
|
|
16627
|
-
const mesh =
|
|
16640
|
+
const mesh = nodeObjects[String(q.id)];
|
|
16628
16641
|
if (mesh) {
|
|
16629
16642
|
if (mesh.material) {
|
|
16630
16643
|
const fadeInTween = new import_tween2.Tween(mesh.material).to({ opacity: 1 }, 1200).easing(import_tween2.Easing.Cubic.Out);
|
|
@@ -16642,7 +16655,7 @@ function XViewScene({
|
|
|
16642
16655
|
const colX = startX + colIndex * QUEST_LENS_COLUMN_SPACING;
|
|
16643
16656
|
questsInCol.forEach((q, rowIndex) => {
|
|
16644
16657
|
const nodeId = String(q.id);
|
|
16645
|
-
let mesh =
|
|
16658
|
+
let mesh = nodeObjects[nodeId];
|
|
16646
16659
|
const timeInfo = questTimeInfos.get(nodeId) || { isUndated: true };
|
|
16647
16660
|
let targetY;
|
|
16648
16661
|
if (!timeInfo.isUndated) {
|
|
@@ -16788,8 +16801,8 @@ function XViewScene({
|
|
|
16788
16801
|
stateRef.current.timelineIntervalsGroup = timelineIntervalsGroup;
|
|
16789
16802
|
const graphData = sceneDataRef.current;
|
|
16790
16803
|
const nodePositions = calculateNodePositions(graphData.nodes);
|
|
16791
|
-
const
|
|
16792
|
-
stateRef.current.nodeObjects =
|
|
16804
|
+
const nodeObjects = {};
|
|
16805
|
+
stateRef.current.nodeObjects = nodeObjects;
|
|
16793
16806
|
stateRef.current.glowTexture = makeGlowTexture();
|
|
16794
16807
|
graphData.nodes.forEach((node) => {
|
|
16795
16808
|
const position = nodePositions[node.id] || new THREE3.Vector3();
|
|
@@ -16799,7 +16812,7 @@ function XViewScene({
|
|
|
16799
16812
|
mesh.userData.labelObject.position.copy(mesh.position).add(mesh.userData.labelOffset);
|
|
16800
16813
|
graphGroup.add(mesh.userData.labelObject);
|
|
16801
16814
|
}
|
|
16802
|
-
|
|
16815
|
+
nodeObjects[String(node.id)] = mesh;
|
|
16803
16816
|
stateRef.current.clickableNodes.push(mesh);
|
|
16804
16817
|
});
|
|
16805
16818
|
const linksGroupedByNodes = /* @__PURE__ */ new Map();
|
|
@@ -16811,8 +16824,8 @@ function XViewScene({
|
|
|
16811
16824
|
linksGroupedByNodes.get(pairKey).push(link);
|
|
16812
16825
|
});
|
|
16813
16826
|
linksGroupedByNodes.forEach((linksArray) => {
|
|
16814
|
-
const sourceNode =
|
|
16815
|
-
const targetNode =
|
|
16827
|
+
const sourceNode = nodeObjects[String(linksArray[0].source)];
|
|
16828
|
+
const targetNode = nodeObjects[String(linksArray[0].target)];
|
|
16816
16829
|
if (sourceNode && targetNode) {
|
|
16817
16830
|
const resolution = new THREE3.Vector2(
|
|
16818
16831
|
currentMount.clientWidth,
|
|
@@ -18040,17 +18053,53 @@ function XViewScene({
|
|
|
18040
18053
|
const formattedTree = convertTreeToIds(newTree);
|
|
18041
18054
|
const formattedAbstractionTree = convertTreeToIds(newAbstractionTree);
|
|
18042
18055
|
if (questNodeId && sceneConfigId) {
|
|
18043
|
-
const sceneData =
|
|
18056
|
+
const sceneData = sceneDataRef.current;
|
|
18044
18057
|
if (sceneData && sceneData.quest_nodes) {
|
|
18045
18058
|
const questIndex = sceneData.quest_nodes.findIndex((q) => String(q.id) === String(questNodeId));
|
|
18046
18059
|
if (questIndex !== -1) {
|
|
18047
18060
|
sceneData.quest_nodes[questIndex].quest_tree = formattedTree;
|
|
18048
18061
|
sceneData.quest_nodes[questIndex].quest_abstraction_tree = formattedAbstractionTree;
|
|
18049
|
-
if (
|
|
18050
|
-
|
|
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);
|
|
18051
18100
|
}
|
|
18052
18101
|
const updatedNodeData = sceneData.quest_nodes[questIndex];
|
|
18053
|
-
const nodeMesh = nodeObjects[String(questNodeId)];
|
|
18102
|
+
const nodeMesh = (_a2 = stateRef.current.nodeObjects) == null ? void 0 : _a2[String(questNodeId)];
|
|
18054
18103
|
if (nodeMesh) {
|
|
18055
18104
|
nodeMesh.userData.questData = updatedNodeData;
|
|
18056
18105
|
}
|
|
@@ -18092,7 +18141,7 @@ function XViewScene({
|
|
|
18092
18141
|
};
|
|
18093
18142
|
const handleSaveQuestNode = async (context, newQuestData) => {
|
|
18094
18143
|
const {
|
|
18095
|
-
graphDataRef,
|
|
18144
|
+
graphDataRef: graphDataRef2,
|
|
18096
18145
|
sceneDataRef: sceneDataRef2,
|
|
18097
18146
|
stateRef: stateRef2,
|
|
18098
18147
|
setters,
|
|
@@ -18102,7 +18151,7 @@ function XViewScene({
|
|
|
18102
18151
|
sceneConfigId: sceneConfigId2,
|
|
18103
18152
|
ownerId: ownerId2
|
|
18104
18153
|
} = context;
|
|
18105
|
-
if (!
|
|
18154
|
+
if (!graphDataRef2.current || (viewType == null ? void 0 : viewType.toLowerCase()) !== "view") return;
|
|
18106
18155
|
const currentCounter = sceneDataRef2.current.quest_counter || 1;
|
|
18107
18156
|
const newNode = {
|
|
18108
18157
|
id: import_short_uuid2.default.generate(),
|
|
@@ -18110,14 +18159,14 @@ function XViewScene({
|
|
|
18110
18159
|
is_quest: true,
|
|
18111
18160
|
type: ["quest", ...newQuestData.type.filter((t) => t !== "quest")]
|
|
18112
18161
|
};
|
|
18113
|
-
if (!
|
|
18114
|
-
|
|
18162
|
+
if (!graphDataRef2.current[sceneConfigId2]) {
|
|
18163
|
+
graphDataRef2.current[sceneConfigId2] = { nodes: [], links: [] };
|
|
18115
18164
|
}
|
|
18116
|
-
|
|
18165
|
+
graphDataRef2.current[sceneConfigId2].nodes.push(newNode);
|
|
18117
18166
|
const sceneFileData = {
|
|
18118
18167
|
...sceneDataRef2.current,
|
|
18119
|
-
quest_nodes:
|
|
18120
|
-
quest_links:
|
|
18168
|
+
quest_nodes: graphDataRef2.current[sceneConfigId2].nodes,
|
|
18169
|
+
quest_links: graphDataRef2.current[sceneConfigId2].links,
|
|
18121
18170
|
quest_counter: currentCounter + 1
|
|
18122
18171
|
};
|
|
18123
18172
|
try {
|
|
@@ -18128,9 +18177,9 @@ function XViewScene({
|
|
|
18128
18177
|
ownerId: ownerId2,
|
|
18129
18178
|
datasetName: "Quests Internas (View)"
|
|
18130
18179
|
});
|
|
18131
|
-
sceneDataRef2.current.quest_nodes = [...
|
|
18180
|
+
sceneDataRef2.current.quest_nodes = [...graphDataRef2.current[sceneConfigId2].nodes];
|
|
18132
18181
|
if (parentDataRef.current[sceneConfigId2]) {
|
|
18133
|
-
parentDataRef.current[sceneConfigId2].nodes = [...
|
|
18182
|
+
parentDataRef.current[sceneConfigId2].nodes = [...graphDataRef2.current[sceneConfigId2].nodes];
|
|
18134
18183
|
}
|
|
18135
18184
|
const finalPosition = stateRef2.current.ghostElements.node ? stateRef2.current.ghostElements.node.position.clone() : stateRef2.current.controls.target.clone();
|
|
18136
18185
|
const { graphGroup, ghostElements } = stateRef2.current;
|
|
@@ -18152,26 +18201,26 @@ function XViewScene({
|
|
|
18152
18201
|
userActionHandlers.handleCompleteConnection = async (context, targetNodeData) => {
|
|
18153
18202
|
const {
|
|
18154
18203
|
stateRef: stateRef2,
|
|
18155
|
-
graphDataRef,
|
|
18204
|
+
graphDataRef: graphDataRef2,
|
|
18156
18205
|
sceneDataRef: sceneDataRef2,
|
|
18157
18206
|
sceneConfigId: sceneConfigId2,
|
|
18158
18207
|
sceneSaveUrl: sceneSaveUrl2,
|
|
18159
18208
|
ownerId: ownerId2
|
|
18160
18209
|
} = context;
|
|
18161
18210
|
const { sourceNodeData } = stateRef2.current.connection;
|
|
18162
|
-
if (!
|
|
18211
|
+
if (!graphDataRef2.current || !sceneDataRef2.current || !sourceNodeData || !targetNodeData) {
|
|
18163
18212
|
userActionHandlers.handleCancelConnection(context);
|
|
18164
18213
|
return;
|
|
18165
18214
|
}
|
|
18166
18215
|
const sourceParentInfo = getParentFileInfoForNode(
|
|
18167
|
-
|
|
18216
|
+
graphDataRef2.current,
|
|
18168
18217
|
sceneDataRef2.current,
|
|
18169
18218
|
sourceNodeData.id,
|
|
18170
18219
|
sceneConfigId2,
|
|
18171
18220
|
ownerId2
|
|
18172
18221
|
);
|
|
18173
18222
|
const targetParentInfo = getParentFileInfoForNode(
|
|
18174
|
-
|
|
18223
|
+
graphDataRef2.current,
|
|
18175
18224
|
sceneDataRef2.current,
|
|
18176
18225
|
targetNodeData.id,
|
|
18177
18226
|
sceneConfigId2,
|
|
@@ -18191,7 +18240,7 @@ function XViewScene({
|
|
|
18191
18240
|
};
|
|
18192
18241
|
try {
|
|
18193
18242
|
if (parentFileIdToSave === sceneConfigId2) {
|
|
18194
|
-
const specificParentData =
|
|
18243
|
+
const specificParentData = graphDataRef2.current[sceneConfigId2];
|
|
18195
18244
|
specificParentData.links.push(newLink);
|
|
18196
18245
|
const viewFilePayload = {
|
|
18197
18246
|
...sceneDataRef2.current,
|
|
@@ -18202,7 +18251,7 @@ function XViewScene({
|
|
|
18202
18251
|
await context.actions.save_view_data(sceneSaveUrl2, viewFilePayload);
|
|
18203
18252
|
} else {
|
|
18204
18253
|
const specificParentData = JSON.parse(
|
|
18205
|
-
JSON.stringify(
|
|
18254
|
+
JSON.stringify(graphDataRef2.current[parentFileIdToSave])
|
|
18206
18255
|
);
|
|
18207
18256
|
specificParentData.links.push(newLink);
|
|
18208
18257
|
const filenameForSpecificParent = `x_view_dbs/${ownerIdToSave}/${parentFileIdToSave}`;
|
|
@@ -18210,7 +18259,7 @@ function XViewScene({
|
|
|
18210
18259
|
filenameForSpecificParent,
|
|
18211
18260
|
specificParentData
|
|
18212
18261
|
);
|
|
18213
|
-
|
|
18262
|
+
graphDataRef2.current[parentFileIdToSave] = specificParentData;
|
|
18214
18263
|
}
|
|
18215
18264
|
addNewLinkToScene(stateRef2.current, newLink);
|
|
18216
18265
|
} catch (error) {
|
|
@@ -18257,7 +18306,7 @@ function XViewScene({
|
|
|
18257
18306
|
}
|
|
18258
18307
|
});
|
|
18259
18308
|
}
|
|
18260
|
-
const { ancestryGroup, nodeObjects
|
|
18309
|
+
const { ancestryGroup, nodeObjects, renderer, renderedAncestries } = stateRef.current;
|
|
18261
18310
|
const currentRenderLimit = stateRef.current.maxAncestryRenderIndex || 0;
|
|
18262
18311
|
const isFullRenderRequest = !normalizedAllowedIds;
|
|
18263
18312
|
const checkShouldRender = (section) => {
|
|
@@ -18361,10 +18410,10 @@ function XViewScene({
|
|
|
18361
18410
|
);
|
|
18362
18411
|
if (!fullTree) return;
|
|
18363
18412
|
const rootNodeId = String(ancestryObject.ancestral_node);
|
|
18364
|
-
let rootNodeMesh =
|
|
18413
|
+
let rootNodeMesh = nodeObjects[rootNodeId];
|
|
18365
18414
|
let originMesh = null;
|
|
18366
18415
|
if (ancestryObject._originNodeId) {
|
|
18367
|
-
originMesh =
|
|
18416
|
+
originMesh = nodeObjects[String(ancestryObject._originNodeId)];
|
|
18368
18417
|
}
|
|
18369
18418
|
let rootTargetPos = null;
|
|
18370
18419
|
if (originMesh) {
|
|
@@ -18578,7 +18627,7 @@ function XViewScene({
|
|
|
18578
18627
|
} else {
|
|
18579
18628
|
const traverseAndCollect = (item) => {
|
|
18580
18629
|
if (item.node) {
|
|
18581
|
-
const mesh =
|
|
18630
|
+
const mesh = nodeObjects[String(item.node.id)];
|
|
18582
18631
|
if (mesh) allRenderedNodePositions.push(mesh.position.clone());
|
|
18583
18632
|
}
|
|
18584
18633
|
if (item.children) item.children.forEach(traverseAndCollect);
|
|
@@ -18626,7 +18675,7 @@ function XViewScene({
|
|
|
18626
18675
|
const nodeIds = collectNodeIdsInSection(targetSectionForZone);
|
|
18627
18676
|
const vectors = [];
|
|
18628
18677
|
nodeIds.forEach((id) => {
|
|
18629
|
-
const mesh =
|
|
18678
|
+
const mesh = nodeObjects[String(id)];
|
|
18630
18679
|
if (mesh) {
|
|
18631
18680
|
const targetPos = targetPositionsCache.get(String(id));
|
|
18632
18681
|
vectors.push(targetPos ? targetPos.clone() : mesh.position.clone());
|
|
@@ -18685,8 +18734,8 @@ function XViewScene({
|
|
|
18685
18734
|
focusTargetPosition = targetPositionsCache.get(anchorId) || currentAnchorMesh.position.clone();
|
|
18686
18735
|
focusTargetRotation = baseRotation;
|
|
18687
18736
|
}
|
|
18688
|
-
} else if (activeSectionIdForFocus &&
|
|
18689
|
-
const directNode =
|
|
18737
|
+
} else if (activeSectionIdForFocus && nodeObjects[String(activeSectionIdForFocus)]) {
|
|
18738
|
+
const directNode = nodeObjects[String(activeSectionIdForFocus)];
|
|
18690
18739
|
const tPos = targetPositionsCache.get(String(activeSectionIdForFocus));
|
|
18691
18740
|
focusTargetPosition = tPos ? tPos.clone() : directNode.position.clone();
|
|
18692
18741
|
focusTargetRotation = baseRotation;
|
|
@@ -18737,7 +18786,7 @@ function XViewScene({
|
|
|
18737
18786
|
(prev) => prev.visible ? { ...prev, visible: false } : prev
|
|
18738
18787
|
);
|
|
18739
18788
|
if (!ancestryObject || !ancestryObject.abstraction_tree) return;
|
|
18740
|
-
const { ancestryGroup, nodeObjects
|
|
18789
|
+
const { ancestryGroup, nodeObjects, renderer, renderedAncestries } = stateRef.current;
|
|
18741
18790
|
const allParentNodes = Object.values(parentDataRef.current).flatMap(
|
|
18742
18791
|
(f) => f.nodes
|
|
18743
18792
|
);
|
|
@@ -18778,7 +18827,7 @@ function XViewScene({
|
|
|
18778
18827
|
const ancestryEntry = { id: absId, lines: [], isFullRender: true };
|
|
18779
18828
|
renderedAncestries.push(ancestryEntry);
|
|
18780
18829
|
const rootNodeId = String(fullTree.node.id);
|
|
18781
|
-
let rootNodeMesh =
|
|
18830
|
+
let rootNodeMesh = nodeObjects[rootNodeId];
|
|
18782
18831
|
let rootTargetPos = rootNodeMesh ? rootNodeMesh.position.clone() : new THREE3.Vector3(0, 0, 0);
|
|
18783
18832
|
if (!rootNodeMesh) {
|
|
18784
18833
|
rootNodeMesh = addOrUpdateNodeMesh(fullTree.node, rootTargetPos, true);
|
|
@@ -19890,8 +19939,8 @@ function XViewScene({
|
|
|
19890
19939
|
setSceneVersion((v) => v + 1);
|
|
19891
19940
|
const isView = ((_a2 = viewParams == null ? void 0 : viewParams.type) == null ? void 0 : _a2.toLowerCase()) === "view";
|
|
19892
19941
|
if (!isView || !save_view_data || !sceneSaveUrl) return;
|
|
19893
|
-
const { nodeObjects
|
|
19894
|
-
const currentNodes = Object.values(
|
|
19942
|
+
const { nodeObjects, allLinks } = stateRef.current;
|
|
19943
|
+
const currentNodes = Object.values(nodeObjects || {}).map((mesh) => {
|
|
19895
19944
|
const {
|
|
19896
19945
|
_baseEmissiveIntensity,
|
|
19897
19946
|
labelObject,
|
|
@@ -19930,15 +19979,15 @@ function XViewScene({
|
|
|
19930
19979
|
);
|
|
19931
19980
|
const handleSaveCurrentView = (0, import_react33.useCallback)(async () => {
|
|
19932
19981
|
var _a2, _b2, _c2;
|
|
19933
|
-
const { nodeObjects
|
|
19934
|
-
if (!
|
|
19982
|
+
const { nodeObjects, allLinks } = stateRef.current;
|
|
19983
|
+
if (!nodeObjects || !allLinks || !sceneSaveUrl || !parentDataRef.current) {
|
|
19935
19984
|
console.warn(
|
|
19936
19985
|
"N\xE3o \xE9 poss\xEDvel salvar a cena: estado n\xE3o inicializado ou URL de salvamento ausente."
|
|
19937
19986
|
);
|
|
19938
19987
|
return;
|
|
19939
19988
|
}
|
|
19940
19989
|
if (!save_view_data) return;
|
|
19941
|
-
const currentNodes = Object.values(
|
|
19990
|
+
const currentNodes = Object.values(nodeObjects).map((mesh) => {
|
|
19942
19991
|
const {
|
|
19943
19992
|
_baseEmissiveIntensity,
|
|
19944
19993
|
labelObject,
|
|
@@ -19993,8 +20042,8 @@ function XViewScene({
|
|
|
19993
20042
|
const detailsNodeDatasetInfo = detailsNode ? stateRef.current.nodeIdToParentFileMap.get(String(detailsNode.id)) : null;
|
|
19994
20043
|
(0, import_react33.useEffect)(() => {
|
|
19995
20044
|
if (isInitialized && focusNodeId && !hasFocusedInitial) {
|
|
19996
|
-
const
|
|
19997
|
-
const targetMesh =
|
|
20045
|
+
const nodeObjects = stateRef.current.nodeObjects || {};
|
|
20046
|
+
const targetMesh = nodeObjects[String(focusNodeId)];
|
|
19998
20047
|
if (targetMesh) {
|
|
19999
20048
|
setTimeout(() => {
|
|
20000
20049
|
tweenToTarget(targetMesh, 1.2);
|
|
@@ -20083,10 +20132,10 @@ function XViewScene({
|
|
|
20083
20132
|
if (isUiClear) {
|
|
20084
20133
|
const isView = ((_c2 = viewParams == null ? void 0 : viewParams.type) == null ? void 0 : _c2.toLowerCase()) === "view";
|
|
20085
20134
|
if (!isView) return;
|
|
20086
|
-
const { graphGroup, glowTexture, controls: sceneControls, nodeObjects
|
|
20135
|
+
const { graphGroup, glowTexture, controls: sceneControls, nodeObjects } = stateRef.current;
|
|
20087
20136
|
if (graphGroup) {
|
|
20088
20137
|
let ghostPosition = sceneControls.target.clone();
|
|
20089
|
-
const existingNodes = Object.values(
|
|
20138
|
+
const existingNodes = Object.values(nodeObjects);
|
|
20090
20139
|
let isOccupied = true;
|
|
20091
20140
|
let radius = 18;
|
|
20092
20141
|
let angle = 0;
|