@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.mjs
CHANGED
|
@@ -706,20 +706,20 @@ var updateSceneHighlights = (state) => {
|
|
|
706
706
|
var addNewNodeToScene = (state, newNodeData, newLinkData, position) => {
|
|
707
707
|
const {
|
|
708
708
|
graphGroup,
|
|
709
|
-
nodeObjects
|
|
709
|
+
nodeObjects,
|
|
710
710
|
clickableNodes,
|
|
711
711
|
allLinks,
|
|
712
712
|
glowTexture,
|
|
713
713
|
renderer
|
|
714
714
|
} = state;
|
|
715
|
-
const sourceNodeMesh =
|
|
715
|
+
const sourceNodeMesh = nodeObjects[String(newLinkData.source)];
|
|
716
716
|
if (!sourceNodeMesh || !graphGroup) return;
|
|
717
717
|
const mesh = createNodeMesh(newNodeData, position, glowTexture);
|
|
718
718
|
graphGroup.add(mesh);
|
|
719
719
|
if (mesh.userData.labelObject) {
|
|
720
720
|
graphGroup.add(mesh.userData.labelObject);
|
|
721
721
|
}
|
|
722
|
-
|
|
722
|
+
nodeObjects[String(newNodeData.id)] = mesh;
|
|
723
723
|
clickableNodes.push(mesh);
|
|
724
724
|
const resolution = new THREE.Vector2(
|
|
725
725
|
renderer.domElement.clientWidth,
|
|
@@ -737,9 +737,9 @@ var addNewNodeToScene = (state, newNodeData, newLinkData, position) => {
|
|
|
737
737
|
});
|
|
738
738
|
};
|
|
739
739
|
var addNewLinkToScene = (state, newLinkData) => {
|
|
740
|
-
const { graphGroup, nodeObjects
|
|
741
|
-
const sourceNodeMesh =
|
|
742
|
-
const targetNodeMesh =
|
|
740
|
+
const { graphGroup, nodeObjects, allLinks, renderer } = state;
|
|
741
|
+
const sourceNodeMesh = nodeObjects[String(newLinkData.source)];
|
|
742
|
+
const targetNodeMesh = nodeObjects[String(newLinkData.target)];
|
|
743
743
|
if (!sourceNodeMesh || !targetNodeMesh || !graphGroup) return;
|
|
744
744
|
const resolution = new THREE.Vector2(
|
|
745
745
|
renderer.domElement.clientWidth,
|
|
@@ -784,12 +784,12 @@ var removeLinkFromScene = (state, linkObject) => {
|
|
|
784
784
|
var removeNodeFromScene = (state, nodeId) => {
|
|
785
785
|
const {
|
|
786
786
|
graphGroup,
|
|
787
|
-
nodeObjects
|
|
787
|
+
nodeObjects,
|
|
788
788
|
clickableNodes,
|
|
789
789
|
allLinks,
|
|
790
790
|
timelineIntervalsGroup
|
|
791
791
|
} = state;
|
|
792
|
-
const nodeToRemove =
|
|
792
|
+
const nodeToRemove = nodeObjects[String(nodeId)];
|
|
793
793
|
if (!nodeToRemove) return;
|
|
794
794
|
const strNodeId = String(nodeId);
|
|
795
795
|
const linksToRemove = [...allLinks].filter(
|
|
@@ -798,7 +798,7 @@ var removeNodeFromScene = (state, nodeId) => {
|
|
|
798
798
|
linksToRemove.forEach((link) => removeLinkFromScene(state, link));
|
|
799
799
|
const nodeIdx = clickableNodes.indexOf(nodeToRemove);
|
|
800
800
|
if (nodeIdx > -1) clickableNodes.splice(nodeIdx, 1);
|
|
801
|
-
delete
|
|
801
|
+
delete nodeObjects[strNodeId];
|
|
802
802
|
if (graphGroup && nodeToRemove.userData.labelObject) {
|
|
803
803
|
const label = nodeToRemove.userData.labelObject;
|
|
804
804
|
graphGroup.remove(label);
|
|
@@ -833,7 +833,7 @@ var removeNodeFromScene = (state, nodeId) => {
|
|
|
833
833
|
}
|
|
834
834
|
};
|
|
835
835
|
var addStandaloneNodeToScene = (state, nodeData, position, forceShowQuestDate = false) => {
|
|
836
|
-
const { graphGroup, nodeObjects
|
|
836
|
+
const { graphGroup, nodeObjects, clickableNodes, glowTexture } = state;
|
|
837
837
|
if (!graphGroup) return;
|
|
838
838
|
const mesh = createNodeMesh(nodeData, position, glowTexture, forceShowQuestDate);
|
|
839
839
|
mesh.scale.set(0.01, 0.01, 0.01);
|
|
@@ -841,7 +841,7 @@ var addStandaloneNodeToScene = (state, nodeData, position, forceShowQuestDate =
|
|
|
841
841
|
if (mesh.userData.labelObject) {
|
|
842
842
|
graphGroup.add(mesh.userData.labelObject);
|
|
843
843
|
}
|
|
844
|
-
|
|
844
|
+
nodeObjects[String(nodeData.id)] = mesh;
|
|
845
845
|
clickableNodes.push(mesh);
|
|
846
846
|
if (state.tweenGroup) {
|
|
847
847
|
const targetScale = NODE_SCALE_FACTORS[nodeData.size || "medium"] || 1;
|
|
@@ -879,7 +879,7 @@ var userActionHandlers = {
|
|
|
879
879
|
const { stateRef, setters, tweenToTarget } = context;
|
|
880
880
|
setters.setContextMenu({ visible: false });
|
|
881
881
|
setters.setRelationshipMenu({ visible: false });
|
|
882
|
-
const { graphGroup, nodeObjects
|
|
882
|
+
const { graphGroup, nodeObjects, renderer, ghostElements, glowTexture } = stateRef.current;
|
|
883
883
|
if (ghostElements.node && graphGroup) {
|
|
884
884
|
graphGroup.remove(ghostElements.node);
|
|
885
885
|
ghostElements.node.traverse((child) => {
|
|
@@ -895,7 +895,7 @@ var userActionHandlers = {
|
|
|
895
895
|
ghostElements.line.geometry.dispose();
|
|
896
896
|
ghostElements.line.material.dispose();
|
|
897
897
|
}
|
|
898
|
-
const sourceNodeMesh =
|
|
898
|
+
const sourceNodeMesh = nodeObjects[String(sourceNodeData.id)];
|
|
899
899
|
if (!sourceNodeMesh || !graphGroup || !renderer) return;
|
|
900
900
|
stateRef.current.creation = { isActive: true, sourceNodeData };
|
|
901
901
|
const ghostGeometry = new THREE.SphereGeometry(1.5, 32, 32);
|
|
@@ -991,14 +991,14 @@ var userActionHandlers = {
|
|
|
991
991
|
},
|
|
992
992
|
handleSaveNode: async (context, newNodeData) => {
|
|
993
993
|
const {
|
|
994
|
-
graphDataRef,
|
|
994
|
+
graphDataRef: graphDataRef2,
|
|
995
995
|
sceneDataRef,
|
|
996
996
|
stateRef,
|
|
997
997
|
creationMode,
|
|
998
998
|
setters,
|
|
999
999
|
actions
|
|
1000
1000
|
} = context;
|
|
1001
|
-
if (!
|
|
1001
|
+
if (!graphDataRef2.current || !sceneDataRef.current) return;
|
|
1002
1002
|
const { sourceNodeData } = creationMode;
|
|
1003
1003
|
const { targetDatasetId, ...nodeDataToSave } = newNodeData;
|
|
1004
1004
|
const newNode = { id: short.generate(), ...nodeDataToSave };
|
|
@@ -1020,9 +1020,9 @@ var userActionHandlers = {
|
|
|
1020
1020
|
}
|
|
1021
1021
|
const isCrossDataset = String(sourceParentInfo.parentFileId) !== String(finalTargetDatasetId);
|
|
1022
1022
|
const sourceDataToUpdate = JSON.parse(
|
|
1023
|
-
JSON.stringify(
|
|
1023
|
+
JSON.stringify(graphDataRef2.current[sourceParentInfo.parentFileId])
|
|
1024
1024
|
);
|
|
1025
|
-
let targetDataToUpdate = isCrossDataset ? JSON.parse(JSON.stringify(
|
|
1025
|
+
let targetDataToUpdate = isCrossDataset ? JSON.parse(JSON.stringify(graphDataRef2.current[finalTargetDatasetId])) : sourceDataToUpdate;
|
|
1026
1026
|
targetDataToUpdate.nodes.push(newNode);
|
|
1027
1027
|
sourceDataToUpdate.links.push(newLink);
|
|
1028
1028
|
const savePromises = [];
|
|
@@ -1049,9 +1049,9 @@ var userActionHandlers = {
|
|
|
1049
1049
|
}
|
|
1050
1050
|
try {
|
|
1051
1051
|
await Promise.all(savePromises);
|
|
1052
|
-
|
|
1052
|
+
graphDataRef2.current[sourceParentInfo.parentFileId] = sourceDataToUpdate;
|
|
1053
1053
|
if (isCrossDataset) {
|
|
1054
|
-
|
|
1054
|
+
graphDataRef2.current[finalTargetDatasetId] = targetDataToUpdate;
|
|
1055
1055
|
}
|
|
1056
1056
|
if (sceneDataRef.current.parent_dbs.some((db) => String(db.db_id) === String(sourceParentInfo.parentFileId))) {
|
|
1057
1057
|
}
|
|
@@ -1073,7 +1073,7 @@ var userActionHandlers = {
|
|
|
1073
1073
|
const { stateRef, setters, tweenToTarget } = context;
|
|
1074
1074
|
setters.setContextMenu({ visible: false });
|
|
1075
1075
|
setters.setRelationshipMenu({ visible: false });
|
|
1076
|
-
const { graphGroup, nodeObjects
|
|
1076
|
+
const { graphGroup, nodeObjects, renderer, ghostElements, glowTexture } = stateRef.current;
|
|
1077
1077
|
if (ghostElements.node && graphGroup) {
|
|
1078
1078
|
if (ghostElements.node.userData.labelObject) {
|
|
1079
1079
|
graphGroup.remove(ghostElements.node.userData.labelObject);
|
|
@@ -1095,7 +1095,7 @@ var userActionHandlers = {
|
|
|
1095
1095
|
ghostElements.line.geometry.dispose();
|
|
1096
1096
|
ghostElements.line.material.dispose();
|
|
1097
1097
|
}
|
|
1098
|
-
const sourceNodeMesh =
|
|
1098
|
+
const sourceNodeMesh = nodeObjects[String(sourceNodeData.id)];
|
|
1099
1099
|
if (!sourceNodeMesh || !graphGroup || !renderer) return;
|
|
1100
1100
|
stateRef.current.creation = { isActive: true, sourceNodeData };
|
|
1101
1101
|
const ghostGeometry = new THREE.SphereGeometry(1.5, 32, 32);
|
|
@@ -1194,8 +1194,8 @@ var userActionHandlers = {
|
|
|
1194
1194
|
},
|
|
1195
1195
|
handleSaveVersionNode: async (context, newNodeData) => {
|
|
1196
1196
|
var _a;
|
|
1197
|
-
const { graphDataRef, sceneDataRef, stateRef, versionMode, setters } = context;
|
|
1198
|
-
if (!
|
|
1197
|
+
const { graphDataRef: graphDataRef2, sceneDataRef, stateRef, versionMode, setters } = context;
|
|
1198
|
+
if (!graphDataRef2.current || !sceneDataRef.current) return;
|
|
1199
1199
|
const { sourceNodeData } = versionMode;
|
|
1200
1200
|
const newNode = {
|
|
1201
1201
|
id: short.generate(),
|
|
@@ -1208,7 +1208,7 @@ var userActionHandlers = {
|
|
|
1208
1208
|
target: newNode.id
|
|
1209
1209
|
};
|
|
1210
1210
|
const parentInfo = getParentFileInfoForNode(
|
|
1211
|
-
|
|
1211
|
+
graphDataRef2.current,
|
|
1212
1212
|
sceneDataRef.current,
|
|
1213
1213
|
sourceNodeData.id,
|
|
1214
1214
|
context.sceneConfigId,
|
|
@@ -1226,7 +1226,7 @@ var userActionHandlers = {
|
|
|
1226
1226
|
}
|
|
1227
1227
|
const { parentFileId, ownerId } = parentInfo;
|
|
1228
1228
|
const specificParentData = JSON.parse(
|
|
1229
|
-
JSON.stringify(
|
|
1229
|
+
JSON.stringify(graphDataRef2.current[parentFileId])
|
|
1230
1230
|
);
|
|
1231
1231
|
specificParentData.nodes.push(newNode);
|
|
1232
1232
|
specificParentData.links.push(newLink);
|
|
@@ -1252,7 +1252,7 @@ var userActionHandlers = {
|
|
|
1252
1252
|
specificParentData
|
|
1253
1253
|
);
|
|
1254
1254
|
}
|
|
1255
|
-
|
|
1255
|
+
graphDataRef2.current[parentFileId] = specificParentData;
|
|
1256
1256
|
if (isView && parentFileId === context.sceneConfigId) {
|
|
1257
1257
|
sceneDataRef.current.quest_nodes = [...specificParentData.nodes];
|
|
1258
1258
|
}
|
|
@@ -1269,23 +1269,23 @@ var userActionHandlers = {
|
|
|
1269
1269
|
const {
|
|
1270
1270
|
stateRef,
|
|
1271
1271
|
sceneDataRef,
|
|
1272
|
-
graphDataRef,
|
|
1272
|
+
graphDataRef: graphDataRef2,
|
|
1273
1273
|
mountRef,
|
|
1274
1274
|
setters,
|
|
1275
1275
|
tweenToTarget
|
|
1276
1276
|
} = context;
|
|
1277
1277
|
const {
|
|
1278
1278
|
graphGroup,
|
|
1279
|
-
nodeObjects
|
|
1279
|
+
nodeObjects,
|
|
1280
1280
|
clickableNodes,
|
|
1281
1281
|
allLinks,
|
|
1282
1282
|
glowTexture,
|
|
1283
1283
|
renderer,
|
|
1284
1284
|
tweenGroup
|
|
1285
1285
|
} = stateRef.current;
|
|
1286
|
-
if (!graphGroup || !sceneDataRef.current || !
|
|
1286
|
+
if (!graphGroup || !sceneDataRef.current || !graphDataRef2.current || !linksToExpand || linksToExpand.length === 0)
|
|
1287
1287
|
return;
|
|
1288
|
-
const sourceNodeMesh =
|
|
1288
|
+
const sourceNodeMesh = nodeObjects[String(sourceNode.id)];
|
|
1289
1289
|
if (!sourceNodeMesh) return;
|
|
1290
1290
|
const resolution = new THREE.Vector2(
|
|
1291
1291
|
mountRef.current.clientWidth,
|
|
@@ -1297,8 +1297,8 @@ var userActionHandlers = {
|
|
|
1297
1297
|
var _a;
|
|
1298
1298
|
const isSource = String(link.source) === String(sourceNode.id);
|
|
1299
1299
|
const targetNodeId = isSource ? link.target : link.source;
|
|
1300
|
-
if (!
|
|
1301
|
-
const allParentNodes = Object.values(
|
|
1300
|
+
if (!nodeObjects[String(targetNodeId)]) {
|
|
1301
|
+
const allParentNodes = Object.values(graphDataRef2.current).flatMap(
|
|
1302
1302
|
(fileData) => fileData.nodes
|
|
1303
1303
|
);
|
|
1304
1304
|
const nodeData = allParentNodes.find(
|
|
@@ -1325,7 +1325,7 @@ var userActionHandlers = {
|
|
|
1325
1325
|
if (targetMesh.userData.labelObject) {
|
|
1326
1326
|
graphGroup.add(targetMesh.userData.labelObject);
|
|
1327
1327
|
}
|
|
1328
|
-
|
|
1328
|
+
nodeObjects[String(targetNodeId)] = targetMesh;
|
|
1329
1329
|
clickableNodes.push(targetMesh);
|
|
1330
1330
|
const posTween = new Tween(targetMesh.position).to(endPosition, 1200).easing(Easing.Quadratic.Out);
|
|
1331
1331
|
tweenGroup.add(posTween);
|
|
@@ -1344,8 +1344,8 @@ var userActionHandlers = {
|
|
|
1344
1344
|
(l) => String(l.userData.id) === String(link.id)
|
|
1345
1345
|
);
|
|
1346
1346
|
if (linkAlreadyInSceneObjects) return;
|
|
1347
|
-
const sourceMesh =
|
|
1348
|
-
const targetMesh =
|
|
1347
|
+
const sourceMesh = nodeObjects[String(link.source)];
|
|
1348
|
+
const targetMesh = nodeObjects[String(link.target)];
|
|
1349
1349
|
if (sourceMesh && targetMesh) {
|
|
1350
1350
|
const currentLinksBetweenNodesData = allLinks.filter(
|
|
1351
1351
|
(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)
|
|
@@ -1407,8 +1407,8 @@ var userActionHandlers = {
|
|
|
1407
1407
|
const { stateRef, mountRef, setters } = context;
|
|
1408
1408
|
setters.setContextMenu({ visible: false });
|
|
1409
1409
|
setters.setRelationshipMenu({ visible: false });
|
|
1410
|
-
const { graphGroup, nodeObjects
|
|
1411
|
-
const sourceNodeMesh =
|
|
1410
|
+
const { graphGroup, nodeObjects, renderer, controls } = stateRef.current;
|
|
1411
|
+
const sourceNodeMesh = nodeObjects[String(sourceNodeData.id)];
|
|
1412
1412
|
if (!sourceNodeMesh || !graphGroup || !renderer) return;
|
|
1413
1413
|
controls.enabled = false;
|
|
1414
1414
|
if (mountRef.current) mountRef.current.style.cursor = "crosshair";
|
|
@@ -1457,15 +1457,15 @@ var userActionHandlers = {
|
|
|
1457
1457
|
},
|
|
1458
1458
|
handleCompleteConnection: async (context, targetNodeData) => {
|
|
1459
1459
|
var _a;
|
|
1460
|
-
const { stateRef, graphDataRef, sceneDataRef } = context;
|
|
1460
|
+
const { stateRef, graphDataRef: graphDataRef2, sceneDataRef } = context;
|
|
1461
1461
|
const { sourceNodeData } = stateRef.current.connection;
|
|
1462
|
-
if (!
|
|
1462
|
+
if (!graphDataRef2.current || !sceneDataRef.current || !sourceNodeData || !targetNodeData) {
|
|
1463
1463
|
console.error("Dados insuficientes para completar a conex\xE3o.");
|
|
1464
1464
|
userActionHandlers.handleCancelConnection(context);
|
|
1465
1465
|
return;
|
|
1466
1466
|
}
|
|
1467
1467
|
const sourceParentInfo = getParentFileInfoForNode(
|
|
1468
|
-
|
|
1468
|
+
graphDataRef2.current,
|
|
1469
1469
|
sceneDataRef.current,
|
|
1470
1470
|
sourceNodeData.id,
|
|
1471
1471
|
context.sceneConfigId,
|
|
@@ -1493,7 +1493,7 @@ var userActionHandlers = {
|
|
|
1493
1493
|
try {
|
|
1494
1494
|
const isView = ((_a = context.viewType) == null ? void 0 : _a.toLowerCase()) === "view";
|
|
1495
1495
|
if (isView && parentFileIdToSave === context.sceneConfigId) {
|
|
1496
|
-
const specificParentData =
|
|
1496
|
+
const specificParentData = graphDataRef2.current[context.sceneConfigId];
|
|
1497
1497
|
specificParentData.links.push(newLink);
|
|
1498
1498
|
const viewFilePayload = {
|
|
1499
1499
|
parent_dbs: sceneDataRef.current.parent_dbs,
|
|
@@ -1509,7 +1509,7 @@ var userActionHandlers = {
|
|
|
1509
1509
|
);
|
|
1510
1510
|
} else {
|
|
1511
1511
|
const specificParentData = JSON.parse(
|
|
1512
|
-
JSON.stringify(
|
|
1512
|
+
JSON.stringify(graphDataRef2.current[parentFileIdToSave])
|
|
1513
1513
|
);
|
|
1514
1514
|
specificParentData.links.push(newLink);
|
|
1515
1515
|
const filenameForSpecificParent = `x_view_dbs/${ownerIdToSave}/${parentFileIdToSave}`;
|
|
@@ -1517,7 +1517,7 @@ var userActionHandlers = {
|
|
|
1517
1517
|
filenameForSpecificParent,
|
|
1518
1518
|
specificParentData
|
|
1519
1519
|
);
|
|
1520
|
-
|
|
1520
|
+
graphDataRef2.current[parentFileIdToSave] = specificParentData;
|
|
1521
1521
|
}
|
|
1522
1522
|
addNewLinkToScene(stateRef.current, newLink);
|
|
1523
1523
|
} catch (error) {
|
|
@@ -1580,8 +1580,8 @@ var userActionHandlers = {
|
|
|
1580
1580
|
if (mountRef.current) mountRef.current.style.cursor = "grab";
|
|
1581
1581
|
},
|
|
1582
1582
|
handleCompleteRelink: async (context, newEndNodeData) => {
|
|
1583
|
-
const { stateRef, graphDataRef, sceneDataRef } = context;
|
|
1584
|
-
const { relink, nodeObjects
|
|
1583
|
+
const { stateRef, graphDataRef: graphDataRef2, sceneDataRef } = context;
|
|
1584
|
+
const { relink, nodeObjects } = stateRef.current;
|
|
1585
1585
|
const originalLinkData = relink.originalLine.userData;
|
|
1586
1586
|
const oldSourceId = originalLinkData.source;
|
|
1587
1587
|
const oldTargetId = originalLinkData.target;
|
|
@@ -1594,28 +1594,28 @@ var userActionHandlers = {
|
|
|
1594
1594
|
newTargetId = newEndNodeData.id;
|
|
1595
1595
|
}
|
|
1596
1596
|
const oldSourceInfo = getParentFileInfoForNode(
|
|
1597
|
-
|
|
1597
|
+
graphDataRef2.current,
|
|
1598
1598
|
sceneDataRef.current,
|
|
1599
1599
|
oldSourceId,
|
|
1600
1600
|
context.sceneConfigId,
|
|
1601
1601
|
context.ownerId
|
|
1602
1602
|
);
|
|
1603
1603
|
const oldTargetInfo = getParentFileInfoForNode(
|
|
1604
|
-
|
|
1604
|
+
graphDataRef2.current,
|
|
1605
1605
|
sceneDataRef.current,
|
|
1606
1606
|
oldTargetId,
|
|
1607
1607
|
context.sceneConfigId,
|
|
1608
1608
|
context.ownerId
|
|
1609
1609
|
);
|
|
1610
1610
|
const newSourceInfo = getParentFileInfoForNode(
|
|
1611
|
-
|
|
1611
|
+
graphDataRef2.current,
|
|
1612
1612
|
sceneDataRef.current,
|
|
1613
1613
|
newSourceId,
|
|
1614
1614
|
context.sceneConfigId,
|
|
1615
1615
|
context.ownerId
|
|
1616
1616
|
);
|
|
1617
1617
|
const newTargetInfo = getParentFileInfoForNode(
|
|
1618
|
-
|
|
1618
|
+
graphDataRef2.current,
|
|
1619
1619
|
sceneDataRef.current,
|
|
1620
1620
|
newTargetId,
|
|
1621
1621
|
context.sceneConfigId,
|
|
@@ -1675,7 +1675,7 @@ var userActionHandlers = {
|
|
|
1675
1675
|
const filesToUpdate = {};
|
|
1676
1676
|
if (oldGoverningFileId !== newGoverningFileId) {
|
|
1677
1677
|
const updatedOriginalParentData = JSON.parse(
|
|
1678
|
-
JSON.stringify(
|
|
1678
|
+
JSON.stringify(graphDataRef2.current[oldGoverningFileId])
|
|
1679
1679
|
);
|
|
1680
1680
|
updatedOriginalParentData.links = updatedOriginalParentData.links.filter(
|
|
1681
1681
|
(l) => String(l.id) !== String(linkId)
|
|
@@ -1689,7 +1689,7 @@ var userActionHandlers = {
|
|
|
1689
1689
|
)
|
|
1690
1690
|
);
|
|
1691
1691
|
const updatedNewParentData = JSON.parse(
|
|
1692
|
-
JSON.stringify(
|
|
1692
|
+
JSON.stringify(graphDataRef2.current[newGoverningFileId])
|
|
1693
1693
|
);
|
|
1694
1694
|
if (!updatedNewParentData.links) updatedNewParentData.links = [];
|
|
1695
1695
|
updatedNewParentData.links.push(newLinkData);
|
|
@@ -1703,7 +1703,7 @@ var userActionHandlers = {
|
|
|
1703
1703
|
);
|
|
1704
1704
|
} else {
|
|
1705
1705
|
const updatedParentData = JSON.parse(
|
|
1706
|
-
JSON.stringify(
|
|
1706
|
+
JSON.stringify(graphDataRef2.current[oldGoverningFileId])
|
|
1707
1707
|
);
|
|
1708
1708
|
updatedParentData.links = updatedParentData.links.filter(
|
|
1709
1709
|
(l) => String(l.id) !== String(linkId)
|
|
@@ -1721,7 +1721,7 @@ var userActionHandlers = {
|
|
|
1721
1721
|
try {
|
|
1722
1722
|
await Promise.all(savePromises);
|
|
1723
1723
|
for (const fileId in filesToUpdate) {
|
|
1724
|
-
|
|
1724
|
+
graphDataRef2.current[fileId] = filesToUpdate[fileId];
|
|
1725
1725
|
}
|
|
1726
1726
|
removeLinkFromScene(stateRef.current, relink.originalLine);
|
|
1727
1727
|
addNewLinkToScene(stateRef.current, newLinkData);
|
|
@@ -1735,9 +1735,9 @@ var userActionHandlers = {
|
|
|
1735
1735
|
},
|
|
1736
1736
|
handleDeleteLink: async (context, linkObject) => {
|
|
1737
1737
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1738
|
-
const { stateRef, graphDataRef, sceneDataRef, setters } = context;
|
|
1738
|
+
const { stateRef, graphDataRef: graphDataRef2, sceneDataRef, setters } = context;
|
|
1739
1739
|
setters.setRelationshipMenu({ visible: false });
|
|
1740
|
-
if (!(linkObject == null ? void 0 : linkObject.userData) || !
|
|
1740
|
+
if (!(linkObject == null ? void 0 : linkObject.userData) || !graphDataRef2.current || !sceneDataRef.current)
|
|
1741
1741
|
return;
|
|
1742
1742
|
const linkIdToDelete = linkObject.userData.id;
|
|
1743
1743
|
if (!linkIdToDelete) {
|
|
@@ -1748,7 +1748,7 @@ var userActionHandlers = {
|
|
|
1748
1748
|
return;
|
|
1749
1749
|
}
|
|
1750
1750
|
const parentInfo = getParentFileInfoForNode(
|
|
1751
|
-
|
|
1751
|
+
graphDataRef2.current,
|
|
1752
1752
|
sceneDataRef.current,
|
|
1753
1753
|
linkObject.userData.source,
|
|
1754
1754
|
context.sceneConfigId,
|
|
@@ -1768,7 +1768,7 @@ var userActionHandlers = {
|
|
|
1768
1768
|
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;
|
|
1769
1769
|
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;
|
|
1770
1770
|
const specificParentData = JSON.parse(
|
|
1771
|
-
JSON.stringify(
|
|
1771
|
+
JSON.stringify(graphDataRef2.current[parentFileId])
|
|
1772
1772
|
);
|
|
1773
1773
|
const newLinks = (specificParentData.links || []).filter(
|
|
1774
1774
|
(l) => String(l.id) !== String(linkIdToDelete)
|
|
@@ -1796,7 +1796,7 @@ var userActionHandlers = {
|
|
|
1796
1796
|
}
|
|
1797
1797
|
try {
|
|
1798
1798
|
await context.actions.save_view_data(filenameToSave, payloadToSave);
|
|
1799
|
-
|
|
1799
|
+
graphDataRef2.current[parentFileId] = specificParentData;
|
|
1800
1800
|
setters.setDetailsLink(
|
|
1801
1801
|
(prev) => String(prev == null ? void 0 : prev.id) === String(linkIdToDelete) ? null : prev
|
|
1802
1802
|
);
|
|
@@ -1934,9 +1934,9 @@ var userActionHandlers = {
|
|
|
1934
1934
|
},
|
|
1935
1935
|
handleDeleteMultipleNodes: async (context, nodeIds) => {
|
|
1936
1936
|
var _a;
|
|
1937
|
-
const { stateRef, graphDataRef, sceneDataRef, setters, actions } = context;
|
|
1937
|
+
const { stateRef, graphDataRef: graphDataRef2, sceneDataRef, setters, actions } = context;
|
|
1938
1938
|
setters.setMultiContextMenu({ visible: false });
|
|
1939
|
-
if (!nodeIds || nodeIds.size === 0 || !
|
|
1939
|
+
if (!nodeIds || nodeIds.size === 0 || !graphDataRef2.current || !sceneDataRef.current)
|
|
1940
1940
|
return;
|
|
1941
1941
|
const strNodeIdsToDelete = Array.from(nodeIds).map(String);
|
|
1942
1942
|
if (actions.delete_file) {
|
|
@@ -1956,7 +1956,7 @@ var userActionHandlers = {
|
|
|
1956
1956
|
const changesByParentFile = {};
|
|
1957
1957
|
for (const nodeId of strNodeIdsToDelete) {
|
|
1958
1958
|
const parentInfo = getParentFileInfoForNode(
|
|
1959
|
-
|
|
1959
|
+
graphDataRef2.current,
|
|
1960
1960
|
sceneDataRef.current,
|
|
1961
1961
|
nodeId,
|
|
1962
1962
|
context.sceneConfigId,
|
|
@@ -1977,7 +1977,7 @@ var userActionHandlers = {
|
|
|
1977
1977
|
nodesToDelete: /* @__PURE__ */ new Set(),
|
|
1978
1978
|
linksToDelete: /* @__PURE__ */ new Set(),
|
|
1979
1979
|
originalData: JSON.parse(
|
|
1980
|
-
JSON.stringify(
|
|
1980
|
+
JSON.stringify(graphDataRef2.current[parentFileId])
|
|
1981
1981
|
)
|
|
1982
1982
|
};
|
|
1983
1983
|
}
|
|
@@ -2041,7 +2041,7 @@ var userActionHandlers = {
|
|
|
2041
2041
|
try {
|
|
2042
2042
|
await Promise.all(savePromises);
|
|
2043
2043
|
for (const fileId in updatedParentDataCache) {
|
|
2044
|
-
|
|
2044
|
+
graphDataRef2.current[fileId] = updatedParentDataCache[fileId];
|
|
2045
2045
|
}
|
|
2046
2046
|
strNodeIdsToDelete.forEach((nodeId) => {
|
|
2047
2047
|
setters.setDetailsNode(
|
|
@@ -2058,7 +2058,7 @@ var userActionHandlers = {
|
|
|
2058
2058
|
},
|
|
2059
2059
|
handleDeleteNode: async (context, nodeData) => {
|
|
2060
2060
|
var _a;
|
|
2061
|
-
const { stateRef, graphDataRef, sceneDataRef, setters, actions } = context;
|
|
2061
|
+
const { stateRef, graphDataRef: graphDataRef2, sceneDataRef, setters, actions } = context;
|
|
2062
2062
|
if (actions.delete_file && nodeData) {
|
|
2063
2063
|
const urls = extractFileUrlsFromProperties(nodeData);
|
|
2064
2064
|
if (urls.length > 0) {
|
|
@@ -2068,11 +2068,11 @@ var userActionHandlers = {
|
|
|
2068
2068
|
}
|
|
2069
2069
|
}
|
|
2070
2070
|
setters.setContextMenu({ visible: false });
|
|
2071
|
-
if (!nodeData || !
|
|
2071
|
+
if (!nodeData || !graphDataRef2.current || !sceneDataRef.current) return;
|
|
2072
2072
|
const nodeIdToDelete = nodeData.id;
|
|
2073
2073
|
const strNodeId = String(nodeIdToDelete);
|
|
2074
2074
|
const parentInfo = getParentFileInfoForNode(
|
|
2075
|
-
|
|
2075
|
+
graphDataRef2.current,
|
|
2076
2076
|
sceneDataRef.current,
|
|
2077
2077
|
nodeIdToDelete,
|
|
2078
2078
|
context.sceneConfigId,
|
|
@@ -2090,7 +2090,7 @@ var userActionHandlers = {
|
|
|
2090
2090
|
}
|
|
2091
2091
|
const { parentFileId, ownerId } = parentInfo;
|
|
2092
2092
|
const specificParentData = JSON.parse(
|
|
2093
|
-
JSON.stringify(
|
|
2093
|
+
JSON.stringify(graphDataRef2.current[parentFileId])
|
|
2094
2094
|
);
|
|
2095
2095
|
const newNodes = (specificParentData.nodes || []).filter(
|
|
2096
2096
|
(n) => String(n.id) !== strNodeId
|
|
@@ -2127,7 +2127,7 @@ var userActionHandlers = {
|
|
|
2127
2127
|
}
|
|
2128
2128
|
try {
|
|
2129
2129
|
await context.actions.save_view_data(filenameToSave, payloadToSave);
|
|
2130
|
-
|
|
2130
|
+
graphDataRef2.current[parentFileId] = specificParentData;
|
|
2131
2131
|
setters.setDetailsNode(
|
|
2132
2132
|
(prev) => String(prev == null ? void 0 : prev.id) === String(nodeIdToDelete) ? null : prev
|
|
2133
2133
|
);
|
|
@@ -2140,8 +2140,8 @@ var userActionHandlers = {
|
|
|
2140
2140
|
},
|
|
2141
2141
|
handleSaveNodeDetails: async (context, updatedNode, keepOpen = false) => {
|
|
2142
2142
|
var _a, _b, _c;
|
|
2143
|
-
const { graphDataRef, sceneDataRef, stateRef, setters } = context;
|
|
2144
|
-
if (!
|
|
2143
|
+
const { graphDataRef: graphDataRef2, sceneDataRef, stateRef, setters } = context;
|
|
2144
|
+
if (!graphDataRef2.current || !sceneDataRef.current) return;
|
|
2145
2145
|
const {
|
|
2146
2146
|
_baseEmissiveIntensity,
|
|
2147
2147
|
_baseScale,
|
|
@@ -2152,7 +2152,7 @@ var userActionHandlers = {
|
|
|
2152
2152
|
...nodeToSave
|
|
2153
2153
|
} = updatedNode;
|
|
2154
2154
|
const parentInfo = getParentFileInfoForNode(
|
|
2155
|
-
|
|
2155
|
+
graphDataRef2.current,
|
|
2156
2156
|
sceneDataRef.current,
|
|
2157
2157
|
nodeToSave.id,
|
|
2158
2158
|
context.sceneConfigId,
|
|
@@ -2170,7 +2170,7 @@ var userActionHandlers = {
|
|
|
2170
2170
|
}
|
|
2171
2171
|
const { parentFileId, ownerId } = parentInfo;
|
|
2172
2172
|
const specificParentData = JSON.parse(
|
|
2173
|
-
JSON.stringify(
|
|
2173
|
+
JSON.stringify(graphDataRef2.current[parentFileId])
|
|
2174
2174
|
);
|
|
2175
2175
|
const nodeIndex = specificParentData.nodes.findIndex(
|
|
2176
2176
|
(n) => String(n.id) === String(nodeToSave.id)
|
|
@@ -2286,7 +2286,7 @@ var userActionHandlers = {
|
|
|
2286
2286
|
specificParentData
|
|
2287
2287
|
);
|
|
2288
2288
|
}
|
|
2289
|
-
|
|
2289
|
+
graphDataRef2.current[parentFileId] = specificParentData;
|
|
2290
2290
|
if (isView && parentFileId === context.sceneConfigId) {
|
|
2291
2291
|
sceneDataRef.current.quest_nodes = [...specificParentData.nodes];
|
|
2292
2292
|
sceneDataRef.current.quest_counter = specificParentData.quest_counter || sceneDataRef.current.quest_counter;
|
|
@@ -2303,11 +2303,11 @@ var userActionHandlers = {
|
|
|
2303
2303
|
},
|
|
2304
2304
|
handleSaveLinkDetails: async (context, updatedLink, keepOpen = false) => {
|
|
2305
2305
|
var _a;
|
|
2306
|
-
const { graphDataRef, sceneDataRef, stateRef, setters } = context;
|
|
2307
|
-
if (!
|
|
2306
|
+
const { graphDataRef: graphDataRef2, sceneDataRef, stateRef, setters } = context;
|
|
2307
|
+
if (!graphDataRef2.current || !sceneDataRef.current) return;
|
|
2308
2308
|
const { sourceNode, targetNode, ...linkToSave } = updatedLink;
|
|
2309
2309
|
const parentInfo = getParentFileInfoForNode(
|
|
2310
|
-
|
|
2310
|
+
graphDataRef2.current,
|
|
2311
2311
|
sceneDataRef.current,
|
|
2312
2312
|
linkToSave.source,
|
|
2313
2313
|
context.sceneConfigId,
|
|
@@ -2325,7 +2325,7 @@ var userActionHandlers = {
|
|
|
2325
2325
|
}
|
|
2326
2326
|
const { parentFileId, ownerId } = parentInfo;
|
|
2327
2327
|
const specificParentData = JSON.parse(
|
|
2328
|
-
JSON.stringify(
|
|
2328
|
+
JSON.stringify(graphDataRef2.current[parentFileId])
|
|
2329
2329
|
);
|
|
2330
2330
|
const linkIndex = specificParentData.links.findIndex(
|
|
2331
2331
|
(l) => String(l.id) === String(linkToSave.id)
|
|
@@ -2363,7 +2363,7 @@ var userActionHandlers = {
|
|
|
2363
2363
|
specificParentData
|
|
2364
2364
|
);
|
|
2365
2365
|
}
|
|
2366
|
-
|
|
2366
|
+
graphDataRef2.current[parentFileId] = specificParentData;
|
|
2367
2367
|
const lineObject = stateRef.current.allLinks.find(
|
|
2368
2368
|
(l) => String(l.userData.id) === String(linkToSave.id)
|
|
2369
2369
|
);
|
|
@@ -2386,9 +2386,9 @@ var userActionHandlers = {
|
|
|
2386
2386
|
},
|
|
2387
2387
|
handleAddExistingNodeById: (context, nodeId) => {
|
|
2388
2388
|
var _a;
|
|
2389
|
-
const { stateRef, sceneDataRef, graphDataRef, tweenToTarget, setters } = context;
|
|
2389
|
+
const { stateRef, sceneDataRef, graphDataRef: graphDataRef2, tweenToTarget, setters } = context;
|
|
2390
2390
|
const state = stateRef.current;
|
|
2391
|
-
const graphFull =
|
|
2391
|
+
const graphFull = graphDataRef2.current;
|
|
2392
2392
|
if (!graphFull) return;
|
|
2393
2393
|
const strNodeId = String(nodeId);
|
|
2394
2394
|
const allParentNodes = Object.values(graphFull).flatMap(
|
|
@@ -8890,10 +8890,6 @@ function CreateQuestTreePanel({
|
|
|
8890
8890
|
}
|
|
8891
8891
|
};
|
|
8892
8892
|
const handleLocalSave = async () => {
|
|
8893
|
-
if (!hasUnsavedChanges) {
|
|
8894
|
-
onClose();
|
|
8895
|
-
return;
|
|
8896
|
-
}
|
|
8897
8893
|
try {
|
|
8898
8894
|
setIsSaving(true);
|
|
8899
8895
|
await onSave(questTreeMode.tree, questTreeMode.abstraction_tree);
|
|
@@ -8936,13 +8932,20 @@ function CreateQuestTreePanel({
|
|
|
8936
8932
|
}
|
|
8937
8933
|
),
|
|
8938
8934
|
/* @__PURE__ */ React11.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__ */ React11.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ React11.createElement("h2", { className: "text-xl font-bold text-white flex items-center gap-2" }, /* @__PURE__ */ React11.createElement(FiGitBranch3, { className: "text-emerald-400" }), "Quest Trees"), /* @__PURE__ */ React11.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React11.createElement(
|
|
8935
|
+
"button",
|
|
8936
|
+
{
|
|
8937
|
+
onClick: onClose,
|
|
8938
|
+
className: "px-4 py-2 rounded-lg border border-white/15 bg-transparent hover:bg-white/5 transition-colors text-sm text-slate-300"
|
|
8939
|
+
},
|
|
8940
|
+
"Fechar"
|
|
8941
|
+
), /* @__PURE__ */ React11.createElement(
|
|
8939
8942
|
"button",
|
|
8940
8943
|
{
|
|
8941
8944
|
onClick: handleLocalSave,
|
|
8942
8945
|
disabled: isSaving,
|
|
8943
|
-
className: `flex items-center gap-2
|
|
8946
|
+
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)]"}`
|
|
8944
8947
|
},
|
|
8945
|
-
isSaving ? "Salvando..." :
|
|
8948
|
+
isSaving ? "Salvando..." : "Salvar Mudan\xE7as"
|
|
8946
8949
|
)))),
|
|
8947
8950
|
/* @__PURE__ */ React11.createElement("div", { className: "flex border-b border-slate-800 bg-slate-900/50 p-2 gap-2 flex-shrink-0" }, /* @__PURE__ */ React11.createElement(
|
|
8948
8951
|
"button",
|
|
@@ -8977,16 +8980,7 @@ function CreateQuestTreePanel({
|
|
|
8977
8980
|
selectedParentId
|
|
8978
8981
|
}
|
|
8979
8982
|
)) : /* @__PURE__ */ React11.createElement("div", { className: "text-center py-8 text-slate-500 text-sm italic" }, "\xC1rvore vazia. Ofertada inicializa\xE7\xE3o autom\xE1tica em breve..."))),
|
|
8980
|
-
/* @__PURE__ */ React11.createElement("div", { className: "absolute bottom-6 left-1/2 -translate-x-1/2
|
|
8981
|
-
"button",
|
|
8982
|
-
{
|
|
8983
|
-
onClick: handleLocalSave,
|
|
8984
|
-
disabled: isSaving,
|
|
8985
|
-
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"
|
|
8986
|
-
},
|
|
8987
|
-
isSaving ? "Salvando..." : /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.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__ */ React11.createElement("path", { d: "M20 6L9 17l-5-5" })), " Salvar Mudan\xE7as")
|
|
8988
|
-
)),
|
|
8989
|
-
isAddingModeActive && selectedParentId && /* @__PURE__ */ React11.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__ */ React11.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"))
|
|
8983
|
+
isAddingModeActive && selectedParentId && /* @__PURE__ */ React11.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__ */ React11.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"))
|
|
8990
8984
|
);
|
|
8991
8985
|
}
|
|
8992
8986
|
|
|
@@ -13081,11 +13075,30 @@ ${noteText}` : noteText : entry.notes,
|
|
|
13081
13075
|
type: "button",
|
|
13082
13076
|
onClick: () => {
|
|
13083
13077
|
if (setQuestTreeMode2) {
|
|
13078
|
+
const convertPersistedTree = (storedTree) => {
|
|
13079
|
+
if (!storedTree) return null;
|
|
13080
|
+
if (storedTree.node || storedTree.is_section) return storedTree;
|
|
13081
|
+
const nodeId = storedTree.node_id;
|
|
13082
|
+
if (!nodeId) return null;
|
|
13083
|
+
const foundNode = availableNodes.find((n) => String(n.id) === String(nodeId)) || (String(nodeId) === String(node == null ? void 0 : node.id) ? node : null);
|
|
13084
|
+
return {
|
|
13085
|
+
node: foundNode ? { id: foundNode.id, name: foundNode.raw_title || foundNode.name } : { id: nodeId, name: `Node ${nodeId}` },
|
|
13086
|
+
relationship: storedTree.relationship || {},
|
|
13087
|
+
children: (storedTree.children || []).map(convertPersistedTree).filter(Boolean)
|
|
13088
|
+
};
|
|
13089
|
+
};
|
|
13090
|
+
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" };
|
|
13091
|
+
const existingTree = (node == null ? void 0 : node.quest_tree) ? convertPersistedTree(node.quest_tree) : { node: rootNode, children: [] };
|
|
13092
|
+
const existingAbstractionTree = (node == null ? void 0 : node.quest_abstraction_tree) ? convertPersistedTree(node.quest_abstraction_tree) : { node: rootNode, children: [] };
|
|
13084
13093
|
setQuestTreeMode2((prev) => ({
|
|
13085
13094
|
...prev,
|
|
13086
13095
|
isActive: true,
|
|
13087
13096
|
isAddingNodes: true,
|
|
13088
|
-
questNodeId: node == null ? void 0 : node.id
|
|
13097
|
+
questNodeId: node == null ? void 0 : node.id,
|
|
13098
|
+
questNodeName: (node == null ? void 0 : node.raw_title) || (node == null ? void 0 : node.name),
|
|
13099
|
+
tree: existingTree,
|
|
13100
|
+
abstraction_tree: existingAbstractionTree,
|
|
13101
|
+
selectedParentId: rootNode.id
|
|
13089
13102
|
}));
|
|
13090
13103
|
}
|
|
13091
13104
|
},
|
|
@@ -16008,8 +16021,8 @@ function XViewScene({
|
|
|
16008
16021
|
[]
|
|
16009
16022
|
);
|
|
16010
16023
|
const handleActivateTimeline = useCallback7(() => {
|
|
16011
|
-
const { nodeObjects
|
|
16012
|
-
if (!
|
|
16024
|
+
const { nodeObjects, tweenGroup, timelineIntervalsGroup } = stateRef.current;
|
|
16025
|
+
if (!nodeObjects || !tweenGroup || !timelineIntervalsGroup) return;
|
|
16013
16026
|
while (timelineIntervalsGroup.children.length > 0) {
|
|
16014
16027
|
const obj = timelineIntervalsGroup.children[0];
|
|
16015
16028
|
timelineIntervalsGroup.remove(obj);
|
|
@@ -16019,7 +16032,7 @@ function XViewScene({
|
|
|
16019
16032
|
obj.material.dispose();
|
|
16020
16033
|
}
|
|
16021
16034
|
}
|
|
16022
|
-
Object.values(
|
|
16035
|
+
Object.values(nodeObjects).forEach((mesh) => {
|
|
16023
16036
|
const oldLabel = mesh.getObjectByName("timelineLabel");
|
|
16024
16037
|
if (oldLabel) {
|
|
16025
16038
|
mesh.remove(oldLabel);
|
|
@@ -16043,7 +16056,7 @@ function XViewScene({
|
|
|
16043
16056
|
}
|
|
16044
16057
|
return null;
|
|
16045
16058
|
};
|
|
16046
|
-
Object.values(
|
|
16059
|
+
Object.values(nodeObjects).forEach((mesh) => {
|
|
16047
16060
|
const dateProp = mesh.userData.Date;
|
|
16048
16061
|
let nodeInfo = { mesh, type: "point", label: "", isUndated: true };
|
|
16049
16062
|
if (dateProp) {
|
|
@@ -16418,14 +16431,14 @@ function XViewScene({
|
|
|
16418
16431
|
(nodeData, position, suppressVersionUpdate = false, forceShowQuestDate = false) => {
|
|
16419
16432
|
const {
|
|
16420
16433
|
graphGroup,
|
|
16421
|
-
nodeObjects
|
|
16434
|
+
nodeObjects,
|
|
16422
16435
|
clickableNodes,
|
|
16423
16436
|
glowTexture,
|
|
16424
16437
|
tweenGroup
|
|
16425
16438
|
} = stateRef.current;
|
|
16426
16439
|
const nodeId = String(nodeData.id);
|
|
16427
|
-
if (
|
|
16428
|
-
const existingMesh =
|
|
16440
|
+
if (nodeObjects[nodeId]) {
|
|
16441
|
+
const existingMesh = nodeObjects[nodeId];
|
|
16429
16442
|
if (position) {
|
|
16430
16443
|
const updateTween = new Tween2(existingMesh.position).to(position, 800).easing(Easing2.Cubic.Out);
|
|
16431
16444
|
tweenGroup.add(updateTween);
|
|
@@ -16446,7 +16459,7 @@ function XViewScene({
|
|
|
16446
16459
|
}
|
|
16447
16460
|
graphGroup.add(mesh.userData.labelObject);
|
|
16448
16461
|
}
|
|
16449
|
-
|
|
16462
|
+
nodeObjects[nodeId] = mesh;
|
|
16450
16463
|
clickableNodes.push(mesh);
|
|
16451
16464
|
if (!suppressVersionUpdate) {
|
|
16452
16465
|
setSceneVersion((v) => v + 1);
|
|
@@ -16456,15 +16469,15 @@ function XViewScene({
|
|
|
16456
16469
|
[]
|
|
16457
16470
|
);
|
|
16458
16471
|
const handleActivateReshapeLens = useCallback7(({ type, columns, centerNodeId }) => {
|
|
16459
|
-
const { nodeObjects
|
|
16460
|
-
if (!
|
|
16461
|
-
const activeNodeIds = Object.keys(
|
|
16472
|
+
const { nodeObjects, tweenGroup, camera, controls } = stateRef.current;
|
|
16473
|
+
if (!nodeObjects || !tweenGroup || !camera || !controls) return;
|
|
16474
|
+
const activeNodeIds = Object.keys(nodeObjects);
|
|
16462
16475
|
if (activeNodeIds.length === 0) return;
|
|
16463
16476
|
let sumX = 0;
|
|
16464
16477
|
let sumY = 0;
|
|
16465
16478
|
let nodeCount = 0;
|
|
16466
16479
|
activeNodeIds.forEach((id) => {
|
|
16467
|
-
const mesh =
|
|
16480
|
+
const mesh = nodeObjects[id];
|
|
16468
16481
|
if (mesh && mesh.material) {
|
|
16469
16482
|
const opacityTween = new Tween2(mesh.material).to({ opacity: 1 }, 1200).easing(Easing2.Cubic.Out);
|
|
16470
16483
|
tweenGroup.add(opacityTween);
|
|
@@ -16479,7 +16492,7 @@ function XViewScene({
|
|
|
16479
16492
|
const rowSpacing = 80;
|
|
16480
16493
|
const numCols = columns || 4;
|
|
16481
16494
|
activeNodeIds.forEach((id, index) => {
|
|
16482
|
-
const mesh =
|
|
16495
|
+
const mesh = nodeObjects[id];
|
|
16483
16496
|
const col = index % numCols;
|
|
16484
16497
|
const row = Math.floor(index / numCols);
|
|
16485
16498
|
const targetX = (col - (numCols - 1) / 2) * colSpacing;
|
|
@@ -16501,7 +16514,7 @@ function XViewScene({
|
|
|
16501
16514
|
const total = activeNodeIds.length;
|
|
16502
16515
|
const radius = Math.max(80, total * 8);
|
|
16503
16516
|
activeNodeIds.forEach((id, index) => {
|
|
16504
|
-
const mesh =
|
|
16517
|
+
const mesh = nodeObjects[id];
|
|
16505
16518
|
const angle = index / total * Math.PI * 2;
|
|
16506
16519
|
const targetX = Math.cos(angle) * radius;
|
|
16507
16520
|
const targetY = Math.sin(angle) * radius;
|
|
@@ -16519,7 +16532,7 @@ function XViewScene({
|
|
|
16519
16532
|
nodeCount++;
|
|
16520
16533
|
});
|
|
16521
16534
|
} else if (type === "Star") {
|
|
16522
|
-
const centerMesh = centerNodeId ?
|
|
16535
|
+
const centerMesh = centerNodeId ? nodeObjects[String(centerNodeId)] : null;
|
|
16523
16536
|
const orbitingNodeIds = activeNodeIds.filter((id) => id !== String(centerNodeId));
|
|
16524
16537
|
const totalOrbiting = orbitingNodeIds.length;
|
|
16525
16538
|
const radius = Math.max(80, totalOrbiting * 10);
|
|
@@ -16538,7 +16551,7 @@ function XViewScene({
|
|
|
16538
16551
|
nodeCount++;
|
|
16539
16552
|
}
|
|
16540
16553
|
orbitingNodeIds.forEach((id, index) => {
|
|
16541
|
-
const mesh =
|
|
16554
|
+
const mesh = nodeObjects[id];
|
|
16542
16555
|
const angle = totalOrbiting > 0 ? index / totalOrbiting * Math.PI * 2 : 0;
|
|
16543
16556
|
const targetX = Math.cos(angle) * radius;
|
|
16544
16557
|
const targetY = Math.sin(angle) * radius;
|
|
@@ -16578,8 +16591,8 @@ function XViewScene({
|
|
|
16578
16591
|
}, []);
|
|
16579
16592
|
const handleActivateQuestLens = useCallback7(({ assigneeId, status: status2, milestoneId }) => {
|
|
16580
16593
|
var _a2;
|
|
16581
|
-
const { nodeObjects
|
|
16582
|
-
if (!
|
|
16594
|
+
const { nodeObjects, tweenGroup, graphGroup } = stateRef.current;
|
|
16595
|
+
if (!nodeObjects || !tweenGroup || !graphGroup) return;
|
|
16583
16596
|
const allQuests = ((_a2 = sceneDataRef.current) == null ? void 0 : _a2.quest_nodes) || [];
|
|
16584
16597
|
const filteredQuests = allQuests.filter((q) => {
|
|
16585
16598
|
const matchAssignee = !assigneeId || String(q.assignee_id) === String(assigneeId);
|
|
@@ -16641,7 +16654,7 @@ function XViewScene({
|
|
|
16641
16654
|
positionGroups.get(posKey).push(String(q.id));
|
|
16642
16655
|
});
|
|
16643
16656
|
});
|
|
16644
|
-
Object.values(
|
|
16657
|
+
Object.values(nodeObjects).forEach((mesh) => {
|
|
16645
16658
|
const oldLabel = mesh.getObjectByName("questDateLabel") || mesh.getObjectByName("timelineLabel");
|
|
16646
16659
|
if (oldLabel) {
|
|
16647
16660
|
mesh.remove(oldLabel);
|
|
@@ -16656,13 +16669,13 @@ function XViewScene({
|
|
|
16656
16669
|
mesh.userData.timelineEndLabel = null;
|
|
16657
16670
|
}
|
|
16658
16671
|
});
|
|
16659
|
-
const nonFilteredNodeIds = Object.keys(
|
|
16672
|
+
const nonFilteredNodeIds = Object.keys(nodeObjects).filter((id) => !filteredQuests.some((q) => String(q.id) === String(id)));
|
|
16660
16673
|
const COMMON_START_X = startX - 100;
|
|
16661
16674
|
const COMMON_COL_SPACING = 30;
|
|
16662
16675
|
const COMMON_ROW_SPACING = 35;
|
|
16663
16676
|
const MAX_COMMON_ROWS = 15;
|
|
16664
16677
|
nonFilteredNodeIds.forEach((id, idx) => {
|
|
16665
|
-
const mesh =
|
|
16678
|
+
const mesh = nodeObjects[id];
|
|
16666
16679
|
if (!mesh) return;
|
|
16667
16680
|
const col = Math.floor(idx / MAX_COMMON_ROWS);
|
|
16668
16681
|
const row = idx % MAX_COMMON_ROWS;
|
|
@@ -16688,7 +16701,7 @@ function XViewScene({
|
|
|
16688
16701
|
sideTween.start();
|
|
16689
16702
|
});
|
|
16690
16703
|
filteredQuests.forEach((q) => {
|
|
16691
|
-
const mesh =
|
|
16704
|
+
const mesh = nodeObjects[String(q.id)];
|
|
16692
16705
|
if (mesh) {
|
|
16693
16706
|
if (mesh.material) {
|
|
16694
16707
|
const fadeInTween = new Tween2(mesh.material).to({ opacity: 1 }, 1200).easing(Easing2.Cubic.Out);
|
|
@@ -16706,7 +16719,7 @@ function XViewScene({
|
|
|
16706
16719
|
const colX = startX + colIndex * QUEST_LENS_COLUMN_SPACING;
|
|
16707
16720
|
questsInCol.forEach((q, rowIndex) => {
|
|
16708
16721
|
const nodeId = String(q.id);
|
|
16709
|
-
let mesh =
|
|
16722
|
+
let mesh = nodeObjects[nodeId];
|
|
16710
16723
|
const timeInfo = questTimeInfos.get(nodeId) || { isUndated: true };
|
|
16711
16724
|
let targetY;
|
|
16712
16725
|
if (!timeInfo.isUndated) {
|
|
@@ -16852,8 +16865,8 @@ function XViewScene({
|
|
|
16852
16865
|
stateRef.current.timelineIntervalsGroup = timelineIntervalsGroup;
|
|
16853
16866
|
const graphData = sceneDataRef.current;
|
|
16854
16867
|
const nodePositions = calculateNodePositions(graphData.nodes);
|
|
16855
|
-
const
|
|
16856
|
-
stateRef.current.nodeObjects =
|
|
16868
|
+
const nodeObjects = {};
|
|
16869
|
+
stateRef.current.nodeObjects = nodeObjects;
|
|
16857
16870
|
stateRef.current.glowTexture = makeGlowTexture();
|
|
16858
16871
|
graphData.nodes.forEach((node) => {
|
|
16859
16872
|
const position = nodePositions[node.id] || new THREE3.Vector3();
|
|
@@ -16863,7 +16876,7 @@ function XViewScene({
|
|
|
16863
16876
|
mesh.userData.labelObject.position.copy(mesh.position).add(mesh.userData.labelOffset);
|
|
16864
16877
|
graphGroup.add(mesh.userData.labelObject);
|
|
16865
16878
|
}
|
|
16866
|
-
|
|
16879
|
+
nodeObjects[String(node.id)] = mesh;
|
|
16867
16880
|
stateRef.current.clickableNodes.push(mesh);
|
|
16868
16881
|
});
|
|
16869
16882
|
const linksGroupedByNodes = /* @__PURE__ */ new Map();
|
|
@@ -16875,8 +16888,8 @@ function XViewScene({
|
|
|
16875
16888
|
linksGroupedByNodes.get(pairKey).push(link);
|
|
16876
16889
|
});
|
|
16877
16890
|
linksGroupedByNodes.forEach((linksArray) => {
|
|
16878
|
-
const sourceNode =
|
|
16879
|
-
const targetNode =
|
|
16891
|
+
const sourceNode = nodeObjects[String(linksArray[0].source)];
|
|
16892
|
+
const targetNode = nodeObjects[String(linksArray[0].target)];
|
|
16880
16893
|
if (sourceNode && targetNode) {
|
|
16881
16894
|
const resolution = new THREE3.Vector2(
|
|
16882
16895
|
currentMount.clientWidth,
|
|
@@ -18104,17 +18117,53 @@ function XViewScene({
|
|
|
18104
18117
|
const formattedTree = convertTreeToIds(newTree);
|
|
18105
18118
|
const formattedAbstractionTree = convertTreeToIds(newAbstractionTree);
|
|
18106
18119
|
if (questNodeId && sceneConfigId) {
|
|
18107
|
-
const sceneData =
|
|
18120
|
+
const sceneData = sceneDataRef.current;
|
|
18108
18121
|
if (sceneData && sceneData.quest_nodes) {
|
|
18109
18122
|
const questIndex = sceneData.quest_nodes.findIndex((q) => String(q.id) === String(questNodeId));
|
|
18110
18123
|
if (questIndex !== -1) {
|
|
18111
18124
|
sceneData.quest_nodes[questIndex].quest_tree = formattedTree;
|
|
18112
18125
|
sceneData.quest_nodes[questIndex].quest_abstraction_tree = formattedAbstractionTree;
|
|
18113
|
-
if (
|
|
18114
|
-
|
|
18126
|
+
if (graphDataRef.current[sceneConfigId]) {
|
|
18127
|
+
const graphIndex = graphDataRef.current[sceneConfigId].nodes.findIndex(
|
|
18128
|
+
(q) => String(q.id) === String(questNodeId)
|
|
18129
|
+
);
|
|
18130
|
+
if (graphIndex !== -1) {
|
|
18131
|
+
graphDataRef.current[sceneConfigId].nodes[graphIndex].quest_tree = formattedTree;
|
|
18132
|
+
graphDataRef.current[sceneConfigId].nodes[graphIndex].quest_abstraction_tree = formattedAbstractionTree;
|
|
18133
|
+
}
|
|
18134
|
+
}
|
|
18135
|
+
if (parentDataRef.current[sceneConfigId]) {
|
|
18136
|
+
const parentIndex = parentDataRef.current[sceneConfigId].nodes.findIndex(
|
|
18137
|
+
(q) => String(q.id) === String(questNodeId)
|
|
18138
|
+
);
|
|
18139
|
+
if (parentIndex !== -1) {
|
|
18140
|
+
parentDataRef.current[sceneConfigId].nodes[parentIndex].quest_tree = formattedTree;
|
|
18141
|
+
parentDataRef.current[sceneConfigId].nodes[parentIndex].quest_abstraction_tree = formattedAbstractionTree;
|
|
18142
|
+
}
|
|
18143
|
+
}
|
|
18144
|
+
if (save_view_data && sceneSaveUrl) {
|
|
18145
|
+
const { nodeObjects: nObj, allLinks: aLinks } = stateRef.current;
|
|
18146
|
+
const currentNodes = nObj ? Object.values(nObj).map((mesh) => {
|
|
18147
|
+
const { _baseEmissiveIntensity, labelObject, labelOffset, timelineIntervalBar, timelineEndLabel, ...serializableNodeData } = mesh.userData;
|
|
18148
|
+
return serializableNodeData;
|
|
18149
|
+
}) : sceneData.nodes || [];
|
|
18150
|
+
const currentLinks = aLinks ? aLinks.map((line) => {
|
|
18151
|
+
const { sourceNode, targetNode, ...serializableLinkData } = line.userData;
|
|
18152
|
+
return serializableLinkData;
|
|
18153
|
+
}) : sceneData.links || [];
|
|
18154
|
+
const sceneFileData = {
|
|
18155
|
+
...sceneData,
|
|
18156
|
+
nodes: currentNodes,
|
|
18157
|
+
links: currentLinks,
|
|
18158
|
+
quest_nodes: sceneData.quest_nodes,
|
|
18159
|
+
quest_links: sceneData.quest_links || [],
|
|
18160
|
+
quest_counter: sceneData.quest_counter || 1,
|
|
18161
|
+
milestones: sceneData.milestones || []
|
|
18162
|
+
};
|
|
18163
|
+
await save_view_data(sceneSaveUrl, sceneFileData);
|
|
18115
18164
|
}
|
|
18116
18165
|
const updatedNodeData = sceneData.quest_nodes[questIndex];
|
|
18117
|
-
const nodeMesh = nodeObjects[String(questNodeId)];
|
|
18166
|
+
const nodeMesh = (_a2 = stateRef.current.nodeObjects) == null ? void 0 : _a2[String(questNodeId)];
|
|
18118
18167
|
if (nodeMesh) {
|
|
18119
18168
|
nodeMesh.userData.questData = updatedNodeData;
|
|
18120
18169
|
}
|
|
@@ -18156,7 +18205,7 @@ function XViewScene({
|
|
|
18156
18205
|
};
|
|
18157
18206
|
const handleSaveQuestNode = async (context, newQuestData) => {
|
|
18158
18207
|
const {
|
|
18159
|
-
graphDataRef,
|
|
18208
|
+
graphDataRef: graphDataRef2,
|
|
18160
18209
|
sceneDataRef: sceneDataRef2,
|
|
18161
18210
|
stateRef: stateRef2,
|
|
18162
18211
|
setters,
|
|
@@ -18166,7 +18215,7 @@ function XViewScene({
|
|
|
18166
18215
|
sceneConfigId: sceneConfigId2,
|
|
18167
18216
|
ownerId: ownerId2
|
|
18168
18217
|
} = context;
|
|
18169
|
-
if (!
|
|
18218
|
+
if (!graphDataRef2.current || (viewType == null ? void 0 : viewType.toLowerCase()) !== "view") return;
|
|
18170
18219
|
const currentCounter = sceneDataRef2.current.quest_counter || 1;
|
|
18171
18220
|
const newNode = {
|
|
18172
18221
|
id: short2.generate(),
|
|
@@ -18174,14 +18223,14 @@ function XViewScene({
|
|
|
18174
18223
|
is_quest: true,
|
|
18175
18224
|
type: ["quest", ...newQuestData.type.filter((t) => t !== "quest")]
|
|
18176
18225
|
};
|
|
18177
|
-
if (!
|
|
18178
|
-
|
|
18226
|
+
if (!graphDataRef2.current[sceneConfigId2]) {
|
|
18227
|
+
graphDataRef2.current[sceneConfigId2] = { nodes: [], links: [] };
|
|
18179
18228
|
}
|
|
18180
|
-
|
|
18229
|
+
graphDataRef2.current[sceneConfigId2].nodes.push(newNode);
|
|
18181
18230
|
const sceneFileData = {
|
|
18182
18231
|
...sceneDataRef2.current,
|
|
18183
|
-
quest_nodes:
|
|
18184
|
-
quest_links:
|
|
18232
|
+
quest_nodes: graphDataRef2.current[sceneConfigId2].nodes,
|
|
18233
|
+
quest_links: graphDataRef2.current[sceneConfigId2].links,
|
|
18185
18234
|
quest_counter: currentCounter + 1
|
|
18186
18235
|
};
|
|
18187
18236
|
try {
|
|
@@ -18192,9 +18241,9 @@ function XViewScene({
|
|
|
18192
18241
|
ownerId: ownerId2,
|
|
18193
18242
|
datasetName: "Quests Internas (View)"
|
|
18194
18243
|
});
|
|
18195
|
-
sceneDataRef2.current.quest_nodes = [...
|
|
18244
|
+
sceneDataRef2.current.quest_nodes = [...graphDataRef2.current[sceneConfigId2].nodes];
|
|
18196
18245
|
if (parentDataRef.current[sceneConfigId2]) {
|
|
18197
|
-
parentDataRef.current[sceneConfigId2].nodes = [...
|
|
18246
|
+
parentDataRef.current[sceneConfigId2].nodes = [...graphDataRef2.current[sceneConfigId2].nodes];
|
|
18198
18247
|
}
|
|
18199
18248
|
const finalPosition = stateRef2.current.ghostElements.node ? stateRef2.current.ghostElements.node.position.clone() : stateRef2.current.controls.target.clone();
|
|
18200
18249
|
const { graphGroup, ghostElements } = stateRef2.current;
|
|
@@ -18216,26 +18265,26 @@ function XViewScene({
|
|
|
18216
18265
|
userActionHandlers.handleCompleteConnection = async (context, targetNodeData) => {
|
|
18217
18266
|
const {
|
|
18218
18267
|
stateRef: stateRef2,
|
|
18219
|
-
graphDataRef,
|
|
18268
|
+
graphDataRef: graphDataRef2,
|
|
18220
18269
|
sceneDataRef: sceneDataRef2,
|
|
18221
18270
|
sceneConfigId: sceneConfigId2,
|
|
18222
18271
|
sceneSaveUrl: sceneSaveUrl2,
|
|
18223
18272
|
ownerId: ownerId2
|
|
18224
18273
|
} = context;
|
|
18225
18274
|
const { sourceNodeData } = stateRef2.current.connection;
|
|
18226
|
-
if (!
|
|
18275
|
+
if (!graphDataRef2.current || !sceneDataRef2.current || !sourceNodeData || !targetNodeData) {
|
|
18227
18276
|
userActionHandlers.handleCancelConnection(context);
|
|
18228
18277
|
return;
|
|
18229
18278
|
}
|
|
18230
18279
|
const sourceParentInfo = getParentFileInfoForNode(
|
|
18231
|
-
|
|
18280
|
+
graphDataRef2.current,
|
|
18232
18281
|
sceneDataRef2.current,
|
|
18233
18282
|
sourceNodeData.id,
|
|
18234
18283
|
sceneConfigId2,
|
|
18235
18284
|
ownerId2
|
|
18236
18285
|
);
|
|
18237
18286
|
const targetParentInfo = getParentFileInfoForNode(
|
|
18238
|
-
|
|
18287
|
+
graphDataRef2.current,
|
|
18239
18288
|
sceneDataRef2.current,
|
|
18240
18289
|
targetNodeData.id,
|
|
18241
18290
|
sceneConfigId2,
|
|
@@ -18255,7 +18304,7 @@ function XViewScene({
|
|
|
18255
18304
|
};
|
|
18256
18305
|
try {
|
|
18257
18306
|
if (parentFileIdToSave === sceneConfigId2) {
|
|
18258
|
-
const specificParentData =
|
|
18307
|
+
const specificParentData = graphDataRef2.current[sceneConfigId2];
|
|
18259
18308
|
specificParentData.links.push(newLink);
|
|
18260
18309
|
const viewFilePayload = {
|
|
18261
18310
|
...sceneDataRef2.current,
|
|
@@ -18266,7 +18315,7 @@ function XViewScene({
|
|
|
18266
18315
|
await context.actions.save_view_data(sceneSaveUrl2, viewFilePayload);
|
|
18267
18316
|
} else {
|
|
18268
18317
|
const specificParentData = JSON.parse(
|
|
18269
|
-
JSON.stringify(
|
|
18318
|
+
JSON.stringify(graphDataRef2.current[parentFileIdToSave])
|
|
18270
18319
|
);
|
|
18271
18320
|
specificParentData.links.push(newLink);
|
|
18272
18321
|
const filenameForSpecificParent = `x_view_dbs/${ownerIdToSave}/${parentFileIdToSave}`;
|
|
@@ -18274,7 +18323,7 @@ function XViewScene({
|
|
|
18274
18323
|
filenameForSpecificParent,
|
|
18275
18324
|
specificParentData
|
|
18276
18325
|
);
|
|
18277
|
-
|
|
18326
|
+
graphDataRef2.current[parentFileIdToSave] = specificParentData;
|
|
18278
18327
|
}
|
|
18279
18328
|
addNewLinkToScene(stateRef2.current, newLink);
|
|
18280
18329
|
} catch (error) {
|
|
@@ -18321,7 +18370,7 @@ function XViewScene({
|
|
|
18321
18370
|
}
|
|
18322
18371
|
});
|
|
18323
18372
|
}
|
|
18324
|
-
const { ancestryGroup, nodeObjects
|
|
18373
|
+
const { ancestryGroup, nodeObjects, renderer, renderedAncestries } = stateRef.current;
|
|
18325
18374
|
const currentRenderLimit = stateRef.current.maxAncestryRenderIndex || 0;
|
|
18326
18375
|
const isFullRenderRequest = !normalizedAllowedIds;
|
|
18327
18376
|
const checkShouldRender = (section) => {
|
|
@@ -18425,10 +18474,10 @@ function XViewScene({
|
|
|
18425
18474
|
);
|
|
18426
18475
|
if (!fullTree) return;
|
|
18427
18476
|
const rootNodeId = String(ancestryObject.ancestral_node);
|
|
18428
|
-
let rootNodeMesh =
|
|
18477
|
+
let rootNodeMesh = nodeObjects[rootNodeId];
|
|
18429
18478
|
let originMesh = null;
|
|
18430
18479
|
if (ancestryObject._originNodeId) {
|
|
18431
|
-
originMesh =
|
|
18480
|
+
originMesh = nodeObjects[String(ancestryObject._originNodeId)];
|
|
18432
18481
|
}
|
|
18433
18482
|
let rootTargetPos = null;
|
|
18434
18483
|
if (originMesh) {
|
|
@@ -18642,7 +18691,7 @@ function XViewScene({
|
|
|
18642
18691
|
} else {
|
|
18643
18692
|
const traverseAndCollect = (item) => {
|
|
18644
18693
|
if (item.node) {
|
|
18645
|
-
const mesh =
|
|
18694
|
+
const mesh = nodeObjects[String(item.node.id)];
|
|
18646
18695
|
if (mesh) allRenderedNodePositions.push(mesh.position.clone());
|
|
18647
18696
|
}
|
|
18648
18697
|
if (item.children) item.children.forEach(traverseAndCollect);
|
|
@@ -18690,7 +18739,7 @@ function XViewScene({
|
|
|
18690
18739
|
const nodeIds = collectNodeIdsInSection(targetSectionForZone);
|
|
18691
18740
|
const vectors = [];
|
|
18692
18741
|
nodeIds.forEach((id) => {
|
|
18693
|
-
const mesh =
|
|
18742
|
+
const mesh = nodeObjects[String(id)];
|
|
18694
18743
|
if (mesh) {
|
|
18695
18744
|
const targetPos = targetPositionsCache.get(String(id));
|
|
18696
18745
|
vectors.push(targetPos ? targetPos.clone() : mesh.position.clone());
|
|
@@ -18749,8 +18798,8 @@ function XViewScene({
|
|
|
18749
18798
|
focusTargetPosition = targetPositionsCache.get(anchorId) || currentAnchorMesh.position.clone();
|
|
18750
18799
|
focusTargetRotation = baseRotation;
|
|
18751
18800
|
}
|
|
18752
|
-
} else if (activeSectionIdForFocus &&
|
|
18753
|
-
const directNode =
|
|
18801
|
+
} else if (activeSectionIdForFocus && nodeObjects[String(activeSectionIdForFocus)]) {
|
|
18802
|
+
const directNode = nodeObjects[String(activeSectionIdForFocus)];
|
|
18754
18803
|
const tPos = targetPositionsCache.get(String(activeSectionIdForFocus));
|
|
18755
18804
|
focusTargetPosition = tPos ? tPos.clone() : directNode.position.clone();
|
|
18756
18805
|
focusTargetRotation = baseRotation;
|
|
@@ -18801,7 +18850,7 @@ function XViewScene({
|
|
|
18801
18850
|
(prev) => prev.visible ? { ...prev, visible: false } : prev
|
|
18802
18851
|
);
|
|
18803
18852
|
if (!ancestryObject || !ancestryObject.abstraction_tree) return;
|
|
18804
|
-
const { ancestryGroup, nodeObjects
|
|
18853
|
+
const { ancestryGroup, nodeObjects, renderer, renderedAncestries } = stateRef.current;
|
|
18805
18854
|
const allParentNodes = Object.values(parentDataRef.current).flatMap(
|
|
18806
18855
|
(f) => f.nodes
|
|
18807
18856
|
);
|
|
@@ -18842,7 +18891,7 @@ function XViewScene({
|
|
|
18842
18891
|
const ancestryEntry = { id: absId, lines: [], isFullRender: true };
|
|
18843
18892
|
renderedAncestries.push(ancestryEntry);
|
|
18844
18893
|
const rootNodeId = String(fullTree.node.id);
|
|
18845
|
-
let rootNodeMesh =
|
|
18894
|
+
let rootNodeMesh = nodeObjects[rootNodeId];
|
|
18846
18895
|
let rootTargetPos = rootNodeMesh ? rootNodeMesh.position.clone() : new THREE3.Vector3(0, 0, 0);
|
|
18847
18896
|
if (!rootNodeMesh) {
|
|
18848
18897
|
rootNodeMesh = addOrUpdateNodeMesh(fullTree.node, rootTargetPos, true);
|
|
@@ -19954,8 +20003,8 @@ function XViewScene({
|
|
|
19954
20003
|
setSceneVersion((v) => v + 1);
|
|
19955
20004
|
const isView = ((_a2 = viewParams == null ? void 0 : viewParams.type) == null ? void 0 : _a2.toLowerCase()) === "view";
|
|
19956
20005
|
if (!isView || !save_view_data || !sceneSaveUrl) return;
|
|
19957
|
-
const { nodeObjects
|
|
19958
|
-
const currentNodes = Object.values(
|
|
20006
|
+
const { nodeObjects, allLinks } = stateRef.current;
|
|
20007
|
+
const currentNodes = Object.values(nodeObjects || {}).map((mesh) => {
|
|
19959
20008
|
const {
|
|
19960
20009
|
_baseEmissiveIntensity,
|
|
19961
20010
|
labelObject,
|
|
@@ -19994,15 +20043,15 @@ function XViewScene({
|
|
|
19994
20043
|
);
|
|
19995
20044
|
const handleSaveCurrentView = useCallback7(async () => {
|
|
19996
20045
|
var _a2, _b2, _c2;
|
|
19997
|
-
const { nodeObjects
|
|
19998
|
-
if (!
|
|
20046
|
+
const { nodeObjects, allLinks } = stateRef.current;
|
|
20047
|
+
if (!nodeObjects || !allLinks || !sceneSaveUrl || !parentDataRef.current) {
|
|
19999
20048
|
console.warn(
|
|
20000
20049
|
"N\xE3o \xE9 poss\xEDvel salvar a cena: estado n\xE3o inicializado ou URL de salvamento ausente."
|
|
20001
20050
|
);
|
|
20002
20051
|
return;
|
|
20003
20052
|
}
|
|
20004
20053
|
if (!save_view_data) return;
|
|
20005
|
-
const currentNodes = Object.values(
|
|
20054
|
+
const currentNodes = Object.values(nodeObjects).map((mesh) => {
|
|
20006
20055
|
const {
|
|
20007
20056
|
_baseEmissiveIntensity,
|
|
20008
20057
|
labelObject,
|
|
@@ -20057,8 +20106,8 @@ function XViewScene({
|
|
|
20057
20106
|
const detailsNodeDatasetInfo = detailsNode ? stateRef.current.nodeIdToParentFileMap.get(String(detailsNode.id)) : null;
|
|
20058
20107
|
useEffect25(() => {
|
|
20059
20108
|
if (isInitialized && focusNodeId && !hasFocusedInitial) {
|
|
20060
|
-
const
|
|
20061
|
-
const targetMesh =
|
|
20109
|
+
const nodeObjects = stateRef.current.nodeObjects || {};
|
|
20110
|
+
const targetMesh = nodeObjects[String(focusNodeId)];
|
|
20062
20111
|
if (targetMesh) {
|
|
20063
20112
|
setTimeout(() => {
|
|
20064
20113
|
tweenToTarget(targetMesh, 1.2);
|
|
@@ -20147,10 +20196,10 @@ function XViewScene({
|
|
|
20147
20196
|
if (isUiClear) {
|
|
20148
20197
|
const isView = ((_c2 = viewParams == null ? void 0 : viewParams.type) == null ? void 0 : _c2.toLowerCase()) === "view";
|
|
20149
20198
|
if (!isView) return;
|
|
20150
|
-
const { graphGroup, glowTexture, controls: sceneControls, nodeObjects
|
|
20199
|
+
const { graphGroup, glowTexture, controls: sceneControls, nodeObjects } = stateRef.current;
|
|
20151
20200
|
if (graphGroup) {
|
|
20152
20201
|
let ghostPosition = sceneControls.target.clone();
|
|
20153
|
-
const existingNodes = Object.values(
|
|
20202
|
+
const existingNodes = Object.values(nodeObjects);
|
|
20154
20203
|
let isOccupied = true;
|
|
20155
20204
|
let radius = 18;
|
|
20156
20205
|
let angle = 0;
|