@lv-x-software-house/x_view 1.2.1-dev.3 → 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
@@ -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;
@@ -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
@@ -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;
@@ -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.3",
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",