@lv-x-software-house/x_view 1.2.1-dev.3 → 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
@@ -9265,17 +9265,6 @@ function XViewScene({
9265
9265
  tweenGroup.add(cameraTween);
9266
9266
  cameraTween.start();
9267
9267
  }, []);
9268
- (0, import_react23.useEffect)(() => {
9269
- if (isInitialized && focusNodeId && !hasFocusedInitial && stateRef.current.nodeObjects) {
9270
- const targetMesh = stateRef.current.nodeObjects[String(focusNodeId)];
9271
- if (targetMesh) {
9272
- setTimeout(() => {
9273
- tweenToTarget(targetMesh, 1.2);
9274
- setHasFocusedInitial(true);
9275
- }, 800);
9276
- }
9277
- }
9278
- }, [isInitialized, sceneVersion, focusNodeId, hasFocusedInitial, tweenToTarget]);
9279
9268
  const isFromUiOverlay = (event) => {
9280
9269
  const t = event == null ? void 0 : event.target;
9281
9270
  if (!t || typeof t.closest !== "function") return false;
@@ -9652,12 +9641,20 @@ function XViewScene({
9652
9641
  const boardPromise = get_ancestry_board_action && session ? get_ancestry_board_action(configPath, sceneType, session, ownerId2) : Promise.resolve({ success: false, data: [] });
9653
9642
  const [sceneResponse, boardResponse] = await Promise.all([scenePromise, boardPromise]);
9654
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
+ }
9655
9655
  sceneDataRef.current = sceneResponse.data.scene;
9656
9656
  parentDataRef.current = sceneResponse.data.parent;
9657
9657
  ancestryDataRef.current = sceneResponse.data.ancestry;
9658
- console.log("Console de sceneDataRef.current no useEffect inicial:", sceneDataRef.current);
9659
- console.log("Console de parentDataRef.current no useEffect inicial:", parentDataRef.current);
9660
- console.log("Console de ancestryDataRef.current no useEffect inicial:", ancestryDataRef.current);
9661
9658
  setIsInitialized(true);
9662
9659
  } else {
9663
9660
  console.error("Falha ao buscar dados da cena:", (sceneResponse == null ? void 0 : sceneResponse.error) || "Resposta inv\xE1lida.");
@@ -9665,7 +9662,6 @@ function XViewScene({
9665
9662
  if (boardResponse == null ? void 0 : boardResponse.success) {
9666
9663
  setAncestryBoardData(boardResponse.data);
9667
9664
  } else {
9668
- console.warn("Ancestry Board n\xE3o carregado ou vazio:", boardResponse == null ? void 0 : boardResponse.error);
9669
9665
  setAncestryBoardData([]);
9670
9666
  }
9671
9667
  } catch (error) {
@@ -9689,11 +9685,12 @@ function XViewScene({
9689
9685
  status,
9690
9686
  ownerId,
9691
9687
  viewParams,
9692
- // Importante incluir viewParams nas dependências
9693
9688
  get_scene_view_data,
9694
9689
  get_ancestry_board_action,
9695
9690
  isInitialized,
9696
- permissionStatus
9691
+ permissionStatus,
9692
+ focusNodeId
9693
+ // <-- ADICIONADO O focusNodeId NAS DEPENDÊNCIAS
9697
9694
  ]);
9698
9695
  const isNodeInView = (0, import_react23.useCallback)((id) => {
9699
9696
  const key = String(id);
@@ -11977,6 +11974,20 @@ function XViewScene({
11977
11974
  tweenToTarget(nodeMesh, 1.2);
11978
11975
  }
11979
11976
  }, [tweenToTarget]);
11977
+ (0, import_react23.useEffect)(() => {
11978
+ if (isInitialized && focusNodeId && !hasFocusedInitial) {
11979
+ const nodeObjects = stateRef.current.nodeObjects || {};
11980
+ const targetMesh = nodeObjects[String(focusNodeId)];
11981
+ if (targetMesh) {
11982
+ setTimeout(() => {
11983
+ tweenToTarget(targetMesh, 1.2);
11984
+ setHasFocusedInitial(true);
11985
+ }, 300);
11986
+ } else {
11987
+ setHasFocusedInitial(true);
11988
+ }
11989
+ }
11990
+ }, [isInitialized, sceneVersion, focusNodeId, hasFocusedInitial, tweenToTarget]);
11980
11991
  if (isLoading || status === "loading" || permissionStatus === "loading") {
11981
11992
  return /* @__PURE__ */ import_react23.default.createElement(LoadingScreen, null);
11982
11993
  }
package/dist/index.mjs CHANGED
@@ -9261,17 +9261,6 @@ function XViewScene({
9261
9261
  tweenGroup.add(cameraTween);
9262
9262
  cameraTween.start();
9263
9263
  }, []);
9264
- useEffect20(() => {
9265
- if (isInitialized && focusNodeId && !hasFocusedInitial && stateRef.current.nodeObjects) {
9266
- const targetMesh = stateRef.current.nodeObjects[String(focusNodeId)];
9267
- if (targetMesh) {
9268
- setTimeout(() => {
9269
- tweenToTarget(targetMesh, 1.2);
9270
- setHasFocusedInitial(true);
9271
- }, 800);
9272
- }
9273
- }
9274
- }, [isInitialized, sceneVersion, focusNodeId, hasFocusedInitial, tweenToTarget]);
9275
9264
  const isFromUiOverlay = (event) => {
9276
9265
  const t = event == null ? void 0 : event.target;
9277
9266
  if (!t || typeof t.closest !== "function") return false;
@@ -9648,12 +9637,20 @@ function XViewScene({
9648
9637
  const boardPromise = get_ancestry_board_action && session ? get_ancestry_board_action(configPath, sceneType, session, ownerId2) : Promise.resolve({ success: false, data: [] });
9649
9638
  const [sceneResponse, boardResponse] = await Promise.all([scenePromise, boardPromise]);
9650
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
+ }
9651
9651
  sceneDataRef.current = sceneResponse.data.scene;
9652
9652
  parentDataRef.current = sceneResponse.data.parent;
9653
9653
  ancestryDataRef.current = sceneResponse.data.ancestry;
9654
- console.log("Console de sceneDataRef.current no useEffect inicial:", sceneDataRef.current);
9655
- console.log("Console de parentDataRef.current no useEffect inicial:", parentDataRef.current);
9656
- console.log("Console de ancestryDataRef.current no useEffect inicial:", ancestryDataRef.current);
9657
9654
  setIsInitialized(true);
9658
9655
  } else {
9659
9656
  console.error("Falha ao buscar dados da cena:", (sceneResponse == null ? void 0 : sceneResponse.error) || "Resposta inv\xE1lida.");
@@ -9661,7 +9658,6 @@ function XViewScene({
9661
9658
  if (boardResponse == null ? void 0 : boardResponse.success) {
9662
9659
  setAncestryBoardData(boardResponse.data);
9663
9660
  } else {
9664
- console.warn("Ancestry Board n\xE3o carregado ou vazio:", boardResponse == null ? void 0 : boardResponse.error);
9665
9661
  setAncestryBoardData([]);
9666
9662
  }
9667
9663
  } catch (error) {
@@ -9685,11 +9681,12 @@ function XViewScene({
9685
9681
  status,
9686
9682
  ownerId,
9687
9683
  viewParams,
9688
- // Importante incluir viewParams nas dependências
9689
9684
  get_scene_view_data,
9690
9685
  get_ancestry_board_action,
9691
9686
  isInitialized,
9692
- permissionStatus
9687
+ permissionStatus,
9688
+ focusNodeId
9689
+ // <-- ADICIONADO O focusNodeId NAS DEPENDÊNCIAS
9693
9690
  ]);
9694
9691
  const isNodeInView = useCallback3((id) => {
9695
9692
  const key = String(id);
@@ -11973,6 +11970,20 @@ function XViewScene({
11973
11970
  tweenToTarget(nodeMesh, 1.2);
11974
11971
  }
11975
11972
  }, [tweenToTarget]);
11973
+ useEffect20(() => {
11974
+ if (isInitialized && focusNodeId && !hasFocusedInitial) {
11975
+ const nodeObjects = stateRef.current.nodeObjects || {};
11976
+ const targetMesh = nodeObjects[String(focusNodeId)];
11977
+ if (targetMesh) {
11978
+ setTimeout(() => {
11979
+ tweenToTarget(targetMesh, 1.2);
11980
+ setHasFocusedInitial(true);
11981
+ }, 300);
11982
+ } else {
11983
+ setHasFocusedInitial(true);
11984
+ }
11985
+ }
11986
+ }, [isInitialized, sceneVersion, focusNodeId, hasFocusedInitial, tweenToTarget]);
11976
11987
  if (isLoading || status === "loading" || permissionStatus === "loading") {
11977
11988
  return /* @__PURE__ */ React23.createElement(LoadingScreen, null);
11978
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.3",
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",