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

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
@@ -9125,17 +9125,6 @@ function XViewScene({
9125
9125
  (0, import_react23.useEffect)(() => {
9126
9126
  stateRef.current.ancestry = ancestryMode;
9127
9127
  }, [ancestryMode]);
9128
- (0, import_react23.useEffect)(() => {
9129
- if (isInitialized && focusNodeId && !hasFocusedInitial && stateRef.current.nodeObjects) {
9130
- const targetMesh = stateRef.current.nodeObjects[String(focusNodeId)];
9131
- if (targetMesh) {
9132
- setTimeout(() => {
9133
- tweenToTarget(targetMesh, 1.2);
9134
- setHasFocusedInitial(true);
9135
- }, 800);
9136
- }
9137
- }
9138
- }, [isInitialized, sceneVersion, focusNodeId, hasFocusedInitial, tweenToTarget]);
9139
9128
  (0, import_react23.useEffect)(() => {
9140
9129
  var _a2;
9141
9130
  if (!isInitialized) return;
@@ -11977,6 +11966,29 @@ function XViewScene({
11977
11966
  tweenToTarget(nodeMesh, 1.2);
11978
11967
  }
11979
11968
  }, [tweenToTarget]);
11969
+ (0, import_react23.useEffect)(() => {
11970
+ if (isInitialized && focusNodeId && !hasFocusedInitial) {
11971
+ const nodeObjects = stateRef.current.nodeObjects || {};
11972
+ const targetMesh = nodeObjects[String(focusNodeId)];
11973
+ if (targetMesh) {
11974
+ setTimeout(() => {
11975
+ tweenToTarget(targetMesh, 1.2);
11976
+ setHasFocusedInitial(true);
11977
+ }, 800);
11978
+ } 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
+ }
11989
+ }
11990
+ }
11991
+ }, [isInitialized, sceneVersion, focusNodeId, hasFocusedInitial, tweenToTarget, handleAddExistingNode]);
11980
11992
  if (isLoading || status === "loading" || permissionStatus === "loading") {
11981
11993
  return /* @__PURE__ */ import_react23.default.createElement(LoadingScreen, null);
11982
11994
  }
package/dist/index.mjs CHANGED
@@ -9121,17 +9121,6 @@ function XViewScene({
9121
9121
  useEffect20(() => {
9122
9122
  stateRef.current.ancestry = ancestryMode;
9123
9123
  }, [ancestryMode]);
9124
- useEffect20(() => {
9125
- if (isInitialized && focusNodeId && !hasFocusedInitial && stateRef.current.nodeObjects) {
9126
- const targetMesh = stateRef.current.nodeObjects[String(focusNodeId)];
9127
- if (targetMesh) {
9128
- setTimeout(() => {
9129
- tweenToTarget(targetMesh, 1.2);
9130
- setHasFocusedInitial(true);
9131
- }, 800);
9132
- }
9133
- }
9134
- }, [isInitialized, sceneVersion, focusNodeId, hasFocusedInitial, tweenToTarget]);
9135
9124
  useEffect20(() => {
9136
9125
  var _a2;
9137
9126
  if (!isInitialized) return;
@@ -11973,6 +11962,29 @@ function XViewScene({
11973
11962
  tweenToTarget(nodeMesh, 1.2);
11974
11963
  }
11975
11964
  }, [tweenToTarget]);
11965
+ useEffect20(() => {
11966
+ if (isInitialized && focusNodeId && !hasFocusedInitial) {
11967
+ const nodeObjects = stateRef.current.nodeObjects || {};
11968
+ const targetMesh = nodeObjects[String(focusNodeId)];
11969
+ if (targetMesh) {
11970
+ setTimeout(() => {
11971
+ tweenToTarget(targetMesh, 1.2);
11972
+ setHasFocusedInitial(true);
11973
+ }, 800);
11974
+ } 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
+ }
11985
+ }
11986
+ }
11987
+ }, [isInitialized, sceneVersion, focusNodeId, hasFocusedInitial, tweenToTarget, handleAddExistingNode]);
11976
11988
  if (isLoading || status === "loading" || permissionStatus === "loading") {
11977
11989
  return /* @__PURE__ */ React23.createElement(LoadingScreen, null);
11978
11990
  }
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.2",
3
+ "version": "1.2.1-dev.4",
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",