@lv-x-software-house/x_view 1.2.1-dev.4 → 1.2.1-dev.5

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 CHANGED
@@ -9641,12 +9641,20 @@ function XViewScene({
9641
9641
  const boardPromise = get_ancestry_board_action && session ? get_ancestry_board_action(configPath, sceneType, session, ownerId2) : Promise.resolve({ success: false, data: [] });
9642
9642
  const [sceneResponse, boardResponse] = await Promise.all([scenePromise, boardPromise]);
9643
9643
  if ((sceneResponse == null ? void 0 : sceneResponse.success) && ((_a2 = sceneResponse.data) == null ? void 0 : _a2.scene) && ((_b2 = sceneResponse.data) == null ? void 0 : _b2.parent)) {
9644
+ if (focusNodeId) {
9645
+ let targetNode = sceneResponse.data.scene.nodes.find((n) => String(n.id) === String(focusNodeId));
9646
+ if (!targetNode) {
9647
+ const allParentNodes = Object.values(sceneResponse.data.parent).flatMap((f) => f.nodes || []);
9648
+ targetNode = allParentNodes.find((n) => String(n.id) === String(focusNodeId));
9649
+ }
9650
+ if (targetNode) {
9651
+ sceneResponse.data.scene.nodes = [targetNode];
9652
+ sceneResponse.data.scene.links = [];
9653
+ }
9654
+ }
9644
9655
  sceneDataRef.current = sceneResponse.data.scene;
9645
9656
  parentDataRef.current = sceneResponse.data.parent;
9646
9657
  ancestryDataRef.current = sceneResponse.data.ancestry;
9647
- console.log("Console de sceneDataRef.current no useEffect inicial:", sceneDataRef.current);
9648
- console.log("Console de parentDataRef.current no useEffect inicial:", parentDataRef.current);
9649
- console.log("Console de ancestryDataRef.current no useEffect inicial:", ancestryDataRef.current);
9650
9658
  setIsInitialized(true);
9651
9659
  } else {
9652
9660
  console.error("Falha ao buscar dados da cena:", (sceneResponse == null ? void 0 : sceneResponse.error) || "Resposta inv\xE1lida.");
@@ -9654,7 +9662,6 @@ function XViewScene({
9654
9662
  if (boardResponse == null ? void 0 : boardResponse.success) {
9655
9663
  setAncestryBoardData(boardResponse.data);
9656
9664
  } else {
9657
- console.warn("Ancestry Board n\xE3o carregado ou vazio:", boardResponse == null ? void 0 : boardResponse.error);
9658
9665
  setAncestryBoardData([]);
9659
9666
  }
9660
9667
  } catch (error) {
@@ -9678,11 +9685,12 @@ function XViewScene({
9678
9685
  status,
9679
9686
  ownerId,
9680
9687
  viewParams,
9681
- // Importante incluir viewParams nas dependências
9682
9688
  get_scene_view_data,
9683
9689
  get_ancestry_board_action,
9684
9690
  isInitialized,
9685
- permissionStatus
9691
+ permissionStatus,
9692
+ focusNodeId
9693
+ // <-- ADICIONADO O focusNodeId NAS DEPENDÊNCIAS
9686
9694
  ]);
9687
9695
  const isNodeInView = (0, import_react23.useCallback)((id) => {
9688
9696
  const key = String(id);
@@ -11974,21 +11982,12 @@ function XViewScene({
11974
11982
  setTimeout(() => {
11975
11983
  tweenToTarget(targetMesh, 1.2);
11976
11984
  setHasFocusedInitial(true);
11977
- }, 800);
11985
+ }, 300);
11978
11986
  } else {
11979
- const allParentNodes = Object.values(parentDataRef.current || {}).flatMap((f) => f.nodes || []);
11980
- const nodeExistsInDb = allParentNodes.find((n) => String(n.id) === String(focusNodeId));
11981
- if (nodeExistsInDb) {
11982
- setTimeout(() => {
11983
- handleAddExistingNode(focusNodeId);
11984
- setHasFocusedInitial(true);
11985
- }, 800);
11986
- } else if (Object.keys(nodeObjects).length > 0) {
11987
- setHasFocusedInitial(true);
11988
- }
11987
+ setHasFocusedInitial(true);
11989
11988
  }
11990
11989
  }
11991
- }, [isInitialized, sceneVersion, focusNodeId, hasFocusedInitial, tweenToTarget, handleAddExistingNode]);
11990
+ }, [isInitialized, sceneVersion, focusNodeId, hasFocusedInitial, tweenToTarget]);
11992
11991
  if (isLoading || status === "loading" || permissionStatus === "loading") {
11993
11992
  return /* @__PURE__ */ import_react23.default.createElement(LoadingScreen, null);
11994
11993
  }
package/dist/index.mjs CHANGED
@@ -9637,12 +9637,20 @@ function XViewScene({
9637
9637
  const boardPromise = get_ancestry_board_action && session ? get_ancestry_board_action(configPath, sceneType, session, ownerId2) : Promise.resolve({ success: false, data: [] });
9638
9638
  const [sceneResponse, boardResponse] = await Promise.all([scenePromise, boardPromise]);
9639
9639
  if ((sceneResponse == null ? void 0 : sceneResponse.success) && ((_a2 = sceneResponse.data) == null ? void 0 : _a2.scene) && ((_b2 = sceneResponse.data) == null ? void 0 : _b2.parent)) {
9640
+ if (focusNodeId) {
9641
+ let targetNode = sceneResponse.data.scene.nodes.find((n) => String(n.id) === String(focusNodeId));
9642
+ if (!targetNode) {
9643
+ const allParentNodes = Object.values(sceneResponse.data.parent).flatMap((f) => f.nodes || []);
9644
+ targetNode = allParentNodes.find((n) => String(n.id) === String(focusNodeId));
9645
+ }
9646
+ if (targetNode) {
9647
+ sceneResponse.data.scene.nodes = [targetNode];
9648
+ sceneResponse.data.scene.links = [];
9649
+ }
9650
+ }
9640
9651
  sceneDataRef.current = sceneResponse.data.scene;
9641
9652
  parentDataRef.current = sceneResponse.data.parent;
9642
9653
  ancestryDataRef.current = sceneResponse.data.ancestry;
9643
- console.log("Console de sceneDataRef.current no useEffect inicial:", sceneDataRef.current);
9644
- console.log("Console de parentDataRef.current no useEffect inicial:", parentDataRef.current);
9645
- console.log("Console de ancestryDataRef.current no useEffect inicial:", ancestryDataRef.current);
9646
9654
  setIsInitialized(true);
9647
9655
  } else {
9648
9656
  console.error("Falha ao buscar dados da cena:", (sceneResponse == null ? void 0 : sceneResponse.error) || "Resposta inv\xE1lida.");
@@ -9650,7 +9658,6 @@ function XViewScene({
9650
9658
  if (boardResponse == null ? void 0 : boardResponse.success) {
9651
9659
  setAncestryBoardData(boardResponse.data);
9652
9660
  } else {
9653
- console.warn("Ancestry Board n\xE3o carregado ou vazio:", boardResponse == null ? void 0 : boardResponse.error);
9654
9661
  setAncestryBoardData([]);
9655
9662
  }
9656
9663
  } catch (error) {
@@ -9674,11 +9681,12 @@ function XViewScene({
9674
9681
  status,
9675
9682
  ownerId,
9676
9683
  viewParams,
9677
- // Importante incluir viewParams nas dependências
9678
9684
  get_scene_view_data,
9679
9685
  get_ancestry_board_action,
9680
9686
  isInitialized,
9681
- permissionStatus
9687
+ permissionStatus,
9688
+ focusNodeId
9689
+ // <-- ADICIONADO O focusNodeId NAS DEPENDÊNCIAS
9682
9690
  ]);
9683
9691
  const isNodeInView = useCallback3((id) => {
9684
9692
  const key = String(id);
@@ -11970,21 +11978,12 @@ function XViewScene({
11970
11978
  setTimeout(() => {
11971
11979
  tweenToTarget(targetMesh, 1.2);
11972
11980
  setHasFocusedInitial(true);
11973
- }, 800);
11981
+ }, 300);
11974
11982
  } else {
11975
- const allParentNodes = Object.values(parentDataRef.current || {}).flatMap((f) => f.nodes || []);
11976
- const nodeExistsInDb = allParentNodes.find((n) => String(n.id) === String(focusNodeId));
11977
- if (nodeExistsInDb) {
11978
- setTimeout(() => {
11979
- handleAddExistingNode(focusNodeId);
11980
- setHasFocusedInitial(true);
11981
- }, 800);
11982
- } else if (Object.keys(nodeObjects).length > 0) {
11983
- setHasFocusedInitial(true);
11984
- }
11983
+ setHasFocusedInitial(true);
11985
11984
  }
11986
11985
  }
11987
- }, [isInitialized, sceneVersion, focusNodeId, hasFocusedInitial, tweenToTarget, handleAddExistingNode]);
11986
+ }, [isInitialized, sceneVersion, focusNodeId, hasFocusedInitial, tweenToTarget]);
11988
11987
  if (isLoading || status === "loading" || permissionStatus === "loading") {
11989
11988
  return /* @__PURE__ */ React23.createElement(LoadingScreen, null);
11990
11989
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lv-x-software-house/x_view",
3
- "version": "1.2.1-dev.4",
3
+ "version": "1.2.1-dev.5",
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",