@lv-x-software-house/x_view 1.2.4-dev.7 → 1.2.4-dev.9
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 +25 -43
- package/dist/index.mjs +25 -43
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1559,7 +1559,7 @@ var addStandaloneNodeToScene = (state, nodeData, position) => {
|
|
|
1559
1559
|
scaleTween.start();
|
|
1560
1560
|
}
|
|
1561
1561
|
};
|
|
1562
|
-
var getParentFileInfoForNode = (allParentData, sceneData, nodeId) => {
|
|
1562
|
+
var getParentFileInfoForNode = (allParentData, sceneData, nodeId, sceneConfigId = null, sceneOwnerId = null) => {
|
|
1563
1563
|
const parentDbsArray = (sceneData == null ? void 0 : sceneData.parent_dbs) || [];
|
|
1564
1564
|
for (const parentFileId in allParentData) {
|
|
1565
1565
|
if (allParentData.hasOwnProperty(parentFileId)) {
|
|
@@ -1568,6 +1568,8 @@ var getParentFileInfoForNode = (allParentData, sceneData, nodeId) => {
|
|
|
1568
1568
|
const parentDbInfo = parentDbsArray.find((db) => String(db.db_id) === String(parentFileId));
|
|
1569
1569
|
if (parentDbInfo) {
|
|
1570
1570
|
return { parentFileId, ownerId: parentDbInfo.owner_id };
|
|
1571
|
+
} else if (sceneConfigId && String(parentFileId) === String(sceneConfigId)) {
|
|
1572
|
+
return { parentFileId, ownerId: sceneOwnerId };
|
|
1571
1573
|
} else {
|
|
1572
1574
|
console.warn(`Owner ID n\xE3o encontrado em sceneData.parent_dbs para o parentFileId: ${parentFileId}`);
|
|
1573
1575
|
return { parentFileId, ownerId: null };
|
|
@@ -1846,7 +1848,7 @@ var userActionHandlers = {
|
|
|
1846
1848
|
version_node: { is_version: true, parent_node: sourceNodeData.id }
|
|
1847
1849
|
};
|
|
1848
1850
|
const newLink = { id: `link_${import_short_uuid.default.generate()}`, source: sourceNodeData.id, target: newNode.id };
|
|
1849
|
-
const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, sourceNodeData.id);
|
|
1851
|
+
const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, sourceNodeData.id, context.sceneConfigId, context.ownerId);
|
|
1850
1852
|
if (!parentInfo || !parentInfo.ownerId) {
|
|
1851
1853
|
console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node de origem:", sourceNodeData.id);
|
|
1852
1854
|
alert("Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio.");
|
|
@@ -2022,7 +2024,7 @@ var userActionHandlers = {
|
|
|
2022
2024
|
userActionHandlers.handleCancelConnection(context);
|
|
2023
2025
|
return;
|
|
2024
2026
|
}
|
|
2025
|
-
const sourceParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, sourceNodeData.id);
|
|
2027
|
+
const sourceParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, sourceNodeData.id, context.sceneConfigId, context.ownerId);
|
|
2026
2028
|
if (!sourceParentInfo || !sourceParentInfo.ownerId) {
|
|
2027
2029
|
console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node de origem:", sourceNodeData.id);
|
|
2028
2030
|
alert("Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio.");
|
|
@@ -2111,8 +2113,8 @@ var userActionHandlers = {
|
|
|
2111
2113
|
} else {
|
|
2112
2114
|
newTargetId = newEndNodeData.id;
|
|
2113
2115
|
}
|
|
2114
|
-
const originalParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, oldSourceId);
|
|
2115
|
-
const newParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, newSourceId);
|
|
2116
|
+
const originalParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, oldSourceId, context.sceneConfigId, context.ownerId);
|
|
2117
|
+
const newParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, newSourceId, context.sceneConfigId, context.ownerId);
|
|
2116
2118
|
if (!originalParentInfo || !newParentInfo || !originalParentInfo.ownerId || !newParentInfo.ownerId) {
|
|
2117
2119
|
console.error("N\xE3o foi poss\xEDvel encontrar informa\xE7\xF5es dos arquivos pai para o relink.");
|
|
2118
2120
|
alert("Ocorreu um erro ao identificar os arquivos pai para salvar a altera\xE7\xE3o.");
|
|
@@ -2180,7 +2182,7 @@ var userActionHandlers = {
|
|
|
2180
2182
|
console.error("Tentativa de deletar um link sem ID.", linkObject.userData);
|
|
2181
2183
|
return;
|
|
2182
2184
|
}
|
|
2183
|
-
const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, linkObject.userData.source);
|
|
2185
|
+
const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, linkObject.userData.source, context.sceneConfigId, context.ownerId);
|
|
2184
2186
|
if (!parentInfo || !parentInfo.ownerId) {
|
|
2185
2187
|
console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o link:", linkIdToDelete);
|
|
2186
2188
|
alert("Ocorreu um erro ao identificar o arquivo pai da rela\xE7\xE3o para exclus\xE3o.");
|
|
@@ -2372,7 +2374,7 @@ var userActionHandlers = {
|
|
|
2372
2374
|
}
|
|
2373
2375
|
const changesByParentFile = {};
|
|
2374
2376
|
for (const nodeId of strNodeIdsToDelete) {
|
|
2375
|
-
const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeId);
|
|
2377
|
+
const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeId, context.sceneConfigId, context.ownerId);
|
|
2376
2378
|
if (!parentInfo || !parentInfo.ownerId) {
|
|
2377
2379
|
console.warn(`Node com ID ${nodeId} n\xE3o encontrado ou sem ownerId. Ignorando.`);
|
|
2378
2380
|
continue;
|
|
@@ -2457,7 +2459,7 @@ var userActionHandlers = {
|
|
|
2457
2459
|
if (!nodeData || !graphDataRef.current || !sceneDataRef.current) return;
|
|
2458
2460
|
const nodeIdToDelete = nodeData.id;
|
|
2459
2461
|
const strNodeId = String(nodeIdToDelete);
|
|
2460
|
-
const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeIdToDelete);
|
|
2462
|
+
const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeIdToDelete, context.sceneConfigId, context.ownerId);
|
|
2461
2463
|
if (!parentInfo || !parentInfo.ownerId) {
|
|
2462
2464
|
console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node a ser exclu\xEDdo:", nodeIdToDelete);
|
|
2463
2465
|
alert("Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio para exclus\xE3o.");
|
|
@@ -2503,7 +2505,7 @@ var userActionHandlers = {
|
|
|
2503
2505
|
const { graphDataRef, sceneDataRef, stateRef, setters } = context;
|
|
2504
2506
|
if (!graphDataRef.current || !sceneDataRef.current) return;
|
|
2505
2507
|
const { _baseEmissiveIntensity: ignored, ...nodeToSave } = updatedNode;
|
|
2506
|
-
const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeToSave.id);
|
|
2508
|
+
const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeToSave.id, context.sceneConfigId, context.ownerId);
|
|
2507
2509
|
if (!parentInfo || !parentInfo.ownerId) {
|
|
2508
2510
|
console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node a ser atualizado:", nodeToSave.id);
|
|
2509
2511
|
alert("Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio para atualiza\xE7\xE3o.");
|
|
@@ -2537,7 +2539,7 @@ var userActionHandlers = {
|
|
|
2537
2539
|
const { graphDataRef, sceneDataRef, stateRef, setters } = context;
|
|
2538
2540
|
if (!graphDataRef.current || !sceneDataRef.current) return;
|
|
2539
2541
|
const { sourceNode, targetNode, ...linkToSave } = updatedLink;
|
|
2540
|
-
const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, linkToSave.source);
|
|
2542
|
+
const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, linkToSave.source, context.sceneConfigId, context.ownerId);
|
|
2541
2543
|
if (!parentInfo || !parentInfo.ownerId) {
|
|
2542
2544
|
console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o link a ser atualizado:", linkToSave.id);
|
|
2543
2545
|
alert("Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio para atualiza\xE7\xE3o.");
|
|
@@ -11524,15 +11526,10 @@ function XViewScene({
|
|
|
11524
11526
|
creationMode,
|
|
11525
11527
|
versionMode,
|
|
11526
11528
|
questMode,
|
|
11527
|
-
// <-- Adicionado
|
|
11528
11529
|
sceneSaveUrl,
|
|
11529
|
-
// <-- Adicionado
|
|
11530
11530
|
sceneConfigId,
|
|
11531
|
-
// <-- Adicionado
|
|
11532
11531
|
ownerId,
|
|
11533
|
-
// <-- Adicionado
|
|
11534
11532
|
viewType: viewParams == null ? void 0 : viewParams.type,
|
|
11535
|
-
// <-- Adicionado
|
|
11536
11533
|
userId: (_a2 = session == null ? void 0 : session.user) == null ? void 0 : _a2.id,
|
|
11537
11534
|
setters: {
|
|
11538
11535
|
setContextMenu,
|
|
@@ -11546,7 +11543,6 @@ function XViewScene({
|
|
|
11546
11543
|
setSceneVersion,
|
|
11547
11544
|
setAncestryMode,
|
|
11548
11545
|
setQuestMode
|
|
11549
|
-
// <-- Adicionado
|
|
11550
11546
|
},
|
|
11551
11547
|
tweenToTarget,
|
|
11552
11548
|
handleVersionTimeline,
|
|
@@ -11593,20 +11589,12 @@ function XViewScene({
|
|
|
11593
11589
|
graphDataRef.current[sceneConfigId2] = { nodes: [], links: [] };
|
|
11594
11590
|
}
|
|
11595
11591
|
graphDataRef.current[sceneConfigId2].nodes.push(newNode);
|
|
11596
|
-
sceneDataRef2.current.nodes.push(newNode);
|
|
11597
|
-
const currentVisualNodes = Object.values(stateRef2.current.nodeObjects).map((mesh) => {
|
|
11598
|
-
const { _baseEmissiveIntensity, labelObject, labelOffset, timelineIntervalBar, timelineEndLabel, ...rest } = mesh.userData;
|
|
11599
|
-
return rest;
|
|
11600
|
-
});
|
|
11601
|
-
currentVisualNodes.push(newNode);
|
|
11602
|
-
const currentVisualLinks = stateRef2.current.allLinks.map((line) => {
|
|
11603
|
-
const { sourceNode, targetNode, ...rest } = line.userData;
|
|
11604
|
-
return rest;
|
|
11605
|
-
});
|
|
11606
11592
|
const sceneFileData = {
|
|
11607
11593
|
parent_dbs: sceneDataRef2.current.parent_dbs,
|
|
11608
|
-
nodes:
|
|
11609
|
-
|
|
11594
|
+
nodes: sceneDataRef2.current.nodes,
|
|
11595
|
+
// <-- Mantém o cenário inicial inalterado
|
|
11596
|
+
links: sceneDataRef2.current.links,
|
|
11597
|
+
// <-- Mantém o cenário inicial inalterado
|
|
11610
11598
|
quest_nodes: graphDataRef.current[sceneConfigId2].nodes,
|
|
11611
11599
|
quest_links: graphDataRef.current[sceneConfigId2].links
|
|
11612
11600
|
};
|
|
@@ -11630,14 +11618,14 @@ function XViewScene({
|
|
|
11630
11618
|
}
|
|
11631
11619
|
};
|
|
11632
11620
|
userActionHandlers.handleCompleteConnection = async (context, targetNodeData) => {
|
|
11633
|
-
const { stateRef: stateRef2, graphDataRef, sceneDataRef: sceneDataRef2, sceneConfigId: sceneConfigId2, sceneSaveUrl: sceneSaveUrl2 } = context;
|
|
11621
|
+
const { stateRef: stateRef2, graphDataRef, sceneDataRef: sceneDataRef2, sceneConfigId: sceneConfigId2, sceneSaveUrl: sceneSaveUrl2, ownerId: ownerId2 } = context;
|
|
11634
11622
|
const { sourceNodeData } = stateRef2.current.connection;
|
|
11635
11623
|
if (!graphDataRef.current || !sceneDataRef2.current || !sourceNodeData || !targetNodeData) {
|
|
11636
11624
|
userActionHandlers.handleCancelConnection(context);
|
|
11637
11625
|
return;
|
|
11638
11626
|
}
|
|
11639
|
-
const sourceParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef2.current, sourceNodeData.id);
|
|
11640
|
-
const targetParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef2.current, targetNodeData.id);
|
|
11627
|
+
const sourceParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef2.current, sourceNodeData.id, sceneConfigId2, ownerId2);
|
|
11628
|
+
const targetParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef2.current, targetNodeData.id, sceneConfigId2, ownerId2);
|
|
11641
11629
|
let parentInfoToSave = sourceParentInfo;
|
|
11642
11630
|
if (sourceParentInfo.parentFileId === sceneConfigId2 && targetParentInfo.parentFileId !== sceneConfigId2) {
|
|
11643
11631
|
parentInfoToSave = targetParentInfo;
|
|
@@ -11654,19 +11642,12 @@ function XViewScene({
|
|
|
11654
11642
|
if (parentFileIdToSave === sceneConfigId2) {
|
|
11655
11643
|
const specificParentData = graphDataRef.current[sceneConfigId2];
|
|
11656
11644
|
specificParentData.links.push(newLink);
|
|
11657
|
-
const currentVisualNodes = Object.values(stateRef2.current.nodeObjects).map((m) => {
|
|
11658
|
-
const { _baseEmissiveIntensity, labelObject, labelOffset, timelineIntervalBar, timelineEndLabel, ...rest } = m.userData;
|
|
11659
|
-
return rest;
|
|
11660
|
-
});
|
|
11661
|
-
const currentVisualLinks = stateRef2.current.allLinks.map((l) => {
|
|
11662
|
-
const { sourceNode, targetNode, ...rest } = l.userData;
|
|
11663
|
-
return rest;
|
|
11664
|
-
});
|
|
11665
|
-
currentVisualLinks.push(newLink);
|
|
11666
11645
|
const viewFilePayload = {
|
|
11667
11646
|
parent_dbs: sceneDataRef2.current.parent_dbs,
|
|
11668
|
-
nodes:
|
|
11669
|
-
|
|
11647
|
+
nodes: sceneDataRef2.current.nodes,
|
|
11648
|
+
// <-- Usa o estado original intocado
|
|
11649
|
+
links: sceneDataRef2.current.links,
|
|
11650
|
+
// <-- Usa o estado original intocado
|
|
11670
11651
|
quest_nodes: specificParentData.nodes,
|
|
11671
11652
|
quest_links: specificParentData.links
|
|
11672
11653
|
// Salva a conexão aqui!
|
|
@@ -12975,11 +12956,12 @@ function XViewScene({
|
|
|
12975
12956
|
const { sourceNode, targetNode, ...serializableLinkData } = line.userData;
|
|
12976
12957
|
return serializableLinkData;
|
|
12977
12958
|
});
|
|
12959
|
+
sceneDataRef.current.nodes = currentNodes;
|
|
12960
|
+
sceneDataRef.current.links = currentLinks;
|
|
12978
12961
|
const sceneFileData = {
|
|
12979
12962
|
parent_dbs: sceneDataRef.current.parent_dbs,
|
|
12980
12963
|
nodes: currentNodes,
|
|
12981
12964
|
links: currentLinks,
|
|
12982
|
-
// --- ADICIONE ESTAS DUAS LINHAS PARA PRESERVAR A FONTE DA VERDADE ---
|
|
12983
12965
|
quest_nodes: ((_a2 = parentDataRef.current[sceneConfigId]) == null ? void 0 : _a2.nodes) || [],
|
|
12984
12966
|
quest_links: ((_b2 = parentDataRef.current[sceneConfigId]) == null ? void 0 : _b2.links) || []
|
|
12985
12967
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -1515,7 +1515,7 @@ var addStandaloneNodeToScene = (state, nodeData, position) => {
|
|
|
1515
1515
|
scaleTween.start();
|
|
1516
1516
|
}
|
|
1517
1517
|
};
|
|
1518
|
-
var getParentFileInfoForNode = (allParentData, sceneData, nodeId) => {
|
|
1518
|
+
var getParentFileInfoForNode = (allParentData, sceneData, nodeId, sceneConfigId = null, sceneOwnerId = null) => {
|
|
1519
1519
|
const parentDbsArray = (sceneData == null ? void 0 : sceneData.parent_dbs) || [];
|
|
1520
1520
|
for (const parentFileId in allParentData) {
|
|
1521
1521
|
if (allParentData.hasOwnProperty(parentFileId)) {
|
|
@@ -1524,6 +1524,8 @@ var getParentFileInfoForNode = (allParentData, sceneData, nodeId) => {
|
|
|
1524
1524
|
const parentDbInfo = parentDbsArray.find((db) => String(db.db_id) === String(parentFileId));
|
|
1525
1525
|
if (parentDbInfo) {
|
|
1526
1526
|
return { parentFileId, ownerId: parentDbInfo.owner_id };
|
|
1527
|
+
} else if (sceneConfigId && String(parentFileId) === String(sceneConfigId)) {
|
|
1528
|
+
return { parentFileId, ownerId: sceneOwnerId };
|
|
1527
1529
|
} else {
|
|
1528
1530
|
console.warn(`Owner ID n\xE3o encontrado em sceneData.parent_dbs para o parentFileId: ${parentFileId}`);
|
|
1529
1531
|
return { parentFileId, ownerId: null };
|
|
@@ -1802,7 +1804,7 @@ var userActionHandlers = {
|
|
|
1802
1804
|
version_node: { is_version: true, parent_node: sourceNodeData.id }
|
|
1803
1805
|
};
|
|
1804
1806
|
const newLink = { id: `link_${short.generate()}`, source: sourceNodeData.id, target: newNode.id };
|
|
1805
|
-
const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, sourceNodeData.id);
|
|
1807
|
+
const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, sourceNodeData.id, context.sceneConfigId, context.ownerId);
|
|
1806
1808
|
if (!parentInfo || !parentInfo.ownerId) {
|
|
1807
1809
|
console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node de origem:", sourceNodeData.id);
|
|
1808
1810
|
alert("Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio.");
|
|
@@ -1978,7 +1980,7 @@ var userActionHandlers = {
|
|
|
1978
1980
|
userActionHandlers.handleCancelConnection(context);
|
|
1979
1981
|
return;
|
|
1980
1982
|
}
|
|
1981
|
-
const sourceParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, sourceNodeData.id);
|
|
1983
|
+
const sourceParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, sourceNodeData.id, context.sceneConfigId, context.ownerId);
|
|
1982
1984
|
if (!sourceParentInfo || !sourceParentInfo.ownerId) {
|
|
1983
1985
|
console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node de origem:", sourceNodeData.id);
|
|
1984
1986
|
alert("Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio.");
|
|
@@ -2067,8 +2069,8 @@ var userActionHandlers = {
|
|
|
2067
2069
|
} else {
|
|
2068
2070
|
newTargetId = newEndNodeData.id;
|
|
2069
2071
|
}
|
|
2070
|
-
const originalParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, oldSourceId);
|
|
2071
|
-
const newParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, newSourceId);
|
|
2072
|
+
const originalParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, oldSourceId, context.sceneConfigId, context.ownerId);
|
|
2073
|
+
const newParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, newSourceId, context.sceneConfigId, context.ownerId);
|
|
2072
2074
|
if (!originalParentInfo || !newParentInfo || !originalParentInfo.ownerId || !newParentInfo.ownerId) {
|
|
2073
2075
|
console.error("N\xE3o foi poss\xEDvel encontrar informa\xE7\xF5es dos arquivos pai para o relink.");
|
|
2074
2076
|
alert("Ocorreu um erro ao identificar os arquivos pai para salvar a altera\xE7\xE3o.");
|
|
@@ -2136,7 +2138,7 @@ var userActionHandlers = {
|
|
|
2136
2138
|
console.error("Tentativa de deletar um link sem ID.", linkObject.userData);
|
|
2137
2139
|
return;
|
|
2138
2140
|
}
|
|
2139
|
-
const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, linkObject.userData.source);
|
|
2141
|
+
const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, linkObject.userData.source, context.sceneConfigId, context.ownerId);
|
|
2140
2142
|
if (!parentInfo || !parentInfo.ownerId) {
|
|
2141
2143
|
console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o link:", linkIdToDelete);
|
|
2142
2144
|
alert("Ocorreu um erro ao identificar o arquivo pai da rela\xE7\xE3o para exclus\xE3o.");
|
|
@@ -2328,7 +2330,7 @@ var userActionHandlers = {
|
|
|
2328
2330
|
}
|
|
2329
2331
|
const changesByParentFile = {};
|
|
2330
2332
|
for (const nodeId of strNodeIdsToDelete) {
|
|
2331
|
-
const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeId);
|
|
2333
|
+
const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeId, context.sceneConfigId, context.ownerId);
|
|
2332
2334
|
if (!parentInfo || !parentInfo.ownerId) {
|
|
2333
2335
|
console.warn(`Node com ID ${nodeId} n\xE3o encontrado ou sem ownerId. Ignorando.`);
|
|
2334
2336
|
continue;
|
|
@@ -2413,7 +2415,7 @@ var userActionHandlers = {
|
|
|
2413
2415
|
if (!nodeData || !graphDataRef.current || !sceneDataRef.current) return;
|
|
2414
2416
|
const nodeIdToDelete = nodeData.id;
|
|
2415
2417
|
const strNodeId = String(nodeIdToDelete);
|
|
2416
|
-
const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeIdToDelete);
|
|
2418
|
+
const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeIdToDelete, context.sceneConfigId, context.ownerId);
|
|
2417
2419
|
if (!parentInfo || !parentInfo.ownerId) {
|
|
2418
2420
|
console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node a ser exclu\xEDdo:", nodeIdToDelete);
|
|
2419
2421
|
alert("Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio para exclus\xE3o.");
|
|
@@ -2459,7 +2461,7 @@ var userActionHandlers = {
|
|
|
2459
2461
|
const { graphDataRef, sceneDataRef, stateRef, setters } = context;
|
|
2460
2462
|
if (!graphDataRef.current || !sceneDataRef.current) return;
|
|
2461
2463
|
const { _baseEmissiveIntensity: ignored, ...nodeToSave } = updatedNode;
|
|
2462
|
-
const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeToSave.id);
|
|
2464
|
+
const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeToSave.id, context.sceneConfigId, context.ownerId);
|
|
2463
2465
|
if (!parentInfo || !parentInfo.ownerId) {
|
|
2464
2466
|
console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node a ser atualizado:", nodeToSave.id);
|
|
2465
2467
|
alert("Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio para atualiza\xE7\xE3o.");
|
|
@@ -2493,7 +2495,7 @@ var userActionHandlers = {
|
|
|
2493
2495
|
const { graphDataRef, sceneDataRef, stateRef, setters } = context;
|
|
2494
2496
|
if (!graphDataRef.current || !sceneDataRef.current) return;
|
|
2495
2497
|
const { sourceNode, targetNode, ...linkToSave } = updatedLink;
|
|
2496
|
-
const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, linkToSave.source);
|
|
2498
|
+
const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, linkToSave.source, context.sceneConfigId, context.ownerId);
|
|
2497
2499
|
if (!parentInfo || !parentInfo.ownerId) {
|
|
2498
2500
|
console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o link a ser atualizado:", linkToSave.id);
|
|
2499
2501
|
alert("Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio para atualiza\xE7\xE3o.");
|
|
@@ -11524,15 +11526,10 @@ function XViewScene({
|
|
|
11524
11526
|
creationMode,
|
|
11525
11527
|
versionMode,
|
|
11526
11528
|
questMode,
|
|
11527
|
-
// <-- Adicionado
|
|
11528
11529
|
sceneSaveUrl,
|
|
11529
|
-
// <-- Adicionado
|
|
11530
11530
|
sceneConfigId,
|
|
11531
|
-
// <-- Adicionado
|
|
11532
11531
|
ownerId,
|
|
11533
|
-
// <-- Adicionado
|
|
11534
11532
|
viewType: viewParams == null ? void 0 : viewParams.type,
|
|
11535
|
-
// <-- Adicionado
|
|
11536
11533
|
userId: (_a2 = session == null ? void 0 : session.user) == null ? void 0 : _a2.id,
|
|
11537
11534
|
setters: {
|
|
11538
11535
|
setContextMenu,
|
|
@@ -11546,7 +11543,6 @@ function XViewScene({
|
|
|
11546
11543
|
setSceneVersion,
|
|
11547
11544
|
setAncestryMode,
|
|
11548
11545
|
setQuestMode
|
|
11549
|
-
// <-- Adicionado
|
|
11550
11546
|
},
|
|
11551
11547
|
tweenToTarget,
|
|
11552
11548
|
handleVersionTimeline,
|
|
@@ -11593,20 +11589,12 @@ function XViewScene({
|
|
|
11593
11589
|
graphDataRef.current[sceneConfigId2] = { nodes: [], links: [] };
|
|
11594
11590
|
}
|
|
11595
11591
|
graphDataRef.current[sceneConfigId2].nodes.push(newNode);
|
|
11596
|
-
sceneDataRef2.current.nodes.push(newNode);
|
|
11597
|
-
const currentVisualNodes = Object.values(stateRef2.current.nodeObjects).map((mesh) => {
|
|
11598
|
-
const { _baseEmissiveIntensity, labelObject, labelOffset, timelineIntervalBar, timelineEndLabel, ...rest } = mesh.userData;
|
|
11599
|
-
return rest;
|
|
11600
|
-
});
|
|
11601
|
-
currentVisualNodes.push(newNode);
|
|
11602
|
-
const currentVisualLinks = stateRef2.current.allLinks.map((line) => {
|
|
11603
|
-
const { sourceNode, targetNode, ...rest } = line.userData;
|
|
11604
|
-
return rest;
|
|
11605
|
-
});
|
|
11606
11592
|
const sceneFileData = {
|
|
11607
11593
|
parent_dbs: sceneDataRef2.current.parent_dbs,
|
|
11608
|
-
nodes:
|
|
11609
|
-
|
|
11594
|
+
nodes: sceneDataRef2.current.nodes,
|
|
11595
|
+
// <-- Mantém o cenário inicial inalterado
|
|
11596
|
+
links: sceneDataRef2.current.links,
|
|
11597
|
+
// <-- Mantém o cenário inicial inalterado
|
|
11610
11598
|
quest_nodes: graphDataRef.current[sceneConfigId2].nodes,
|
|
11611
11599
|
quest_links: graphDataRef.current[sceneConfigId2].links
|
|
11612
11600
|
};
|
|
@@ -11630,14 +11618,14 @@ function XViewScene({
|
|
|
11630
11618
|
}
|
|
11631
11619
|
};
|
|
11632
11620
|
userActionHandlers.handleCompleteConnection = async (context, targetNodeData) => {
|
|
11633
|
-
const { stateRef: stateRef2, graphDataRef, sceneDataRef: sceneDataRef2, sceneConfigId: sceneConfigId2, sceneSaveUrl: sceneSaveUrl2 } = context;
|
|
11621
|
+
const { stateRef: stateRef2, graphDataRef, sceneDataRef: sceneDataRef2, sceneConfigId: sceneConfigId2, sceneSaveUrl: sceneSaveUrl2, ownerId: ownerId2 } = context;
|
|
11634
11622
|
const { sourceNodeData } = stateRef2.current.connection;
|
|
11635
11623
|
if (!graphDataRef.current || !sceneDataRef2.current || !sourceNodeData || !targetNodeData) {
|
|
11636
11624
|
userActionHandlers.handleCancelConnection(context);
|
|
11637
11625
|
return;
|
|
11638
11626
|
}
|
|
11639
|
-
const sourceParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef2.current, sourceNodeData.id);
|
|
11640
|
-
const targetParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef2.current, targetNodeData.id);
|
|
11627
|
+
const sourceParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef2.current, sourceNodeData.id, sceneConfigId2, ownerId2);
|
|
11628
|
+
const targetParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef2.current, targetNodeData.id, sceneConfigId2, ownerId2);
|
|
11641
11629
|
let parentInfoToSave = sourceParentInfo;
|
|
11642
11630
|
if (sourceParentInfo.parentFileId === sceneConfigId2 && targetParentInfo.parentFileId !== sceneConfigId2) {
|
|
11643
11631
|
parentInfoToSave = targetParentInfo;
|
|
@@ -11654,19 +11642,12 @@ function XViewScene({
|
|
|
11654
11642
|
if (parentFileIdToSave === sceneConfigId2) {
|
|
11655
11643
|
const specificParentData = graphDataRef.current[sceneConfigId2];
|
|
11656
11644
|
specificParentData.links.push(newLink);
|
|
11657
|
-
const currentVisualNodes = Object.values(stateRef2.current.nodeObjects).map((m) => {
|
|
11658
|
-
const { _baseEmissiveIntensity, labelObject, labelOffset, timelineIntervalBar, timelineEndLabel, ...rest } = m.userData;
|
|
11659
|
-
return rest;
|
|
11660
|
-
});
|
|
11661
|
-
const currentVisualLinks = stateRef2.current.allLinks.map((l) => {
|
|
11662
|
-
const { sourceNode, targetNode, ...rest } = l.userData;
|
|
11663
|
-
return rest;
|
|
11664
|
-
});
|
|
11665
|
-
currentVisualLinks.push(newLink);
|
|
11666
11645
|
const viewFilePayload = {
|
|
11667
11646
|
parent_dbs: sceneDataRef2.current.parent_dbs,
|
|
11668
|
-
nodes:
|
|
11669
|
-
|
|
11647
|
+
nodes: sceneDataRef2.current.nodes,
|
|
11648
|
+
// <-- Usa o estado original intocado
|
|
11649
|
+
links: sceneDataRef2.current.links,
|
|
11650
|
+
// <-- Usa o estado original intocado
|
|
11670
11651
|
quest_nodes: specificParentData.nodes,
|
|
11671
11652
|
quest_links: specificParentData.links
|
|
11672
11653
|
// Salva a conexão aqui!
|
|
@@ -12975,11 +12956,12 @@ function XViewScene({
|
|
|
12975
12956
|
const { sourceNode, targetNode, ...serializableLinkData } = line.userData;
|
|
12976
12957
|
return serializableLinkData;
|
|
12977
12958
|
});
|
|
12959
|
+
sceneDataRef.current.nodes = currentNodes;
|
|
12960
|
+
sceneDataRef.current.links = currentLinks;
|
|
12978
12961
|
const sceneFileData = {
|
|
12979
12962
|
parent_dbs: sceneDataRef.current.parent_dbs,
|
|
12980
12963
|
nodes: currentNodes,
|
|
12981
12964
|
links: currentLinks,
|
|
12982
|
-
// --- ADICIONE ESTAS DUAS LINHAS PARA PRESERVAR A FONTE DA VERDADE ---
|
|
12983
12965
|
quest_nodes: ((_a2 = parentDataRef.current[sceneConfigId]) == null ? void 0 : _a2.nodes) || [],
|
|
12984
12966
|
quest_links: ((_b2 = parentDataRef.current[sceneConfigId]) == null ? void 0 : _b2.links) || []
|
|
12985
12967
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lv-x-software-house/x_view",
|
|
3
|
-
"version": "1.2.4-dev.
|
|
3
|
+
"version": "1.2.4-dev.9",
|
|
4
4
|
"description": "Pacote privado contendo os componentes e lógica de renderização 3D do X View.",
|
|
5
5
|
"author": "iv.x - Engenharia de Software - ivxsoftwarehouse@gmail.com",
|
|
6
6
|
"license": "UNLICENSED",
|