@ntalmagor/3drize-viewer 0.1.21 → 0.1.22

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.
@@ -13,8 +13,8 @@ const GalleryLayout = ({ createdObject, selectedFrameUrl, handleObjectClick, })
13
13
  outerFrameScale: 1,
14
14
  };
15
15
  const { frames, layoutSettings } = useMemo(() => updateCurrentLayoutSettings(galleryLayout), [galleryLayout]);
16
- console.log('GalleryLayout - frames:', frames);
17
- console.log('GalleryLayout - layoutSettings:', layoutSettings);
16
+ // console.log('GalleryLayout - frames:', frames);
17
+ // console.log('GalleryLayout - layoutSettings:', layoutSettings);
18
18
  return (_jsx("group", { ref: groupRef, scale: [1, 1, 1], position: [0, 0, 0], rotation: [0, 0, 0], children: frames.map((frame, index) => (_jsxs(Frame, { url: frame.url, isActive: selectedFrameUrl === frame.url, createdObject: createdObject, position: frame.position, rotation: frame.rotation, hoverSettings: { sensitivity: 0.5, applyToChildren: false }, transformEffects: animations?.transform?.effects || [], layoutSettings: layoutSettings, side: galleryLayout?.side || 2, materialSettings: materialSettings, handleObjectClick: handleObjectClick, children: [layoutSettings.geometryType !== 'none' && (_jsx(ImageGeometry, { url: frame.url, geometryType: layoutSettings.geometryType, outerFrameScale: layoutSettings.outerFrameScale })), createdObject.effects?.map((effect, effectIndex) => (_jsx(EffectsGenerator, { settings: effect }, effectIndex)))] }, index))) }));
19
19
  };
20
20
  export default GalleryLayout;
@@ -1 +1 @@
1
- {"version":3,"file":"LoadingIndicator.d.ts","sourceRoot":"","sources":["../../src/components/LoadingIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAqBrD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"LoadingIndicator.d.ts","sourceRoot":"","sources":["../../src/components/LoadingIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAmBrD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -1,6 +1,6 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import RiseLogo from './RiseLogo.js';
3
3
  const LoadingIndicator = ({ text, fullScreen = false, animate = true, size = 80, }) => {
4
- return (_jsxs("div", { children: [text && _jsx("div", { className: "loading-text", children: text }), _jsx(RiseLogo, { size: size, animated: animate, loop: true })] }));
4
+ return (_jsxs(_Fragment, { children: [text && _jsx("div", { className: "loading-text", children: text }), _jsx(RiseLogo, { size: size, animated: animate, loop: true })] }));
5
5
  };
6
6
  export default LoadingIndicator;
@@ -4,6 +4,7 @@ import { Object3D } from "three";
4
4
  import { type ThreeEvent } from '@react-three/fiber';
5
5
  type ProjectProps = {
6
6
  projectId: string;
7
+ loadingIndicator?: React.ReactNode;
7
8
  onObjectClick?: (object: CreatedObjectSettings, ref: Object3D, event: ThreeEvent<MouseEvent>) => void;
8
9
  onObjectHover?: (object: CreatedObjectSettings, ref: Object3D) => void;
9
10
  onElementClick?: (element: HtmlElement) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"ProjectLoader.d.ts","sourceRoot":"","sources":["../../src/components/ProjectLoader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAGnD,OAAQ,EAAE,KAAK,qBAAqB,EAAkB,KAAK,WAAW,EAAwB,MAAM,wBAAwB,CAAC;AAG7H,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIrD,KAAK,YAAY,GAAG;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IACtG,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;IACvE,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IAChD,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IACvD,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;CACnC,CAAC;AAEF,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAuGzC,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"ProjectLoader.d.ts","sourceRoot":"","sources":["../../src/components/ProjectLoader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAGnD,OAAQ,EAAE,KAAK,qBAAqB,EAAkB,KAAK,WAAW,EAAwB,MAAM,wBAAwB,CAAC;AAG7H,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIrD,KAAK,YAAY,GAAG;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IACtG,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;IACvE,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IAChD,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IACvD,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;CACnC,CAAC;AAEF,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA8GzC,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -6,7 +6,7 @@ import { loadAssets } from "@ntalmagor/3drize-core";
6
6
  import { useMeshController } from '@ntalmagor/3drize-viewer';
7
7
  import LoadingIndicator from "./LoadingIndicator.js";
8
8
  const PROJECT_LOADER_DEBUG_PREFIX = '[ProjectLoaderDebug]';
9
- const ProjectLoader = ({ projectId, onObjectClick, onObjectHover, onElementClick, onElementHover, onSceneInitialized }) => {
9
+ const ProjectLoader = ({ projectId, onObjectClick, onObjectHover, onElementClick, onElementHover, onSceneInitialized, loadingIndicator = _jsx(LoadingIndicator, { text: "Loading project...", fullScreen: true, animate: true }) }) => {
10
10
  const [project, setProject] = useState(null);
11
11
  const meshController = useMeshController();
12
12
  useEffect(() => {
@@ -40,11 +40,11 @@ const ProjectLoader = ({ projectId, onObjectClick, onObjectHover, onElementClick
40
40
  throw new Error(`HTTP error! status: ${response.status}`);
41
41
  }
42
42
  const responseData = await response.json();
43
- console.log(PROJECT_LOADER_DEBUG_PREFIX, 'Parsed project payload', {
44
- projectId,
45
- sceneObjectsCount: responseData.sceneObjects?.length || 0,
46
- projectName: responseData.name,
47
- });
43
+ // console.log(PROJECT_LOADER_DEBUG_PREFIX, 'Parsed project payload', {
44
+ // projectId,
45
+ // sceneObjectsCount: responseData.sceneObjects?.length || 0,
46
+ // projectName: responseData.name,
47
+ // });
48
48
  console.log("Loaded project:", responseData);
49
49
  const sceneObjects = responseData.sceneObjects || [];
50
50
  const modelObjects = sceneObjects.filter(obj => obj.type === 'model');
@@ -79,7 +79,12 @@ const ProjectLoader = ({ projectId, onObjectClick, onObjectHover, onElementClick
79
79
  }
80
80
  };
81
81
  if (!project) {
82
- return _jsx(LoadingIndicator, { text: "Loading project...", fullScreen: true });
82
+ return _jsx("div", { style: {
83
+ width: '100%', height: '100%', display: 'flex',
84
+ alignItems: 'center', justifyContent: 'center',
85
+ backgroundColor: 'black',
86
+ flexDirection: 'column', gap: '1rem'
87
+ }, children: loadingIndicator });
83
88
  }
84
89
  return _jsx(_Fragment, { children: _jsx(SceneBuilder, { project: project, onSceneInitialized: onSceneInitialized, onUiElementClick: onElementClick, onUiElementHover: onElementHover, onObjectClick: onObjectClick }) });
85
90
  };
@@ -6,7 +6,7 @@
6
6
  // Three.js object. Uses shared utilities from materialApplicationUtils.
7
7
  //
8
8
  import { useEffect, useRef } from 'react';
9
- import { createAndApplyMaterial, MATERIAL_INSTANCE_KEY, MaterialRegistryAPI, ObjectManager, resolveTextures } from '@ntalmagor/3drize-core';
9
+ import { createAndApplyMaterial, MATERIAL_INSTANCE_KEY, MaterialRegistryAPI, ObjectManager, resolveTextures, traverseSkippingEdges } from '@ntalmagor/3drize-core';
10
10
  export const useMaterialApplication = (obj, materialSettings, shouldApply3driseMaterial, onApplied) => {
11
11
  // Track all material instances we've created so we can release them on change/unmount
12
12
  const activeInstancesRef = useRef([]);
@@ -39,7 +39,7 @@ export const useMaterialApplication = (obj, materialSettings, shouldApply3driseM
39
39
  activeInstancesRef.current = [];
40
40
  };
41
41
  const handleSettingsChange = async (obj, materialSettings) => {
42
- console.log('Applying material with settings:', obj);
42
+ // console.log('Applying material with settings:', obj);
43
43
  if (!obj || !materialSettings || materialSettings.materialType === 'advanced' || !materialSettings.materialVariant)
44
44
  return;
45
45
  const applyMaterial = materialSettings.apply !== undefined ? materialSettings.apply : true;
@@ -60,11 +60,11 @@ export const useMaterialApplication = (obj, materialSettings, shouldApply3driseM
60
60
  // 1. Resolve textures using shared utility (registry-driven TextureResolver)
61
61
  const resolvedSettings = await resolveTextures(variant, materialSettings);
62
62
  // 2. Traverse the object tree and apply material to any child with .material.
63
- // traverseSkippingEdges(obj, true, (child: any) => {
64
- // if (child.material) {
65
- // applyMaterialToChild(child, variant, resolvedSettings);
66
- // }
67
- // });
63
+ traverseSkippingEdges(obj, true, (child) => {
64
+ if (child.material) {
65
+ applyMaterialToChild(child, variant, resolvedSettings);
66
+ }
67
+ });
68
68
  onApplied?.();
69
69
  };
70
70
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ntalmagor/3drize-viewer",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",