@lv-x-software-house/x_view 1.2.6-dev.77 → 1.2.6-dev.79
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 +148 -107
- package/dist/index.mjs +148 -107
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -745,20 +745,20 @@ var updateSceneHighlights = (state) => {
|
|
|
745
745
|
var addNewNodeToScene = (state, newNodeData, newLinkData, position) => {
|
|
746
746
|
const {
|
|
747
747
|
graphGroup,
|
|
748
|
-
nodeObjects
|
|
748
|
+
nodeObjects,
|
|
749
749
|
clickableNodes,
|
|
750
750
|
allLinks,
|
|
751
751
|
glowTexture,
|
|
752
752
|
renderer
|
|
753
753
|
} = state;
|
|
754
|
-
const sourceNodeMesh =
|
|
754
|
+
const sourceNodeMesh = nodeObjects[String(newLinkData.source)];
|
|
755
755
|
if (!sourceNodeMesh || !graphGroup) return;
|
|
756
756
|
const mesh = createNodeMesh(newNodeData, position, glowTexture);
|
|
757
757
|
graphGroup.add(mesh);
|
|
758
758
|
if (mesh.userData.labelObject) {
|
|
759
759
|
graphGroup.add(mesh.userData.labelObject);
|
|
760
760
|
}
|
|
761
|
-
|
|
761
|
+
nodeObjects[String(newNodeData.id)] = mesh;
|
|
762
762
|
clickableNodes.push(mesh);
|
|
763
763
|
const resolution = new THREE.Vector2(
|
|
764
764
|
renderer.domElement.clientWidth,
|
|
@@ -776,9 +776,9 @@ var addNewNodeToScene = (state, newNodeData, newLinkData, position) => {
|
|
|
776
776
|
});
|
|
777
777
|
};
|
|
778
778
|
var addNewLinkToScene = (state, newLinkData) => {
|
|
779
|
-
const { graphGroup, nodeObjects
|
|
780
|
-
const sourceNodeMesh =
|
|
781
|
-
const targetNodeMesh =
|
|
779
|
+
const { graphGroup, nodeObjects, allLinks, renderer } = state;
|
|
780
|
+
const sourceNodeMesh = nodeObjects[String(newLinkData.source)];
|
|
781
|
+
const targetNodeMesh = nodeObjects[String(newLinkData.target)];
|
|
782
782
|
if (!sourceNodeMesh || !targetNodeMesh || !graphGroup) return;
|
|
783
783
|
const resolution = new THREE.Vector2(
|
|
784
784
|
renderer.domElement.clientWidth,
|
|
@@ -823,12 +823,12 @@ var removeLinkFromScene = (state, linkObject) => {
|
|
|
823
823
|
var removeNodeFromScene = (state, nodeId) => {
|
|
824
824
|
const {
|
|
825
825
|
graphGroup,
|
|
826
|
-
nodeObjects
|
|
826
|
+
nodeObjects,
|
|
827
827
|
clickableNodes,
|
|
828
828
|
allLinks,
|
|
829
829
|
timelineIntervalsGroup
|
|
830
830
|
} = state;
|
|
831
|
-
const nodeToRemove =
|
|
831
|
+
const nodeToRemove = nodeObjects[String(nodeId)];
|
|
832
832
|
if (!nodeToRemove) return;
|
|
833
833
|
const strNodeId = String(nodeId);
|
|
834
834
|
const linksToRemove = [...allLinks].filter(
|
|
@@ -837,7 +837,7 @@ var removeNodeFromScene = (state, nodeId) => {
|
|
|
837
837
|
linksToRemove.forEach((link) => removeLinkFromScene(state, link));
|
|
838
838
|
const nodeIdx = clickableNodes.indexOf(nodeToRemove);
|
|
839
839
|
if (nodeIdx > -1) clickableNodes.splice(nodeIdx, 1);
|
|
840
|
-
delete
|
|
840
|
+
delete nodeObjects[strNodeId];
|
|
841
841
|
if (graphGroup && nodeToRemove.userData.labelObject) {
|
|
842
842
|
const label = nodeToRemove.userData.labelObject;
|
|
843
843
|
graphGroup.remove(label);
|
|
@@ -872,7 +872,7 @@ var removeNodeFromScene = (state, nodeId) => {
|
|
|
872
872
|
}
|
|
873
873
|
};
|
|
874
874
|
var addStandaloneNodeToScene = (state, nodeData, position, forceShowQuestDate = false) => {
|
|
875
|
-
const { graphGroup, nodeObjects
|
|
875
|
+
const { graphGroup, nodeObjects, clickableNodes, glowTexture } = state;
|
|
876
876
|
if (!graphGroup) return;
|
|
877
877
|
const mesh = createNodeMesh(nodeData, position, glowTexture, forceShowQuestDate);
|
|
878
878
|
mesh.scale.set(0.01, 0.01, 0.01);
|
|
@@ -880,7 +880,7 @@ var addStandaloneNodeToScene = (state, nodeData, position, forceShowQuestDate =
|
|
|
880
880
|
if (mesh.userData.labelObject) {
|
|
881
881
|
graphGroup.add(mesh.userData.labelObject);
|
|
882
882
|
}
|
|
883
|
-
|
|
883
|
+
nodeObjects[String(nodeData.id)] = mesh;
|
|
884
884
|
clickableNodes.push(mesh);
|
|
885
885
|
if (state.tweenGroup) {
|
|
886
886
|
const targetScale = NODE_SCALE_FACTORS[nodeData.size || "medium"] || 1;
|
|
@@ -918,7 +918,7 @@ var userActionHandlers = {
|
|
|
918
918
|
const { stateRef, setters, tweenToTarget } = context;
|
|
919
919
|
setters.setContextMenu({ visible: false });
|
|
920
920
|
setters.setRelationshipMenu({ visible: false });
|
|
921
|
-
const { graphGroup, nodeObjects
|
|
921
|
+
const { graphGroup, nodeObjects, renderer, ghostElements, glowTexture } = stateRef.current;
|
|
922
922
|
if (ghostElements.node && graphGroup) {
|
|
923
923
|
graphGroup.remove(ghostElements.node);
|
|
924
924
|
ghostElements.node.traverse((child) => {
|
|
@@ -934,7 +934,7 @@ var userActionHandlers = {
|
|
|
934
934
|
ghostElements.line.geometry.dispose();
|
|
935
935
|
ghostElements.line.material.dispose();
|
|
936
936
|
}
|
|
937
|
-
const sourceNodeMesh =
|
|
937
|
+
const sourceNodeMesh = nodeObjects[String(sourceNodeData.id)];
|
|
938
938
|
if (!sourceNodeMesh || !graphGroup || !renderer) return;
|
|
939
939
|
stateRef.current.creation = { isActive: true, sourceNodeData };
|
|
940
940
|
const ghostGeometry = new THREE.SphereGeometry(1.5, 32, 32);
|
|
@@ -1112,7 +1112,7 @@ var userActionHandlers = {
|
|
|
1112
1112
|
const { stateRef, setters, tweenToTarget } = context;
|
|
1113
1113
|
setters.setContextMenu({ visible: false });
|
|
1114
1114
|
setters.setRelationshipMenu({ visible: false });
|
|
1115
|
-
const { graphGroup, nodeObjects
|
|
1115
|
+
const { graphGroup, nodeObjects, renderer, ghostElements, glowTexture } = stateRef.current;
|
|
1116
1116
|
if (ghostElements.node && graphGroup) {
|
|
1117
1117
|
if (ghostElements.node.userData.labelObject) {
|
|
1118
1118
|
graphGroup.remove(ghostElements.node.userData.labelObject);
|
|
@@ -1134,7 +1134,7 @@ var userActionHandlers = {
|
|
|
1134
1134
|
ghostElements.line.geometry.dispose();
|
|
1135
1135
|
ghostElements.line.material.dispose();
|
|
1136
1136
|
}
|
|
1137
|
-
const sourceNodeMesh =
|
|
1137
|
+
const sourceNodeMesh = nodeObjects[String(sourceNodeData.id)];
|
|
1138
1138
|
if (!sourceNodeMesh || !graphGroup || !renderer) return;
|
|
1139
1139
|
stateRef.current.creation = { isActive: true, sourceNodeData };
|
|
1140
1140
|
const ghostGeometry = new THREE.SphereGeometry(1.5, 32, 32);
|
|
@@ -1315,7 +1315,7 @@ var userActionHandlers = {
|
|
|
1315
1315
|
} = context;
|
|
1316
1316
|
const {
|
|
1317
1317
|
graphGroup,
|
|
1318
|
-
nodeObjects
|
|
1318
|
+
nodeObjects,
|
|
1319
1319
|
clickableNodes,
|
|
1320
1320
|
allLinks,
|
|
1321
1321
|
glowTexture,
|
|
@@ -1324,7 +1324,7 @@ var userActionHandlers = {
|
|
|
1324
1324
|
} = stateRef.current;
|
|
1325
1325
|
if (!graphGroup || !sceneDataRef.current || !graphDataRef.current || !linksToExpand || linksToExpand.length === 0)
|
|
1326
1326
|
return;
|
|
1327
|
-
const sourceNodeMesh =
|
|
1327
|
+
const sourceNodeMesh = nodeObjects[String(sourceNode.id)];
|
|
1328
1328
|
if (!sourceNodeMesh) return;
|
|
1329
1329
|
const resolution = new THREE.Vector2(
|
|
1330
1330
|
mountRef.current.clientWidth,
|
|
@@ -1336,7 +1336,7 @@ var userActionHandlers = {
|
|
|
1336
1336
|
var _a;
|
|
1337
1337
|
const isSource = String(link.source) === String(sourceNode.id);
|
|
1338
1338
|
const targetNodeId = isSource ? link.target : link.source;
|
|
1339
|
-
if (!
|
|
1339
|
+
if (!nodeObjects[String(targetNodeId)]) {
|
|
1340
1340
|
const allParentNodes = Object.values(graphDataRef.current).flatMap(
|
|
1341
1341
|
(fileData) => fileData.nodes
|
|
1342
1342
|
);
|
|
@@ -1364,7 +1364,7 @@ var userActionHandlers = {
|
|
|
1364
1364
|
if (targetMesh.userData.labelObject) {
|
|
1365
1365
|
graphGroup.add(targetMesh.userData.labelObject);
|
|
1366
1366
|
}
|
|
1367
|
-
|
|
1367
|
+
nodeObjects[String(targetNodeId)] = targetMesh;
|
|
1368
1368
|
clickableNodes.push(targetMesh);
|
|
1369
1369
|
const posTween = new import_tween.Tween(targetMesh.position).to(endPosition, 1200).easing(import_tween.Easing.Quadratic.Out);
|
|
1370
1370
|
tweenGroup.add(posTween);
|
|
@@ -1383,8 +1383,8 @@ var userActionHandlers = {
|
|
|
1383
1383
|
(l) => String(l.userData.id) === String(link.id)
|
|
1384
1384
|
);
|
|
1385
1385
|
if (linkAlreadyInSceneObjects) return;
|
|
1386
|
-
const sourceMesh =
|
|
1387
|
-
const targetMesh =
|
|
1386
|
+
const sourceMesh = nodeObjects[String(link.source)];
|
|
1387
|
+
const targetMesh = nodeObjects[String(link.target)];
|
|
1388
1388
|
if (sourceMesh && targetMesh) {
|
|
1389
1389
|
const currentLinksBetweenNodesData = allLinks.filter(
|
|
1390
1390
|
(l) => String(l.userData.source) === String(link.source) && String(l.userData.target) === String(link.target) || String(l.userData.source) === String(link.target) && String(l.userData.target) === String(link.source)
|
|
@@ -1446,8 +1446,8 @@ var userActionHandlers = {
|
|
|
1446
1446
|
const { stateRef, mountRef, setters } = context;
|
|
1447
1447
|
setters.setContextMenu({ visible: false });
|
|
1448
1448
|
setters.setRelationshipMenu({ visible: false });
|
|
1449
|
-
const { graphGroup, nodeObjects
|
|
1450
|
-
const sourceNodeMesh =
|
|
1449
|
+
const { graphGroup, nodeObjects, renderer, controls } = stateRef.current;
|
|
1450
|
+
const sourceNodeMesh = nodeObjects[String(sourceNodeData.id)];
|
|
1451
1451
|
if (!sourceNodeMesh || !graphGroup || !renderer) return;
|
|
1452
1452
|
controls.enabled = false;
|
|
1453
1453
|
if (mountRef.current) mountRef.current.style.cursor = "crosshair";
|
|
@@ -1620,7 +1620,7 @@ var userActionHandlers = {
|
|
|
1620
1620
|
},
|
|
1621
1621
|
handleCompleteRelink: async (context, newEndNodeData) => {
|
|
1622
1622
|
const { stateRef, graphDataRef, sceneDataRef } = context;
|
|
1623
|
-
const { relink, nodeObjects
|
|
1623
|
+
const { relink, nodeObjects } = stateRef.current;
|
|
1624
1624
|
const originalLinkData = relink.originalLine.userData;
|
|
1625
1625
|
const oldSourceId = originalLinkData.source;
|
|
1626
1626
|
const oldTargetId = originalLinkData.target;
|
|
@@ -8892,10 +8892,6 @@ function CreateQuestTreePanel({
|
|
|
8892
8892
|
}
|
|
8893
8893
|
};
|
|
8894
8894
|
const handleLocalSave = async () => {
|
|
8895
|
-
if (!hasUnsavedChanges) {
|
|
8896
|
-
onClose();
|
|
8897
|
-
return;
|
|
8898
|
-
}
|
|
8899
8895
|
try {
|
|
8900
8896
|
setIsSaving(true);
|
|
8901
8897
|
await onSave(questTreeMode.tree, questTreeMode.abstraction_tree);
|
|
@@ -8938,13 +8934,20 @@ function CreateQuestTreePanel({
|
|
|
8938
8934
|
}
|
|
8939
8935
|
),
|
|
8940
8936
|
/* @__PURE__ */ import_react12.default.createElement("div", { className: "flex-shrink-0 p-4 border-b border-slate-700 bg-slate-800/80 backdrop-blur-xl flex flex-col gap-1 z-20" }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ import_react12.default.createElement("h2", { className: "text-xl font-bold text-white flex items-center gap-2" }, /* @__PURE__ */ import_react12.default.createElement(import_fi11.FiGitBranch, { className: "text-emerald-400" }), "Quest Trees"), /* @__PURE__ */ import_react12.default.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ import_react12.default.createElement(
|
|
8937
|
+
"button",
|
|
8938
|
+
{
|
|
8939
|
+
onClick: onClose,
|
|
8940
|
+
className: "px-4 py-2 rounded-lg border border-white/15 bg-transparent hover:bg-white/5 transition-colors text-sm text-slate-300"
|
|
8941
|
+
},
|
|
8942
|
+
"Fechar"
|
|
8943
|
+
), /* @__PURE__ */ import_react12.default.createElement(
|
|
8941
8944
|
"button",
|
|
8942
8945
|
{
|
|
8943
8946
|
onClick: handleLocalSave,
|
|
8944
8947
|
disabled: isSaving,
|
|
8945
|
-
className: `flex items-center gap-2
|
|
8948
|
+
className: `px-4 py-2 rounded-lg transition-all font-semibold text-sm flex items-center gap-2 ${isSaving ? "bg-slate-700 text-slate-300 cursor-wait" : "bg-gradient-to-tr from-indigo-600 to-indigo-400 hover:from-indigo-500 hover:to-indigo-300 text-white shadow-[0_8px_24px_rgba(99,102,241,0.35)]"}`
|
|
8946
8949
|
},
|
|
8947
|
-
isSaving ? "Salvando..." :
|
|
8950
|
+
isSaving ? "Salvando..." : "Salvar Mudan\xE7as"
|
|
8948
8951
|
)))),
|
|
8949
8952
|
/* @__PURE__ */ import_react12.default.createElement("div", { className: "flex border-b border-slate-800 bg-slate-900/50 p-2 gap-2 flex-shrink-0" }, /* @__PURE__ */ import_react12.default.createElement(
|
|
8950
8953
|
"button",
|
|
@@ -8979,16 +8982,7 @@ function CreateQuestTreePanel({
|
|
|
8979
8982
|
selectedParentId
|
|
8980
8983
|
}
|
|
8981
8984
|
)) : /* @__PURE__ */ import_react12.default.createElement("div", { className: "text-center py-8 text-slate-500 text-sm italic" }, "\xC1rvore vazia. Ofertada inicializa\xE7\xE3o autom\xE1tica em breve..."))),
|
|
8982
|
-
/* @__PURE__ */ import_react12.default.createElement("div", { className: "absolute bottom-6 left-1/2 -translate-x-1/2
|
|
8983
|
-
"button",
|
|
8984
|
-
{
|
|
8985
|
-
onClick: handleLocalSave,
|
|
8986
|
-
disabled: isSaving,
|
|
8987
|
-
className: "flex items-center gap-2 px-8 py-3 rounded-full font-bold shadow-2xl transition-all scale-110 bg-emerald-600 hover:bg-emerald-500 text-white shadow-emerald-500/20 active:scale-100"
|
|
8988
|
-
},
|
|
8989
|
-
isSaving ? "Salvando..." : /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null, /* @__PURE__ */ import_react12.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ import_react12.default.createElement("path", { d: "M20 6L9 17l-5-5" })), " Salvar Mudan\xE7as")
|
|
8990
|
-
)),
|
|
8991
|
-
isAddingModeActive && selectedParentId && /* @__PURE__ */ import_react12.default.createElement("div", { className: "absolute bottom-20 left-1/2 -translate-x-1/2 bg-slate-800 px-4 py-2 rounded-full border border-slate-600 text-xs text-slate-300 shadow-lg whitespace-nowrap" }, "Destino: ", /* @__PURE__ */ import_react12.default.createElement("span", { className: "text-emerald-400 font-bold" }, ((_c = (_b = (_a = findNodePath3(currentTree, selectedParentId)) == null ? void 0 : _a.node) == null ? void 0 : _b.node) == null ? void 0 : _c.name) || "Root"))
|
|
8985
|
+
isAddingModeActive && selectedParentId && /* @__PURE__ */ import_react12.default.createElement("div", { className: "absolute bottom-6 left-1/2 -translate-x-1/2 bg-slate-800 px-4 py-2 rounded-full border border-slate-600 text-xs text-slate-300 shadow-lg whitespace-nowrap z-30" }, "Destino: ", /* @__PURE__ */ import_react12.default.createElement("span", { className: "text-emerald-400 font-bold" }, ((_c = (_b = (_a = findNodePath3(currentTree, selectedParentId)) == null ? void 0 : _a.node) == null ? void 0 : _b.node) == null ? void 0 : _c.name) || "Root"))
|
|
8992
8986
|
);
|
|
8993
8987
|
}
|
|
8994
8988
|
|
|
@@ -13042,11 +13036,30 @@ ${noteText}` : noteText : entry.notes,
|
|
|
13042
13036
|
type: "button",
|
|
13043
13037
|
onClick: () => {
|
|
13044
13038
|
if (setQuestTreeMode2) {
|
|
13039
|
+
const convertPersistedTree = (storedTree) => {
|
|
13040
|
+
if (!storedTree) return null;
|
|
13041
|
+
if (storedTree.node || storedTree.is_section) return storedTree;
|
|
13042
|
+
const nodeId = storedTree.node_id;
|
|
13043
|
+
if (!nodeId) return null;
|
|
13044
|
+
const foundNode = availableNodes.find((n) => String(n.id) === String(nodeId)) || (String(nodeId) === String(node == null ? void 0 : node.id) ? node : null);
|
|
13045
|
+
return {
|
|
13046
|
+
node: foundNode ? { id: foundNode.id, name: foundNode.raw_title || foundNode.name } : { id: nodeId, name: `Node ${nodeId}` },
|
|
13047
|
+
relationship: storedTree.relationship || {},
|
|
13048
|
+
children: (storedTree.children || []).map(convertPersistedTree).filter(Boolean)
|
|
13049
|
+
};
|
|
13050
|
+
};
|
|
13051
|
+
const rootNode = { id: node == null ? void 0 : node.id, name: (node == null ? void 0 : node.raw_title) || (node == null ? void 0 : node.name) || "Quest Principal" };
|
|
13052
|
+
const existingTree = (node == null ? void 0 : node.quest_tree) ? convertPersistedTree(node.quest_tree) : { node: rootNode, children: [] };
|
|
13053
|
+
const existingAbstractionTree = (node == null ? void 0 : node.quest_abstraction_tree) ? convertPersistedTree(node.quest_abstraction_tree) : { node: rootNode, children: [] };
|
|
13045
13054
|
setQuestTreeMode2((prev) => ({
|
|
13046
13055
|
...prev,
|
|
13047
13056
|
isActive: true,
|
|
13048
13057
|
isAddingNodes: true,
|
|
13049
|
-
questNodeId: node == null ? void 0 : node.id
|
|
13058
|
+
questNodeId: node == null ? void 0 : node.id,
|
|
13059
|
+
questNodeName: (node == null ? void 0 : node.raw_title) || (node == null ? void 0 : node.name),
|
|
13060
|
+
tree: existingTree,
|
|
13061
|
+
abstraction_tree: existingAbstractionTree,
|
|
13062
|
+
selectedParentId: rootNode.id
|
|
13050
13063
|
}));
|
|
13051
13064
|
}
|
|
13052
13065
|
},
|
|
@@ -15479,6 +15492,7 @@ function XViewScene({
|
|
|
15479
15492
|
}, [ownerId, sceneConfigId]);
|
|
15480
15493
|
const sceneDataRef = (0, import_react33.useRef)(null);
|
|
15481
15494
|
const parentDataRef = (0, import_react33.useRef)(null);
|
|
15495
|
+
const graphDataRef = parentDataRef;
|
|
15482
15496
|
const ancestryDataRef = (0, import_react33.useRef)(null);
|
|
15483
15497
|
const [isLoading, setIsLoading] = (0, import_react33.useState)(true);
|
|
15484
15498
|
const [permissionStatus, setPermissionStatus] = (0, import_react33.useState)("loading");
|
|
@@ -15944,8 +15958,8 @@ function XViewScene({
|
|
|
15944
15958
|
[]
|
|
15945
15959
|
);
|
|
15946
15960
|
const handleActivateTimeline = (0, import_react33.useCallback)(() => {
|
|
15947
|
-
const { nodeObjects
|
|
15948
|
-
if (!
|
|
15961
|
+
const { nodeObjects, tweenGroup, timelineIntervalsGroup } = stateRef.current;
|
|
15962
|
+
if (!nodeObjects || !tweenGroup || !timelineIntervalsGroup) return;
|
|
15949
15963
|
while (timelineIntervalsGroup.children.length > 0) {
|
|
15950
15964
|
const obj = timelineIntervalsGroup.children[0];
|
|
15951
15965
|
timelineIntervalsGroup.remove(obj);
|
|
@@ -15955,7 +15969,7 @@ function XViewScene({
|
|
|
15955
15969
|
obj.material.dispose();
|
|
15956
15970
|
}
|
|
15957
15971
|
}
|
|
15958
|
-
Object.values(
|
|
15972
|
+
Object.values(nodeObjects).forEach((mesh) => {
|
|
15959
15973
|
const oldLabel = mesh.getObjectByName("timelineLabel");
|
|
15960
15974
|
if (oldLabel) {
|
|
15961
15975
|
mesh.remove(oldLabel);
|
|
@@ -15979,7 +15993,7 @@ function XViewScene({
|
|
|
15979
15993
|
}
|
|
15980
15994
|
return null;
|
|
15981
15995
|
};
|
|
15982
|
-
Object.values(
|
|
15996
|
+
Object.values(nodeObjects).forEach((mesh) => {
|
|
15983
15997
|
const dateProp = mesh.userData.Date;
|
|
15984
15998
|
let nodeInfo = { mesh, type: "point", label: "", isUndated: true };
|
|
15985
15999
|
if (dateProp) {
|
|
@@ -16354,14 +16368,14 @@ function XViewScene({
|
|
|
16354
16368
|
(nodeData, position, suppressVersionUpdate = false, forceShowQuestDate = false) => {
|
|
16355
16369
|
const {
|
|
16356
16370
|
graphGroup,
|
|
16357
|
-
nodeObjects
|
|
16371
|
+
nodeObjects,
|
|
16358
16372
|
clickableNodes,
|
|
16359
16373
|
glowTexture,
|
|
16360
16374
|
tweenGroup
|
|
16361
16375
|
} = stateRef.current;
|
|
16362
16376
|
const nodeId = String(nodeData.id);
|
|
16363
|
-
if (
|
|
16364
|
-
const existingMesh =
|
|
16377
|
+
if (nodeObjects[nodeId]) {
|
|
16378
|
+
const existingMesh = nodeObjects[nodeId];
|
|
16365
16379
|
if (position) {
|
|
16366
16380
|
const updateTween = new import_tween2.Tween(existingMesh.position).to(position, 800).easing(import_tween2.Easing.Cubic.Out);
|
|
16367
16381
|
tweenGroup.add(updateTween);
|
|
@@ -16382,7 +16396,7 @@ function XViewScene({
|
|
|
16382
16396
|
}
|
|
16383
16397
|
graphGroup.add(mesh.userData.labelObject);
|
|
16384
16398
|
}
|
|
16385
|
-
|
|
16399
|
+
nodeObjects[nodeId] = mesh;
|
|
16386
16400
|
clickableNodes.push(mesh);
|
|
16387
16401
|
if (!suppressVersionUpdate) {
|
|
16388
16402
|
setSceneVersion((v) => v + 1);
|
|
@@ -16392,15 +16406,15 @@ function XViewScene({
|
|
|
16392
16406
|
[]
|
|
16393
16407
|
);
|
|
16394
16408
|
const handleActivateReshapeLens = (0, import_react33.useCallback)(({ type, columns, centerNodeId }) => {
|
|
16395
|
-
const { nodeObjects
|
|
16396
|
-
if (!
|
|
16397
|
-
const activeNodeIds = Object.keys(
|
|
16409
|
+
const { nodeObjects, tweenGroup, camera, controls } = stateRef.current;
|
|
16410
|
+
if (!nodeObjects || !tweenGroup || !camera || !controls) return;
|
|
16411
|
+
const activeNodeIds = Object.keys(nodeObjects);
|
|
16398
16412
|
if (activeNodeIds.length === 0) return;
|
|
16399
16413
|
let sumX = 0;
|
|
16400
16414
|
let sumY = 0;
|
|
16401
16415
|
let nodeCount = 0;
|
|
16402
16416
|
activeNodeIds.forEach((id) => {
|
|
16403
|
-
const mesh =
|
|
16417
|
+
const mesh = nodeObjects[id];
|
|
16404
16418
|
if (mesh && mesh.material) {
|
|
16405
16419
|
const opacityTween = new import_tween2.Tween(mesh.material).to({ opacity: 1 }, 1200).easing(import_tween2.Easing.Cubic.Out);
|
|
16406
16420
|
tweenGroup.add(opacityTween);
|
|
@@ -16415,7 +16429,7 @@ function XViewScene({
|
|
|
16415
16429
|
const rowSpacing = 80;
|
|
16416
16430
|
const numCols = columns || 4;
|
|
16417
16431
|
activeNodeIds.forEach((id, index) => {
|
|
16418
|
-
const mesh =
|
|
16432
|
+
const mesh = nodeObjects[id];
|
|
16419
16433
|
const col = index % numCols;
|
|
16420
16434
|
const row = Math.floor(index / numCols);
|
|
16421
16435
|
const targetX = (col - (numCols - 1) / 2) * colSpacing;
|
|
@@ -16437,7 +16451,7 @@ function XViewScene({
|
|
|
16437
16451
|
const total = activeNodeIds.length;
|
|
16438
16452
|
const radius = Math.max(80, total * 8);
|
|
16439
16453
|
activeNodeIds.forEach((id, index) => {
|
|
16440
|
-
const mesh =
|
|
16454
|
+
const mesh = nodeObjects[id];
|
|
16441
16455
|
const angle = index / total * Math.PI * 2;
|
|
16442
16456
|
const targetX = Math.cos(angle) * radius;
|
|
16443
16457
|
const targetY = Math.sin(angle) * radius;
|
|
@@ -16455,7 +16469,7 @@ function XViewScene({
|
|
|
16455
16469
|
nodeCount++;
|
|
16456
16470
|
});
|
|
16457
16471
|
} else if (type === "Star") {
|
|
16458
|
-
const centerMesh = centerNodeId ?
|
|
16472
|
+
const centerMesh = centerNodeId ? nodeObjects[String(centerNodeId)] : null;
|
|
16459
16473
|
const orbitingNodeIds = activeNodeIds.filter((id) => id !== String(centerNodeId));
|
|
16460
16474
|
const totalOrbiting = orbitingNodeIds.length;
|
|
16461
16475
|
const radius = Math.max(80, totalOrbiting * 10);
|
|
@@ -16474,7 +16488,7 @@ function XViewScene({
|
|
|
16474
16488
|
nodeCount++;
|
|
16475
16489
|
}
|
|
16476
16490
|
orbitingNodeIds.forEach((id, index) => {
|
|
16477
|
-
const mesh =
|
|
16491
|
+
const mesh = nodeObjects[id];
|
|
16478
16492
|
const angle = totalOrbiting > 0 ? index / totalOrbiting * Math.PI * 2 : 0;
|
|
16479
16493
|
const targetX = Math.cos(angle) * radius;
|
|
16480
16494
|
const targetY = Math.sin(angle) * radius;
|
|
@@ -16514,8 +16528,8 @@ function XViewScene({
|
|
|
16514
16528
|
}, []);
|
|
16515
16529
|
const handleActivateQuestLens = (0, import_react33.useCallback)(({ assigneeId, status: status2, milestoneId }) => {
|
|
16516
16530
|
var _a2;
|
|
16517
|
-
const { nodeObjects
|
|
16518
|
-
if (!
|
|
16531
|
+
const { nodeObjects, tweenGroup, graphGroup } = stateRef.current;
|
|
16532
|
+
if (!nodeObjects || !tweenGroup || !graphGroup) return;
|
|
16519
16533
|
const allQuests = ((_a2 = sceneDataRef.current) == null ? void 0 : _a2.quest_nodes) || [];
|
|
16520
16534
|
const filteredQuests = allQuests.filter((q) => {
|
|
16521
16535
|
const matchAssignee = !assigneeId || String(q.assignee_id) === String(assigneeId);
|
|
@@ -16577,7 +16591,7 @@ function XViewScene({
|
|
|
16577
16591
|
positionGroups.get(posKey).push(String(q.id));
|
|
16578
16592
|
});
|
|
16579
16593
|
});
|
|
16580
|
-
Object.values(
|
|
16594
|
+
Object.values(nodeObjects).forEach((mesh) => {
|
|
16581
16595
|
const oldLabel = mesh.getObjectByName("questDateLabel") || mesh.getObjectByName("timelineLabel");
|
|
16582
16596
|
if (oldLabel) {
|
|
16583
16597
|
mesh.remove(oldLabel);
|
|
@@ -16592,13 +16606,13 @@ function XViewScene({
|
|
|
16592
16606
|
mesh.userData.timelineEndLabel = null;
|
|
16593
16607
|
}
|
|
16594
16608
|
});
|
|
16595
|
-
const nonFilteredNodeIds = Object.keys(
|
|
16609
|
+
const nonFilteredNodeIds = Object.keys(nodeObjects).filter((id) => !filteredQuests.some((q) => String(q.id) === String(id)));
|
|
16596
16610
|
const COMMON_START_X = startX - 100;
|
|
16597
16611
|
const COMMON_COL_SPACING = 30;
|
|
16598
16612
|
const COMMON_ROW_SPACING = 35;
|
|
16599
16613
|
const MAX_COMMON_ROWS = 15;
|
|
16600
16614
|
nonFilteredNodeIds.forEach((id, idx) => {
|
|
16601
|
-
const mesh =
|
|
16615
|
+
const mesh = nodeObjects[id];
|
|
16602
16616
|
if (!mesh) return;
|
|
16603
16617
|
const col = Math.floor(idx / MAX_COMMON_ROWS);
|
|
16604
16618
|
const row = idx % MAX_COMMON_ROWS;
|
|
@@ -16624,7 +16638,7 @@ function XViewScene({
|
|
|
16624
16638
|
sideTween.start();
|
|
16625
16639
|
});
|
|
16626
16640
|
filteredQuests.forEach((q) => {
|
|
16627
|
-
const mesh =
|
|
16641
|
+
const mesh = nodeObjects[String(q.id)];
|
|
16628
16642
|
if (mesh) {
|
|
16629
16643
|
if (mesh.material) {
|
|
16630
16644
|
const fadeInTween = new import_tween2.Tween(mesh.material).to({ opacity: 1 }, 1200).easing(import_tween2.Easing.Cubic.Out);
|
|
@@ -16642,7 +16656,7 @@ function XViewScene({
|
|
|
16642
16656
|
const colX = startX + colIndex * QUEST_LENS_COLUMN_SPACING;
|
|
16643
16657
|
questsInCol.forEach((q, rowIndex) => {
|
|
16644
16658
|
const nodeId = String(q.id);
|
|
16645
|
-
let mesh =
|
|
16659
|
+
let mesh = nodeObjects[nodeId];
|
|
16646
16660
|
const timeInfo = questTimeInfos.get(nodeId) || { isUndated: true };
|
|
16647
16661
|
let targetY;
|
|
16648
16662
|
if (!timeInfo.isUndated) {
|
|
@@ -16788,8 +16802,8 @@ function XViewScene({
|
|
|
16788
16802
|
stateRef.current.timelineIntervalsGroup = timelineIntervalsGroup;
|
|
16789
16803
|
const graphData = sceneDataRef.current;
|
|
16790
16804
|
const nodePositions = calculateNodePositions(graphData.nodes);
|
|
16791
|
-
const
|
|
16792
|
-
stateRef.current.nodeObjects =
|
|
16805
|
+
const nodeObjects = {};
|
|
16806
|
+
stateRef.current.nodeObjects = nodeObjects;
|
|
16793
16807
|
stateRef.current.glowTexture = makeGlowTexture();
|
|
16794
16808
|
graphData.nodes.forEach((node) => {
|
|
16795
16809
|
const position = nodePositions[node.id] || new THREE3.Vector3();
|
|
@@ -16799,7 +16813,7 @@ function XViewScene({
|
|
|
16799
16813
|
mesh.userData.labelObject.position.copy(mesh.position).add(mesh.userData.labelOffset);
|
|
16800
16814
|
graphGroup.add(mesh.userData.labelObject);
|
|
16801
16815
|
}
|
|
16802
|
-
|
|
16816
|
+
nodeObjects[String(node.id)] = mesh;
|
|
16803
16817
|
stateRef.current.clickableNodes.push(mesh);
|
|
16804
16818
|
});
|
|
16805
16819
|
const linksGroupedByNodes = /* @__PURE__ */ new Map();
|
|
@@ -16811,8 +16825,8 @@ function XViewScene({
|
|
|
16811
16825
|
linksGroupedByNodes.get(pairKey).push(link);
|
|
16812
16826
|
});
|
|
16813
16827
|
linksGroupedByNodes.forEach((linksArray) => {
|
|
16814
|
-
const sourceNode =
|
|
16815
|
-
const targetNode =
|
|
16828
|
+
const sourceNode = nodeObjects[String(linksArray[0].source)];
|
|
16829
|
+
const targetNode = nodeObjects[String(linksArray[0].target)];
|
|
16816
16830
|
if (sourceNode && targetNode) {
|
|
16817
16831
|
const resolution = new THREE3.Vector2(
|
|
16818
16832
|
currentMount.clientWidth,
|
|
@@ -18040,17 +18054,44 @@ function XViewScene({
|
|
|
18040
18054
|
const formattedTree = convertTreeToIds(newTree);
|
|
18041
18055
|
const formattedAbstractionTree = convertTreeToIds(newAbstractionTree);
|
|
18042
18056
|
if (questNodeId && sceneConfigId) {
|
|
18043
|
-
const sceneData =
|
|
18057
|
+
const sceneData = sceneDataRef.current;
|
|
18044
18058
|
if (sceneData && sceneData.quest_nodes) {
|
|
18045
18059
|
const questIndex = sceneData.quest_nodes.findIndex((q) => String(q.id) === String(questNodeId));
|
|
18046
18060
|
if (questIndex !== -1) {
|
|
18047
18061
|
sceneData.quest_nodes[questIndex].quest_tree = formattedTree;
|
|
18048
18062
|
sceneData.quest_nodes[questIndex].quest_abstraction_tree = formattedAbstractionTree;
|
|
18049
|
-
if (
|
|
18050
|
-
|
|
18063
|
+
if (parentDataRef.current[sceneConfigId]) {
|
|
18064
|
+
const parentIndex = parentDataRef.current[sceneConfigId].nodes.findIndex(
|
|
18065
|
+
(q) => String(q.id) === String(questNodeId)
|
|
18066
|
+
);
|
|
18067
|
+
if (parentIndex !== -1) {
|
|
18068
|
+
parentDataRef.current[sceneConfigId].nodes[parentIndex].quest_tree = formattedTree;
|
|
18069
|
+
parentDataRef.current[sceneConfigId].nodes[parentIndex].quest_abstraction_tree = formattedAbstractionTree;
|
|
18070
|
+
}
|
|
18071
|
+
}
|
|
18072
|
+
if (save_view_data && sceneSaveUrl) {
|
|
18073
|
+
const { nodeObjects: nObj, allLinks: aLinks } = stateRef.current;
|
|
18074
|
+
const currentNodes = nObj ? Object.values(nObj).map((mesh) => {
|
|
18075
|
+
const { _baseEmissiveIntensity, labelObject, labelOffset, timelineIntervalBar, timelineEndLabel, ...serializableNodeData } = mesh.userData;
|
|
18076
|
+
return serializableNodeData;
|
|
18077
|
+
}) : sceneData.nodes || [];
|
|
18078
|
+
const currentLinks = aLinks ? aLinks.map((line) => {
|
|
18079
|
+
const { sourceNode, targetNode, ...serializableLinkData } = line.userData;
|
|
18080
|
+
return serializableLinkData;
|
|
18081
|
+
}) : sceneData.links || [];
|
|
18082
|
+
const sceneFileData = {
|
|
18083
|
+
...sceneData,
|
|
18084
|
+
nodes: currentNodes,
|
|
18085
|
+
links: currentLinks,
|
|
18086
|
+
quest_nodes: sceneData.quest_nodes,
|
|
18087
|
+
quest_links: sceneData.quest_links || [],
|
|
18088
|
+
quest_counter: sceneData.quest_counter || 1,
|
|
18089
|
+
milestones: sceneData.milestones || []
|
|
18090
|
+
};
|
|
18091
|
+
await save_view_data(sceneSaveUrl, sceneFileData);
|
|
18051
18092
|
}
|
|
18052
18093
|
const updatedNodeData = sceneData.quest_nodes[questIndex];
|
|
18053
|
-
const nodeMesh = nodeObjects[String(questNodeId)];
|
|
18094
|
+
const nodeMesh = (_a2 = stateRef.current.nodeObjects) == null ? void 0 : _a2[String(questNodeId)];
|
|
18054
18095
|
if (nodeMesh) {
|
|
18055
18096
|
nodeMesh.userData.questData = updatedNodeData;
|
|
18056
18097
|
}
|
|
@@ -18092,7 +18133,7 @@ function XViewScene({
|
|
|
18092
18133
|
};
|
|
18093
18134
|
const handleSaveQuestNode = async (context, newQuestData) => {
|
|
18094
18135
|
const {
|
|
18095
|
-
graphDataRef,
|
|
18136
|
+
graphDataRef: graphDataRef2,
|
|
18096
18137
|
sceneDataRef: sceneDataRef2,
|
|
18097
18138
|
stateRef: stateRef2,
|
|
18098
18139
|
setters,
|
|
@@ -18102,7 +18143,7 @@ function XViewScene({
|
|
|
18102
18143
|
sceneConfigId: sceneConfigId2,
|
|
18103
18144
|
ownerId: ownerId2
|
|
18104
18145
|
} = context;
|
|
18105
|
-
if (!
|
|
18146
|
+
if (!graphDataRef2.current || (viewType == null ? void 0 : viewType.toLowerCase()) !== "view") return;
|
|
18106
18147
|
const currentCounter = sceneDataRef2.current.quest_counter || 1;
|
|
18107
18148
|
const newNode = {
|
|
18108
18149
|
id: import_short_uuid2.default.generate(),
|
|
@@ -18110,14 +18151,14 @@ function XViewScene({
|
|
|
18110
18151
|
is_quest: true,
|
|
18111
18152
|
type: ["quest", ...newQuestData.type.filter((t) => t !== "quest")]
|
|
18112
18153
|
};
|
|
18113
|
-
if (!
|
|
18114
|
-
|
|
18154
|
+
if (!graphDataRef2.current[sceneConfigId2]) {
|
|
18155
|
+
graphDataRef2.current[sceneConfigId2] = { nodes: [], links: [] };
|
|
18115
18156
|
}
|
|
18116
|
-
|
|
18157
|
+
graphDataRef2.current[sceneConfigId2].nodes.push(newNode);
|
|
18117
18158
|
const sceneFileData = {
|
|
18118
18159
|
...sceneDataRef2.current,
|
|
18119
|
-
quest_nodes:
|
|
18120
|
-
quest_links:
|
|
18160
|
+
quest_nodes: graphDataRef2.current[sceneConfigId2].nodes,
|
|
18161
|
+
quest_links: graphDataRef2.current[sceneConfigId2].links,
|
|
18121
18162
|
quest_counter: currentCounter + 1
|
|
18122
18163
|
};
|
|
18123
18164
|
try {
|
|
@@ -18128,9 +18169,9 @@ function XViewScene({
|
|
|
18128
18169
|
ownerId: ownerId2,
|
|
18129
18170
|
datasetName: "Quests Internas (View)"
|
|
18130
18171
|
});
|
|
18131
|
-
sceneDataRef2.current.quest_nodes = [...
|
|
18172
|
+
sceneDataRef2.current.quest_nodes = [...graphDataRef2.current[sceneConfigId2].nodes];
|
|
18132
18173
|
if (parentDataRef.current[sceneConfigId2]) {
|
|
18133
|
-
parentDataRef.current[sceneConfigId2].nodes = [...
|
|
18174
|
+
parentDataRef.current[sceneConfigId2].nodes = [...graphDataRef2.current[sceneConfigId2].nodes];
|
|
18134
18175
|
}
|
|
18135
18176
|
const finalPosition = stateRef2.current.ghostElements.node ? stateRef2.current.ghostElements.node.position.clone() : stateRef2.current.controls.target.clone();
|
|
18136
18177
|
const { graphGroup, ghostElements } = stateRef2.current;
|
|
@@ -18152,26 +18193,26 @@ function XViewScene({
|
|
|
18152
18193
|
userActionHandlers.handleCompleteConnection = async (context, targetNodeData) => {
|
|
18153
18194
|
const {
|
|
18154
18195
|
stateRef: stateRef2,
|
|
18155
|
-
graphDataRef,
|
|
18196
|
+
graphDataRef: graphDataRef2,
|
|
18156
18197
|
sceneDataRef: sceneDataRef2,
|
|
18157
18198
|
sceneConfigId: sceneConfigId2,
|
|
18158
18199
|
sceneSaveUrl: sceneSaveUrl2,
|
|
18159
18200
|
ownerId: ownerId2
|
|
18160
18201
|
} = context;
|
|
18161
18202
|
const { sourceNodeData } = stateRef2.current.connection;
|
|
18162
|
-
if (!
|
|
18203
|
+
if (!graphDataRef2.current || !sceneDataRef2.current || !sourceNodeData || !targetNodeData) {
|
|
18163
18204
|
userActionHandlers.handleCancelConnection(context);
|
|
18164
18205
|
return;
|
|
18165
18206
|
}
|
|
18166
18207
|
const sourceParentInfo = getParentFileInfoForNode(
|
|
18167
|
-
|
|
18208
|
+
graphDataRef2.current,
|
|
18168
18209
|
sceneDataRef2.current,
|
|
18169
18210
|
sourceNodeData.id,
|
|
18170
18211
|
sceneConfigId2,
|
|
18171
18212
|
ownerId2
|
|
18172
18213
|
);
|
|
18173
18214
|
const targetParentInfo = getParentFileInfoForNode(
|
|
18174
|
-
|
|
18215
|
+
graphDataRef2.current,
|
|
18175
18216
|
sceneDataRef2.current,
|
|
18176
18217
|
targetNodeData.id,
|
|
18177
18218
|
sceneConfigId2,
|
|
@@ -18191,7 +18232,7 @@ function XViewScene({
|
|
|
18191
18232
|
};
|
|
18192
18233
|
try {
|
|
18193
18234
|
if (parentFileIdToSave === sceneConfigId2) {
|
|
18194
|
-
const specificParentData =
|
|
18235
|
+
const specificParentData = graphDataRef2.current[sceneConfigId2];
|
|
18195
18236
|
specificParentData.links.push(newLink);
|
|
18196
18237
|
const viewFilePayload = {
|
|
18197
18238
|
...sceneDataRef2.current,
|
|
@@ -18202,7 +18243,7 @@ function XViewScene({
|
|
|
18202
18243
|
await context.actions.save_view_data(sceneSaveUrl2, viewFilePayload);
|
|
18203
18244
|
} else {
|
|
18204
18245
|
const specificParentData = JSON.parse(
|
|
18205
|
-
JSON.stringify(
|
|
18246
|
+
JSON.stringify(graphDataRef2.current[parentFileIdToSave])
|
|
18206
18247
|
);
|
|
18207
18248
|
specificParentData.links.push(newLink);
|
|
18208
18249
|
const filenameForSpecificParent = `x_view_dbs/${ownerIdToSave}/${parentFileIdToSave}`;
|
|
@@ -18210,7 +18251,7 @@ function XViewScene({
|
|
|
18210
18251
|
filenameForSpecificParent,
|
|
18211
18252
|
specificParentData
|
|
18212
18253
|
);
|
|
18213
|
-
|
|
18254
|
+
graphDataRef2.current[parentFileIdToSave] = specificParentData;
|
|
18214
18255
|
}
|
|
18215
18256
|
addNewLinkToScene(stateRef2.current, newLink);
|
|
18216
18257
|
} catch (error) {
|
|
@@ -18257,7 +18298,7 @@ function XViewScene({
|
|
|
18257
18298
|
}
|
|
18258
18299
|
});
|
|
18259
18300
|
}
|
|
18260
|
-
const { ancestryGroup, nodeObjects
|
|
18301
|
+
const { ancestryGroup, nodeObjects, renderer, renderedAncestries } = stateRef.current;
|
|
18261
18302
|
const currentRenderLimit = stateRef.current.maxAncestryRenderIndex || 0;
|
|
18262
18303
|
const isFullRenderRequest = !normalizedAllowedIds;
|
|
18263
18304
|
const checkShouldRender = (section) => {
|
|
@@ -18361,10 +18402,10 @@ function XViewScene({
|
|
|
18361
18402
|
);
|
|
18362
18403
|
if (!fullTree) return;
|
|
18363
18404
|
const rootNodeId = String(ancestryObject.ancestral_node);
|
|
18364
|
-
let rootNodeMesh =
|
|
18405
|
+
let rootNodeMesh = nodeObjects[rootNodeId];
|
|
18365
18406
|
let originMesh = null;
|
|
18366
18407
|
if (ancestryObject._originNodeId) {
|
|
18367
|
-
originMesh =
|
|
18408
|
+
originMesh = nodeObjects[String(ancestryObject._originNodeId)];
|
|
18368
18409
|
}
|
|
18369
18410
|
let rootTargetPos = null;
|
|
18370
18411
|
if (originMesh) {
|
|
@@ -18578,7 +18619,7 @@ function XViewScene({
|
|
|
18578
18619
|
} else {
|
|
18579
18620
|
const traverseAndCollect = (item) => {
|
|
18580
18621
|
if (item.node) {
|
|
18581
|
-
const mesh =
|
|
18622
|
+
const mesh = nodeObjects[String(item.node.id)];
|
|
18582
18623
|
if (mesh) allRenderedNodePositions.push(mesh.position.clone());
|
|
18583
18624
|
}
|
|
18584
18625
|
if (item.children) item.children.forEach(traverseAndCollect);
|
|
@@ -18626,7 +18667,7 @@ function XViewScene({
|
|
|
18626
18667
|
const nodeIds = collectNodeIdsInSection(targetSectionForZone);
|
|
18627
18668
|
const vectors = [];
|
|
18628
18669
|
nodeIds.forEach((id) => {
|
|
18629
|
-
const mesh =
|
|
18670
|
+
const mesh = nodeObjects[String(id)];
|
|
18630
18671
|
if (mesh) {
|
|
18631
18672
|
const targetPos = targetPositionsCache.get(String(id));
|
|
18632
18673
|
vectors.push(targetPos ? targetPos.clone() : mesh.position.clone());
|
|
@@ -18685,8 +18726,8 @@ function XViewScene({
|
|
|
18685
18726
|
focusTargetPosition = targetPositionsCache.get(anchorId) || currentAnchorMesh.position.clone();
|
|
18686
18727
|
focusTargetRotation = baseRotation;
|
|
18687
18728
|
}
|
|
18688
|
-
} else if (activeSectionIdForFocus &&
|
|
18689
|
-
const directNode =
|
|
18729
|
+
} else if (activeSectionIdForFocus && nodeObjects[String(activeSectionIdForFocus)]) {
|
|
18730
|
+
const directNode = nodeObjects[String(activeSectionIdForFocus)];
|
|
18690
18731
|
const tPos = targetPositionsCache.get(String(activeSectionIdForFocus));
|
|
18691
18732
|
focusTargetPosition = tPos ? tPos.clone() : directNode.position.clone();
|
|
18692
18733
|
focusTargetRotation = baseRotation;
|
|
@@ -18737,7 +18778,7 @@ function XViewScene({
|
|
|
18737
18778
|
(prev) => prev.visible ? { ...prev, visible: false } : prev
|
|
18738
18779
|
);
|
|
18739
18780
|
if (!ancestryObject || !ancestryObject.abstraction_tree) return;
|
|
18740
|
-
const { ancestryGroup, nodeObjects
|
|
18781
|
+
const { ancestryGroup, nodeObjects, renderer, renderedAncestries } = stateRef.current;
|
|
18741
18782
|
const allParentNodes = Object.values(parentDataRef.current).flatMap(
|
|
18742
18783
|
(f) => f.nodes
|
|
18743
18784
|
);
|
|
@@ -18778,7 +18819,7 @@ function XViewScene({
|
|
|
18778
18819
|
const ancestryEntry = { id: absId, lines: [], isFullRender: true };
|
|
18779
18820
|
renderedAncestries.push(ancestryEntry);
|
|
18780
18821
|
const rootNodeId = String(fullTree.node.id);
|
|
18781
|
-
let rootNodeMesh =
|
|
18822
|
+
let rootNodeMesh = nodeObjects[rootNodeId];
|
|
18782
18823
|
let rootTargetPos = rootNodeMesh ? rootNodeMesh.position.clone() : new THREE3.Vector3(0, 0, 0);
|
|
18783
18824
|
if (!rootNodeMesh) {
|
|
18784
18825
|
rootNodeMesh = addOrUpdateNodeMesh(fullTree.node, rootTargetPos, true);
|
|
@@ -19890,8 +19931,8 @@ function XViewScene({
|
|
|
19890
19931
|
setSceneVersion((v) => v + 1);
|
|
19891
19932
|
const isView = ((_a2 = viewParams == null ? void 0 : viewParams.type) == null ? void 0 : _a2.toLowerCase()) === "view";
|
|
19892
19933
|
if (!isView || !save_view_data || !sceneSaveUrl) return;
|
|
19893
|
-
const { nodeObjects
|
|
19894
|
-
const currentNodes = Object.values(
|
|
19934
|
+
const { nodeObjects, allLinks } = stateRef.current;
|
|
19935
|
+
const currentNodes = Object.values(nodeObjects || {}).map((mesh) => {
|
|
19895
19936
|
const {
|
|
19896
19937
|
_baseEmissiveIntensity,
|
|
19897
19938
|
labelObject,
|
|
@@ -19930,15 +19971,15 @@ function XViewScene({
|
|
|
19930
19971
|
);
|
|
19931
19972
|
const handleSaveCurrentView = (0, import_react33.useCallback)(async () => {
|
|
19932
19973
|
var _a2, _b2, _c2;
|
|
19933
|
-
const { nodeObjects
|
|
19934
|
-
if (!
|
|
19974
|
+
const { nodeObjects, allLinks } = stateRef.current;
|
|
19975
|
+
if (!nodeObjects || !allLinks || !sceneSaveUrl || !parentDataRef.current) {
|
|
19935
19976
|
console.warn(
|
|
19936
19977
|
"N\xE3o \xE9 poss\xEDvel salvar a cena: estado n\xE3o inicializado ou URL de salvamento ausente."
|
|
19937
19978
|
);
|
|
19938
19979
|
return;
|
|
19939
19980
|
}
|
|
19940
19981
|
if (!save_view_data) return;
|
|
19941
|
-
const currentNodes = Object.values(
|
|
19982
|
+
const currentNodes = Object.values(nodeObjects).map((mesh) => {
|
|
19942
19983
|
const {
|
|
19943
19984
|
_baseEmissiveIntensity,
|
|
19944
19985
|
labelObject,
|
|
@@ -19993,8 +20034,8 @@ function XViewScene({
|
|
|
19993
20034
|
const detailsNodeDatasetInfo = detailsNode ? stateRef.current.nodeIdToParentFileMap.get(String(detailsNode.id)) : null;
|
|
19994
20035
|
(0, import_react33.useEffect)(() => {
|
|
19995
20036
|
if (isInitialized && focusNodeId && !hasFocusedInitial) {
|
|
19996
|
-
const
|
|
19997
|
-
const targetMesh =
|
|
20037
|
+
const nodeObjects = stateRef.current.nodeObjects || {};
|
|
20038
|
+
const targetMesh = nodeObjects[String(focusNodeId)];
|
|
19998
20039
|
if (targetMesh) {
|
|
19999
20040
|
setTimeout(() => {
|
|
20000
20041
|
tweenToTarget(targetMesh, 1.2);
|
|
@@ -20083,10 +20124,10 @@ function XViewScene({
|
|
|
20083
20124
|
if (isUiClear) {
|
|
20084
20125
|
const isView = ((_c2 = viewParams == null ? void 0 : viewParams.type) == null ? void 0 : _c2.toLowerCase()) === "view";
|
|
20085
20126
|
if (!isView) return;
|
|
20086
|
-
const { graphGroup, glowTexture, controls: sceneControls, nodeObjects
|
|
20127
|
+
const { graphGroup, glowTexture, controls: sceneControls, nodeObjects } = stateRef.current;
|
|
20087
20128
|
if (graphGroup) {
|
|
20088
20129
|
let ghostPosition = sceneControls.target.clone();
|
|
20089
|
-
const existingNodes = Object.values(
|
|
20130
|
+
const existingNodes = Object.values(nodeObjects);
|
|
20090
20131
|
let isOccupied = true;
|
|
20091
20132
|
let radius = 18;
|
|
20092
20133
|
let angle = 0;
|