@lv-x-software-house/x_view 1.2.6-dev.76 → 1.2.6-dev.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +224 -170
- package/dist/index.mjs +224 -170
- package/package.json +1 -1
package/dist/index.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,18 +8932,28 @@ 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",
|
|
8949
8952
|
{
|
|
8950
|
-
onClick: () =>
|
|
8953
|
+
onClick: () => {
|
|
8954
|
+
setActiveTab("tree");
|
|
8955
|
+
setQuestTreeMode2((prev) => ({ ...prev, isAddingNodes: true, isAddingAbstractionNodes: false }));
|
|
8956
|
+
},
|
|
8951
8957
|
className: `flex-1 flex items-center justify-center gap-2 py-2 px-3 rounded-md text-sm font-medium transition-all ${activeTab === "tree" ? "bg-indigo-600 text-white shadow-lg" : "bg-slate-800 text-slate-400 hover:bg-slate-700 hover:text-slate-200"}`
|
|
8952
8958
|
},
|
|
8953
8959
|
/* @__PURE__ */ React11.createElement(FiGitBranch3, null),
|
|
@@ -8955,7 +8961,10 @@ function CreateQuestTreePanel({
|
|
|
8955
8961
|
), /* @__PURE__ */ React11.createElement(
|
|
8956
8962
|
"button",
|
|
8957
8963
|
{
|
|
8958
|
-
onClick: () =>
|
|
8964
|
+
onClick: () => {
|
|
8965
|
+
setActiveTab("abstraction");
|
|
8966
|
+
setQuestTreeMode2((prev) => ({ ...prev, isAddingNodes: false, isAddingAbstractionNodes: true }));
|
|
8967
|
+
},
|
|
8959
8968
|
className: `flex-1 flex items-center justify-center gap-2 py-2 px-3 rounded-md text-sm font-medium transition-all ${activeTab === "abstraction" ? "bg-indigo-600 text-white shadow-lg" : "bg-slate-800 text-slate-400 hover:bg-slate-700 hover:text-slate-200"}`
|
|
8960
8969
|
},
|
|
8961
8970
|
/* @__PURE__ */ React11.createElement(FiLayers6, null),
|
|
@@ -8971,15 +8980,7 @@ function CreateQuestTreePanel({
|
|
|
8971
8980
|
selectedParentId
|
|
8972
8981
|
}
|
|
8973
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..."))),
|
|
8974
|
-
/* @__PURE__ */ React11.createElement("div", { className: "absolute bottom-6 left-1/2 -translate-x-1/2
|
|
8975
|
-
"button",
|
|
8976
|
-
{
|
|
8977
|
-
onClick: handleToggleAddMode,
|
|
8978
|
-
className: `flex items-center gap-2 px-5 py-2.5 rounded-full font-bold shadow-xl transition-all ${isAddingModeActive ? "bg-red-500 hover:bg-red-600 text-white animate-pulse shadow-red-500/20" : "bg-indigo-500 hover:bg-indigo-600 text-white shadow-indigo-500/20"}`
|
|
8979
|
-
},
|
|
8980
|
-
isAddingModeActive ? /* @__PURE__ */ React11.createElement(React11.Fragment, null, "Clique no Cen\xE1rio 3D ", /* @__PURE__ */ React11.createElement("span", { className: "animate-bounce" }, "\u2193")) : /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(FiPlus3, null), " Adicionar \xE0 \xC1rvore")
|
|
8981
|
-
)),
|
|
8982
|
-
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"))
|
|
8983
8984
|
);
|
|
8984
8985
|
}
|
|
8985
8986
|
|
|
@@ -10810,6 +10811,7 @@ function InSceneQuestForm({
|
|
|
10810
10811
|
setQuestTreeMode((prev) => ({
|
|
10811
10812
|
...prev,
|
|
10812
10813
|
isActive: true,
|
|
10814
|
+
isAddingNodes: true,
|
|
10813
10815
|
questTempData: true
|
|
10814
10816
|
}));
|
|
10815
10817
|
}
|
|
@@ -13073,10 +13075,30 @@ ${noteText}` : noteText : entry.notes,
|
|
|
13073
13075
|
type: "button",
|
|
13074
13076
|
onClick: () => {
|
|
13075
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: [] };
|
|
13076
13093
|
setQuestTreeMode2((prev) => ({
|
|
13077
13094
|
...prev,
|
|
13078
13095
|
isActive: true,
|
|
13079
|
-
|
|
13096
|
+
isAddingNodes: true,
|
|
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
|
|
13080
13102
|
}));
|
|
13081
13103
|
}
|
|
13082
13104
|
},
|
|
@@ -15999,8 +16021,8 @@ function XViewScene({
|
|
|
15999
16021
|
[]
|
|
16000
16022
|
);
|
|
16001
16023
|
const handleActivateTimeline = useCallback7(() => {
|
|
16002
|
-
const { nodeObjects
|
|
16003
|
-
if (!
|
|
16024
|
+
const { nodeObjects, tweenGroup, timelineIntervalsGroup } = stateRef.current;
|
|
16025
|
+
if (!nodeObjects || !tweenGroup || !timelineIntervalsGroup) return;
|
|
16004
16026
|
while (timelineIntervalsGroup.children.length > 0) {
|
|
16005
16027
|
const obj = timelineIntervalsGroup.children[0];
|
|
16006
16028
|
timelineIntervalsGroup.remove(obj);
|
|
@@ -16010,7 +16032,7 @@ function XViewScene({
|
|
|
16010
16032
|
obj.material.dispose();
|
|
16011
16033
|
}
|
|
16012
16034
|
}
|
|
16013
|
-
Object.values(
|
|
16035
|
+
Object.values(nodeObjects).forEach((mesh) => {
|
|
16014
16036
|
const oldLabel = mesh.getObjectByName("timelineLabel");
|
|
16015
16037
|
if (oldLabel) {
|
|
16016
16038
|
mesh.remove(oldLabel);
|
|
@@ -16034,7 +16056,7 @@ function XViewScene({
|
|
|
16034
16056
|
}
|
|
16035
16057
|
return null;
|
|
16036
16058
|
};
|
|
16037
|
-
Object.values(
|
|
16059
|
+
Object.values(nodeObjects).forEach((mesh) => {
|
|
16038
16060
|
const dateProp = mesh.userData.Date;
|
|
16039
16061
|
let nodeInfo = { mesh, type: "point", label: "", isUndated: true };
|
|
16040
16062
|
if (dateProp) {
|
|
@@ -16409,14 +16431,14 @@ function XViewScene({
|
|
|
16409
16431
|
(nodeData, position, suppressVersionUpdate = false, forceShowQuestDate = false) => {
|
|
16410
16432
|
const {
|
|
16411
16433
|
graphGroup,
|
|
16412
|
-
nodeObjects
|
|
16434
|
+
nodeObjects,
|
|
16413
16435
|
clickableNodes,
|
|
16414
16436
|
glowTexture,
|
|
16415
16437
|
tweenGroup
|
|
16416
16438
|
} = stateRef.current;
|
|
16417
16439
|
const nodeId = String(nodeData.id);
|
|
16418
|
-
if (
|
|
16419
|
-
const existingMesh =
|
|
16440
|
+
if (nodeObjects[nodeId]) {
|
|
16441
|
+
const existingMesh = nodeObjects[nodeId];
|
|
16420
16442
|
if (position) {
|
|
16421
16443
|
const updateTween = new Tween2(existingMesh.position).to(position, 800).easing(Easing2.Cubic.Out);
|
|
16422
16444
|
tweenGroup.add(updateTween);
|
|
@@ -16437,7 +16459,7 @@ function XViewScene({
|
|
|
16437
16459
|
}
|
|
16438
16460
|
graphGroup.add(mesh.userData.labelObject);
|
|
16439
16461
|
}
|
|
16440
|
-
|
|
16462
|
+
nodeObjects[nodeId] = mesh;
|
|
16441
16463
|
clickableNodes.push(mesh);
|
|
16442
16464
|
if (!suppressVersionUpdate) {
|
|
16443
16465
|
setSceneVersion((v) => v + 1);
|
|
@@ -16447,15 +16469,15 @@ function XViewScene({
|
|
|
16447
16469
|
[]
|
|
16448
16470
|
);
|
|
16449
16471
|
const handleActivateReshapeLens = useCallback7(({ type, columns, centerNodeId }) => {
|
|
16450
|
-
const { nodeObjects
|
|
16451
|
-
if (!
|
|
16452
|
-
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);
|
|
16453
16475
|
if (activeNodeIds.length === 0) return;
|
|
16454
16476
|
let sumX = 0;
|
|
16455
16477
|
let sumY = 0;
|
|
16456
16478
|
let nodeCount = 0;
|
|
16457
16479
|
activeNodeIds.forEach((id) => {
|
|
16458
|
-
const mesh =
|
|
16480
|
+
const mesh = nodeObjects[id];
|
|
16459
16481
|
if (mesh && mesh.material) {
|
|
16460
16482
|
const opacityTween = new Tween2(mesh.material).to({ opacity: 1 }, 1200).easing(Easing2.Cubic.Out);
|
|
16461
16483
|
tweenGroup.add(opacityTween);
|
|
@@ -16470,7 +16492,7 @@ function XViewScene({
|
|
|
16470
16492
|
const rowSpacing = 80;
|
|
16471
16493
|
const numCols = columns || 4;
|
|
16472
16494
|
activeNodeIds.forEach((id, index) => {
|
|
16473
|
-
const mesh =
|
|
16495
|
+
const mesh = nodeObjects[id];
|
|
16474
16496
|
const col = index % numCols;
|
|
16475
16497
|
const row = Math.floor(index / numCols);
|
|
16476
16498
|
const targetX = (col - (numCols - 1) / 2) * colSpacing;
|
|
@@ -16492,7 +16514,7 @@ function XViewScene({
|
|
|
16492
16514
|
const total = activeNodeIds.length;
|
|
16493
16515
|
const radius = Math.max(80, total * 8);
|
|
16494
16516
|
activeNodeIds.forEach((id, index) => {
|
|
16495
|
-
const mesh =
|
|
16517
|
+
const mesh = nodeObjects[id];
|
|
16496
16518
|
const angle = index / total * Math.PI * 2;
|
|
16497
16519
|
const targetX = Math.cos(angle) * radius;
|
|
16498
16520
|
const targetY = Math.sin(angle) * radius;
|
|
@@ -16510,7 +16532,7 @@ function XViewScene({
|
|
|
16510
16532
|
nodeCount++;
|
|
16511
16533
|
});
|
|
16512
16534
|
} else if (type === "Star") {
|
|
16513
|
-
const centerMesh = centerNodeId ?
|
|
16535
|
+
const centerMesh = centerNodeId ? nodeObjects[String(centerNodeId)] : null;
|
|
16514
16536
|
const orbitingNodeIds = activeNodeIds.filter((id) => id !== String(centerNodeId));
|
|
16515
16537
|
const totalOrbiting = orbitingNodeIds.length;
|
|
16516
16538
|
const radius = Math.max(80, totalOrbiting * 10);
|
|
@@ -16529,7 +16551,7 @@ function XViewScene({
|
|
|
16529
16551
|
nodeCount++;
|
|
16530
16552
|
}
|
|
16531
16553
|
orbitingNodeIds.forEach((id, index) => {
|
|
16532
|
-
const mesh =
|
|
16554
|
+
const mesh = nodeObjects[id];
|
|
16533
16555
|
const angle = totalOrbiting > 0 ? index / totalOrbiting * Math.PI * 2 : 0;
|
|
16534
16556
|
const targetX = Math.cos(angle) * radius;
|
|
16535
16557
|
const targetY = Math.sin(angle) * radius;
|
|
@@ -16569,8 +16591,8 @@ function XViewScene({
|
|
|
16569
16591
|
}, []);
|
|
16570
16592
|
const handleActivateQuestLens = useCallback7(({ assigneeId, status: status2, milestoneId }) => {
|
|
16571
16593
|
var _a2;
|
|
16572
|
-
const { nodeObjects
|
|
16573
|
-
if (!
|
|
16594
|
+
const { nodeObjects, tweenGroup, graphGroup } = stateRef.current;
|
|
16595
|
+
if (!nodeObjects || !tweenGroup || !graphGroup) return;
|
|
16574
16596
|
const allQuests = ((_a2 = sceneDataRef.current) == null ? void 0 : _a2.quest_nodes) || [];
|
|
16575
16597
|
const filteredQuests = allQuests.filter((q) => {
|
|
16576
16598
|
const matchAssignee = !assigneeId || String(q.assignee_id) === String(assigneeId);
|
|
@@ -16632,7 +16654,7 @@ function XViewScene({
|
|
|
16632
16654
|
positionGroups.get(posKey).push(String(q.id));
|
|
16633
16655
|
});
|
|
16634
16656
|
});
|
|
16635
|
-
Object.values(
|
|
16657
|
+
Object.values(nodeObjects).forEach((mesh) => {
|
|
16636
16658
|
const oldLabel = mesh.getObjectByName("questDateLabel") || mesh.getObjectByName("timelineLabel");
|
|
16637
16659
|
if (oldLabel) {
|
|
16638
16660
|
mesh.remove(oldLabel);
|
|
@@ -16647,13 +16669,13 @@ function XViewScene({
|
|
|
16647
16669
|
mesh.userData.timelineEndLabel = null;
|
|
16648
16670
|
}
|
|
16649
16671
|
});
|
|
16650
|
-
const nonFilteredNodeIds = Object.keys(
|
|
16672
|
+
const nonFilteredNodeIds = Object.keys(nodeObjects).filter((id) => !filteredQuests.some((q) => String(q.id) === String(id)));
|
|
16651
16673
|
const COMMON_START_X = startX - 100;
|
|
16652
16674
|
const COMMON_COL_SPACING = 30;
|
|
16653
16675
|
const COMMON_ROW_SPACING = 35;
|
|
16654
16676
|
const MAX_COMMON_ROWS = 15;
|
|
16655
16677
|
nonFilteredNodeIds.forEach((id, idx) => {
|
|
16656
|
-
const mesh =
|
|
16678
|
+
const mesh = nodeObjects[id];
|
|
16657
16679
|
if (!mesh) return;
|
|
16658
16680
|
const col = Math.floor(idx / MAX_COMMON_ROWS);
|
|
16659
16681
|
const row = idx % MAX_COMMON_ROWS;
|
|
@@ -16679,7 +16701,7 @@ function XViewScene({
|
|
|
16679
16701
|
sideTween.start();
|
|
16680
16702
|
});
|
|
16681
16703
|
filteredQuests.forEach((q) => {
|
|
16682
|
-
const mesh =
|
|
16704
|
+
const mesh = nodeObjects[String(q.id)];
|
|
16683
16705
|
if (mesh) {
|
|
16684
16706
|
if (mesh.material) {
|
|
16685
16707
|
const fadeInTween = new Tween2(mesh.material).to({ opacity: 1 }, 1200).easing(Easing2.Cubic.Out);
|
|
@@ -16697,7 +16719,7 @@ function XViewScene({
|
|
|
16697
16719
|
const colX = startX + colIndex * QUEST_LENS_COLUMN_SPACING;
|
|
16698
16720
|
questsInCol.forEach((q, rowIndex) => {
|
|
16699
16721
|
const nodeId = String(q.id);
|
|
16700
|
-
let mesh =
|
|
16722
|
+
let mesh = nodeObjects[nodeId];
|
|
16701
16723
|
const timeInfo = questTimeInfos.get(nodeId) || { isUndated: true };
|
|
16702
16724
|
let targetY;
|
|
16703
16725
|
if (!timeInfo.isUndated) {
|
|
@@ -16843,8 +16865,8 @@ function XViewScene({
|
|
|
16843
16865
|
stateRef.current.timelineIntervalsGroup = timelineIntervalsGroup;
|
|
16844
16866
|
const graphData = sceneDataRef.current;
|
|
16845
16867
|
const nodePositions = calculateNodePositions(graphData.nodes);
|
|
16846
|
-
const
|
|
16847
|
-
stateRef.current.nodeObjects =
|
|
16868
|
+
const nodeObjects = {};
|
|
16869
|
+
stateRef.current.nodeObjects = nodeObjects;
|
|
16848
16870
|
stateRef.current.glowTexture = makeGlowTexture();
|
|
16849
16871
|
graphData.nodes.forEach((node) => {
|
|
16850
16872
|
const position = nodePositions[node.id] || new THREE3.Vector3();
|
|
@@ -16854,7 +16876,7 @@ function XViewScene({
|
|
|
16854
16876
|
mesh.userData.labelObject.position.copy(mesh.position).add(mesh.userData.labelOffset);
|
|
16855
16877
|
graphGroup.add(mesh.userData.labelObject);
|
|
16856
16878
|
}
|
|
16857
|
-
|
|
16879
|
+
nodeObjects[String(node.id)] = mesh;
|
|
16858
16880
|
stateRef.current.clickableNodes.push(mesh);
|
|
16859
16881
|
});
|
|
16860
16882
|
const linksGroupedByNodes = /* @__PURE__ */ new Map();
|
|
@@ -16866,8 +16888,8 @@ function XViewScene({
|
|
|
16866
16888
|
linksGroupedByNodes.get(pairKey).push(link);
|
|
16867
16889
|
});
|
|
16868
16890
|
linksGroupedByNodes.forEach((linksArray) => {
|
|
16869
|
-
const sourceNode =
|
|
16870
|
-
const targetNode =
|
|
16891
|
+
const sourceNode = nodeObjects[String(linksArray[0].source)];
|
|
16892
|
+
const targetNode = nodeObjects[String(linksArray[0].target)];
|
|
16871
16893
|
if (sourceNode && targetNode) {
|
|
16872
16894
|
const resolution = new THREE3.Vector2(
|
|
16873
16895
|
currentMount.clientWidth,
|
|
@@ -17199,15 +17221,11 @@ function XViewScene({
|
|
|
17199
17221
|
let newTree = addChildToNode(activeTree, parentId, fullNodeData);
|
|
17200
17222
|
setQuestTreeMode2((prev) => ({
|
|
17201
17223
|
...prev,
|
|
17202
|
-
[activeTreeKey]: newTree
|
|
17203
|
-
isAddingNodes: false,
|
|
17204
|
-
isAddingAbstractionNodes: false
|
|
17224
|
+
[activeTreeKey]: newTree
|
|
17205
17225
|
}));
|
|
17206
17226
|
} else {
|
|
17207
17227
|
setQuestTreeMode2((prev) => ({
|
|
17208
|
-
...prev
|
|
17209
|
-
isAddingNodes: false,
|
|
17210
|
-
isAddingAbstractionNodes: false
|
|
17228
|
+
...prev
|
|
17211
17229
|
}));
|
|
17212
17230
|
}
|
|
17213
17231
|
return;
|
|
@@ -18099,17 +18117,53 @@ function XViewScene({
|
|
|
18099
18117
|
const formattedTree = convertTreeToIds(newTree);
|
|
18100
18118
|
const formattedAbstractionTree = convertTreeToIds(newAbstractionTree);
|
|
18101
18119
|
if (questNodeId && sceneConfigId) {
|
|
18102
|
-
const sceneData =
|
|
18120
|
+
const sceneData = sceneDataRef.current;
|
|
18103
18121
|
if (sceneData && sceneData.quest_nodes) {
|
|
18104
18122
|
const questIndex = sceneData.quest_nodes.findIndex((q) => String(q.id) === String(questNodeId));
|
|
18105
18123
|
if (questIndex !== -1) {
|
|
18106
18124
|
sceneData.quest_nodes[questIndex].quest_tree = formattedTree;
|
|
18107
18125
|
sceneData.quest_nodes[questIndex].quest_abstraction_tree = formattedAbstractionTree;
|
|
18108
|
-
if (
|
|
18109
|
-
|
|
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);
|
|
18110
18164
|
}
|
|
18111
18165
|
const updatedNodeData = sceneData.quest_nodes[questIndex];
|
|
18112
|
-
const nodeMesh = nodeObjects[String(questNodeId)];
|
|
18166
|
+
const nodeMesh = (_a2 = stateRef.current.nodeObjects) == null ? void 0 : _a2[String(questNodeId)];
|
|
18113
18167
|
if (nodeMesh) {
|
|
18114
18168
|
nodeMesh.userData.questData = updatedNodeData;
|
|
18115
18169
|
}
|
|
@@ -18151,7 +18205,7 @@ function XViewScene({
|
|
|
18151
18205
|
};
|
|
18152
18206
|
const handleSaveQuestNode = async (context, newQuestData) => {
|
|
18153
18207
|
const {
|
|
18154
|
-
graphDataRef,
|
|
18208
|
+
graphDataRef: graphDataRef2,
|
|
18155
18209
|
sceneDataRef: sceneDataRef2,
|
|
18156
18210
|
stateRef: stateRef2,
|
|
18157
18211
|
setters,
|
|
@@ -18161,7 +18215,7 @@ function XViewScene({
|
|
|
18161
18215
|
sceneConfigId: sceneConfigId2,
|
|
18162
18216
|
ownerId: ownerId2
|
|
18163
18217
|
} = context;
|
|
18164
|
-
if (!
|
|
18218
|
+
if (!graphDataRef2.current || (viewType == null ? void 0 : viewType.toLowerCase()) !== "view") return;
|
|
18165
18219
|
const currentCounter = sceneDataRef2.current.quest_counter || 1;
|
|
18166
18220
|
const newNode = {
|
|
18167
18221
|
id: short2.generate(),
|
|
@@ -18169,14 +18223,14 @@ function XViewScene({
|
|
|
18169
18223
|
is_quest: true,
|
|
18170
18224
|
type: ["quest", ...newQuestData.type.filter((t) => t !== "quest")]
|
|
18171
18225
|
};
|
|
18172
|
-
if (!
|
|
18173
|
-
|
|
18226
|
+
if (!graphDataRef2.current[sceneConfigId2]) {
|
|
18227
|
+
graphDataRef2.current[sceneConfigId2] = { nodes: [], links: [] };
|
|
18174
18228
|
}
|
|
18175
|
-
|
|
18229
|
+
graphDataRef2.current[sceneConfigId2].nodes.push(newNode);
|
|
18176
18230
|
const sceneFileData = {
|
|
18177
18231
|
...sceneDataRef2.current,
|
|
18178
|
-
quest_nodes:
|
|
18179
|
-
quest_links:
|
|
18232
|
+
quest_nodes: graphDataRef2.current[sceneConfigId2].nodes,
|
|
18233
|
+
quest_links: graphDataRef2.current[sceneConfigId2].links,
|
|
18180
18234
|
quest_counter: currentCounter + 1
|
|
18181
18235
|
};
|
|
18182
18236
|
try {
|
|
@@ -18187,9 +18241,9 @@ function XViewScene({
|
|
|
18187
18241
|
ownerId: ownerId2,
|
|
18188
18242
|
datasetName: "Quests Internas (View)"
|
|
18189
18243
|
});
|
|
18190
|
-
sceneDataRef2.current.quest_nodes = [...
|
|
18244
|
+
sceneDataRef2.current.quest_nodes = [...graphDataRef2.current[sceneConfigId2].nodes];
|
|
18191
18245
|
if (parentDataRef.current[sceneConfigId2]) {
|
|
18192
|
-
parentDataRef.current[sceneConfigId2].nodes = [...
|
|
18246
|
+
parentDataRef.current[sceneConfigId2].nodes = [...graphDataRef2.current[sceneConfigId2].nodes];
|
|
18193
18247
|
}
|
|
18194
18248
|
const finalPosition = stateRef2.current.ghostElements.node ? stateRef2.current.ghostElements.node.position.clone() : stateRef2.current.controls.target.clone();
|
|
18195
18249
|
const { graphGroup, ghostElements } = stateRef2.current;
|
|
@@ -18211,26 +18265,26 @@ function XViewScene({
|
|
|
18211
18265
|
userActionHandlers.handleCompleteConnection = async (context, targetNodeData) => {
|
|
18212
18266
|
const {
|
|
18213
18267
|
stateRef: stateRef2,
|
|
18214
|
-
graphDataRef,
|
|
18268
|
+
graphDataRef: graphDataRef2,
|
|
18215
18269
|
sceneDataRef: sceneDataRef2,
|
|
18216
18270
|
sceneConfigId: sceneConfigId2,
|
|
18217
18271
|
sceneSaveUrl: sceneSaveUrl2,
|
|
18218
18272
|
ownerId: ownerId2
|
|
18219
18273
|
} = context;
|
|
18220
18274
|
const { sourceNodeData } = stateRef2.current.connection;
|
|
18221
|
-
if (!
|
|
18275
|
+
if (!graphDataRef2.current || !sceneDataRef2.current || !sourceNodeData || !targetNodeData) {
|
|
18222
18276
|
userActionHandlers.handleCancelConnection(context);
|
|
18223
18277
|
return;
|
|
18224
18278
|
}
|
|
18225
18279
|
const sourceParentInfo = getParentFileInfoForNode(
|
|
18226
|
-
|
|
18280
|
+
graphDataRef2.current,
|
|
18227
18281
|
sceneDataRef2.current,
|
|
18228
18282
|
sourceNodeData.id,
|
|
18229
18283
|
sceneConfigId2,
|
|
18230
18284
|
ownerId2
|
|
18231
18285
|
);
|
|
18232
18286
|
const targetParentInfo = getParentFileInfoForNode(
|
|
18233
|
-
|
|
18287
|
+
graphDataRef2.current,
|
|
18234
18288
|
sceneDataRef2.current,
|
|
18235
18289
|
targetNodeData.id,
|
|
18236
18290
|
sceneConfigId2,
|
|
@@ -18250,7 +18304,7 @@ function XViewScene({
|
|
|
18250
18304
|
};
|
|
18251
18305
|
try {
|
|
18252
18306
|
if (parentFileIdToSave === sceneConfigId2) {
|
|
18253
|
-
const specificParentData =
|
|
18307
|
+
const specificParentData = graphDataRef2.current[sceneConfigId2];
|
|
18254
18308
|
specificParentData.links.push(newLink);
|
|
18255
18309
|
const viewFilePayload = {
|
|
18256
18310
|
...sceneDataRef2.current,
|
|
@@ -18261,7 +18315,7 @@ function XViewScene({
|
|
|
18261
18315
|
await context.actions.save_view_data(sceneSaveUrl2, viewFilePayload);
|
|
18262
18316
|
} else {
|
|
18263
18317
|
const specificParentData = JSON.parse(
|
|
18264
|
-
JSON.stringify(
|
|
18318
|
+
JSON.stringify(graphDataRef2.current[parentFileIdToSave])
|
|
18265
18319
|
);
|
|
18266
18320
|
specificParentData.links.push(newLink);
|
|
18267
18321
|
const filenameForSpecificParent = `x_view_dbs/${ownerIdToSave}/${parentFileIdToSave}`;
|
|
@@ -18269,7 +18323,7 @@ function XViewScene({
|
|
|
18269
18323
|
filenameForSpecificParent,
|
|
18270
18324
|
specificParentData
|
|
18271
18325
|
);
|
|
18272
|
-
|
|
18326
|
+
graphDataRef2.current[parentFileIdToSave] = specificParentData;
|
|
18273
18327
|
}
|
|
18274
18328
|
addNewLinkToScene(stateRef2.current, newLink);
|
|
18275
18329
|
} catch (error) {
|
|
@@ -18316,7 +18370,7 @@ function XViewScene({
|
|
|
18316
18370
|
}
|
|
18317
18371
|
});
|
|
18318
18372
|
}
|
|
18319
|
-
const { ancestryGroup, nodeObjects
|
|
18373
|
+
const { ancestryGroup, nodeObjects, renderer, renderedAncestries } = stateRef.current;
|
|
18320
18374
|
const currentRenderLimit = stateRef.current.maxAncestryRenderIndex || 0;
|
|
18321
18375
|
const isFullRenderRequest = !normalizedAllowedIds;
|
|
18322
18376
|
const checkShouldRender = (section) => {
|
|
@@ -18420,10 +18474,10 @@ function XViewScene({
|
|
|
18420
18474
|
);
|
|
18421
18475
|
if (!fullTree) return;
|
|
18422
18476
|
const rootNodeId = String(ancestryObject.ancestral_node);
|
|
18423
|
-
let rootNodeMesh =
|
|
18477
|
+
let rootNodeMesh = nodeObjects[rootNodeId];
|
|
18424
18478
|
let originMesh = null;
|
|
18425
18479
|
if (ancestryObject._originNodeId) {
|
|
18426
|
-
originMesh =
|
|
18480
|
+
originMesh = nodeObjects[String(ancestryObject._originNodeId)];
|
|
18427
18481
|
}
|
|
18428
18482
|
let rootTargetPos = null;
|
|
18429
18483
|
if (originMesh) {
|
|
@@ -18637,7 +18691,7 @@ function XViewScene({
|
|
|
18637
18691
|
} else {
|
|
18638
18692
|
const traverseAndCollect = (item) => {
|
|
18639
18693
|
if (item.node) {
|
|
18640
|
-
const mesh =
|
|
18694
|
+
const mesh = nodeObjects[String(item.node.id)];
|
|
18641
18695
|
if (mesh) allRenderedNodePositions.push(mesh.position.clone());
|
|
18642
18696
|
}
|
|
18643
18697
|
if (item.children) item.children.forEach(traverseAndCollect);
|
|
@@ -18685,7 +18739,7 @@ function XViewScene({
|
|
|
18685
18739
|
const nodeIds = collectNodeIdsInSection(targetSectionForZone);
|
|
18686
18740
|
const vectors = [];
|
|
18687
18741
|
nodeIds.forEach((id) => {
|
|
18688
|
-
const mesh =
|
|
18742
|
+
const mesh = nodeObjects[String(id)];
|
|
18689
18743
|
if (mesh) {
|
|
18690
18744
|
const targetPos = targetPositionsCache.get(String(id));
|
|
18691
18745
|
vectors.push(targetPos ? targetPos.clone() : mesh.position.clone());
|
|
@@ -18744,8 +18798,8 @@ function XViewScene({
|
|
|
18744
18798
|
focusTargetPosition = targetPositionsCache.get(anchorId) || currentAnchorMesh.position.clone();
|
|
18745
18799
|
focusTargetRotation = baseRotation;
|
|
18746
18800
|
}
|
|
18747
|
-
} else if (activeSectionIdForFocus &&
|
|
18748
|
-
const directNode =
|
|
18801
|
+
} else if (activeSectionIdForFocus && nodeObjects[String(activeSectionIdForFocus)]) {
|
|
18802
|
+
const directNode = nodeObjects[String(activeSectionIdForFocus)];
|
|
18749
18803
|
const tPos = targetPositionsCache.get(String(activeSectionIdForFocus));
|
|
18750
18804
|
focusTargetPosition = tPos ? tPos.clone() : directNode.position.clone();
|
|
18751
18805
|
focusTargetRotation = baseRotation;
|
|
@@ -18796,7 +18850,7 @@ function XViewScene({
|
|
|
18796
18850
|
(prev) => prev.visible ? { ...prev, visible: false } : prev
|
|
18797
18851
|
);
|
|
18798
18852
|
if (!ancestryObject || !ancestryObject.abstraction_tree) return;
|
|
18799
|
-
const { ancestryGroup, nodeObjects
|
|
18853
|
+
const { ancestryGroup, nodeObjects, renderer, renderedAncestries } = stateRef.current;
|
|
18800
18854
|
const allParentNodes = Object.values(parentDataRef.current).flatMap(
|
|
18801
18855
|
(f) => f.nodes
|
|
18802
18856
|
);
|
|
@@ -18837,7 +18891,7 @@ function XViewScene({
|
|
|
18837
18891
|
const ancestryEntry = { id: absId, lines: [], isFullRender: true };
|
|
18838
18892
|
renderedAncestries.push(ancestryEntry);
|
|
18839
18893
|
const rootNodeId = String(fullTree.node.id);
|
|
18840
|
-
let rootNodeMesh =
|
|
18894
|
+
let rootNodeMesh = nodeObjects[rootNodeId];
|
|
18841
18895
|
let rootTargetPos = rootNodeMesh ? rootNodeMesh.position.clone() : new THREE3.Vector3(0, 0, 0);
|
|
18842
18896
|
if (!rootNodeMesh) {
|
|
18843
18897
|
rootNodeMesh = addOrUpdateNodeMesh(fullTree.node, rootTargetPos, true);
|
|
@@ -19949,8 +20003,8 @@ function XViewScene({
|
|
|
19949
20003
|
setSceneVersion((v) => v + 1);
|
|
19950
20004
|
const isView = ((_a2 = viewParams == null ? void 0 : viewParams.type) == null ? void 0 : _a2.toLowerCase()) === "view";
|
|
19951
20005
|
if (!isView || !save_view_data || !sceneSaveUrl) return;
|
|
19952
|
-
const { nodeObjects
|
|
19953
|
-
const currentNodes = Object.values(
|
|
20006
|
+
const { nodeObjects, allLinks } = stateRef.current;
|
|
20007
|
+
const currentNodes = Object.values(nodeObjects || {}).map((mesh) => {
|
|
19954
20008
|
const {
|
|
19955
20009
|
_baseEmissiveIntensity,
|
|
19956
20010
|
labelObject,
|
|
@@ -19989,15 +20043,15 @@ function XViewScene({
|
|
|
19989
20043
|
);
|
|
19990
20044
|
const handleSaveCurrentView = useCallback7(async () => {
|
|
19991
20045
|
var _a2, _b2, _c2;
|
|
19992
|
-
const { nodeObjects
|
|
19993
|
-
if (!
|
|
20046
|
+
const { nodeObjects, allLinks } = stateRef.current;
|
|
20047
|
+
if (!nodeObjects || !allLinks || !sceneSaveUrl || !parentDataRef.current) {
|
|
19994
20048
|
console.warn(
|
|
19995
20049
|
"N\xE3o \xE9 poss\xEDvel salvar a cena: estado n\xE3o inicializado ou URL de salvamento ausente."
|
|
19996
20050
|
);
|
|
19997
20051
|
return;
|
|
19998
20052
|
}
|
|
19999
20053
|
if (!save_view_data) return;
|
|
20000
|
-
const currentNodes = Object.values(
|
|
20054
|
+
const currentNodes = Object.values(nodeObjects).map((mesh) => {
|
|
20001
20055
|
const {
|
|
20002
20056
|
_baseEmissiveIntensity,
|
|
20003
20057
|
labelObject,
|
|
@@ -20052,8 +20106,8 @@ function XViewScene({
|
|
|
20052
20106
|
const detailsNodeDatasetInfo = detailsNode ? stateRef.current.nodeIdToParentFileMap.get(String(detailsNode.id)) : null;
|
|
20053
20107
|
useEffect25(() => {
|
|
20054
20108
|
if (isInitialized && focusNodeId && !hasFocusedInitial) {
|
|
20055
|
-
const
|
|
20056
|
-
const targetMesh =
|
|
20109
|
+
const nodeObjects = stateRef.current.nodeObjects || {};
|
|
20110
|
+
const targetMesh = nodeObjects[String(focusNodeId)];
|
|
20057
20111
|
if (targetMesh) {
|
|
20058
20112
|
setTimeout(() => {
|
|
20059
20113
|
tweenToTarget(targetMesh, 1.2);
|
|
@@ -20142,10 +20196,10 @@ function XViewScene({
|
|
|
20142
20196
|
if (isUiClear) {
|
|
20143
20197
|
const isView = ((_c2 = viewParams == null ? void 0 : viewParams.type) == null ? void 0 : _c2.toLowerCase()) === "view";
|
|
20144
20198
|
if (!isView) return;
|
|
20145
|
-
const { graphGroup, glowTexture, controls: sceneControls, nodeObjects
|
|
20199
|
+
const { graphGroup, glowTexture, controls: sceneControls, nodeObjects } = stateRef.current;
|
|
20146
20200
|
if (graphGroup) {
|
|
20147
20201
|
let ghostPosition = sceneControls.target.clone();
|
|
20148
|
-
const existingNodes = Object.values(
|
|
20202
|
+
const existingNodes = Object.values(nodeObjects);
|
|
20149
20203
|
let isOccupied = true;
|
|
20150
20204
|
let radius = 18;
|
|
20151
20205
|
let angle = 0;
|