@webspatial/react-sdk 0.0.15 → 0.0.16-alpha.0

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/web/index.js CHANGED
@@ -194,7 +194,8 @@ function simplifyEntityTree(rootTree) {
194
194
  cornerRadius: node.components[0].cornerRadius,
195
195
  backgroundMaterial: node.components[0].backgroundMaterial,
196
196
  isOpaque: node.components[0].isOpaque,
197
- isScrollEnabled: node.components[0].isScrollEnabled
197
+ isScrollEnabled: node.components[0].isScrollEnabled,
198
+ scrollWithParent: node.components[0].scrollWithParent
198
199
  };
199
200
  nodeMap[node.id] = newNode;
200
201
  if (!parent) {
@@ -531,9 +532,9 @@ var SpatialWindowManager = class {
531
532
  this.initPromise = this.initInternalFromWindow();
532
533
  await this.initPromise;
533
534
  }
534
- async resize(rect, offset, rotation = { x: 0, y: 0, z: 0, w: 1 }, scale = { x: 1, y: 1, z: 1 }, rotationOrigin = { x: 0, y: 0, z: 0 }) {
535
+ async resize(rect, offset, rotation = { x: 0, y: 0, z: 0, w: 1 }, scale = { x: 1, y: 1, z: 1 }, rotationOrigin = { x: 0, y: 0, z: 0 }, parrentOffset = 0) {
535
536
  let targetPosX = rect.x + rect.width / 2;
536
- let targetPosY = rect.y + rect.height / 2 + window.scrollY;
537
+ let targetPosY = rect.y + rect.height / 2 + parrentOffset;
537
538
  if (!this.webview) {
538
539
  return;
539
540
  }
@@ -948,7 +949,7 @@ function syncDefaultSpatialStyle(openedWindow, debugName) {
948
949
  openedWindow.document.head.appendChild(styleElement);
949
950
  openedWindow.document.body.style.display = "inline-block";
950
951
  }
951
- function useSyncSpatialProps(spatialWindowManager, props, domRect, anchor, cornerRadiusFromStyle, opacity, stylePosition) {
952
+ function useSyncSpatialProps(spatialWindowManager, props, domRect, anchor, cornerRadiusFromStyle, opacity, stylePosition, isSubPortal) {
952
953
  let { allowScroll, scrollWithParent, style, spatialStyle = {} } = props;
953
954
  let {
954
955
  position = { x: 0, y: 0, z: 1 },
@@ -1041,7 +1042,8 @@ function useSyncSpatialProps(spatialWindowManager, props, domRect, anchor, corne
1041
1042
  position,
1042
1043
  rotation,
1043
1044
  scale,
1044
- anchor
1045
+ anchor,
1046
+ isSubPortal ? 0 : window.scrollY
1045
1047
  );
1046
1048
  spatialWindowManager?.setZIndex(zIndex);
1047
1049
  })();
@@ -1205,7 +1207,8 @@ function PortalInstance(inProps) {
1205
1207
  anchor,
1206
1208
  cornerRadius,
1207
1209
  opacity,
1208
- inheritedPortalStyle.position
1210
+ inheritedPortalStyle.position,
1211
+ isSubPortal
1209
1212
  );
1210
1213
  const JSXPortalInstance = renderJSXPortalInstance(
1211
1214
  props,
@@ -2422,7 +2425,7 @@ var Model3DNative = class {
2422
2425
  return;
2423
2426
  }
2424
2427
  const targetPosX = rect.x + rect.width / 2;
2425
- const targetPosY = rect.y + rect.height / 2 + window.scrollY;
2428
+ const targetPosY = rect.y + rect.height / 2;
2426
2429
  const { position, rotation, scale } = spatialTransform;
2427
2430
  const entity = this.entity;
2428
2431
  entity.transform.position.x = targetPosX + position.x;
@@ -3344,6 +3347,16 @@ function ModelBase(inProps, ref) {
3344
3347
  );
3345
3348
  const isWebEnv = !getSession();
3346
3349
  if (isWebEnv) {
3350
+ useEffect16(() => {
3351
+ if (gltfSourceURL == "") {
3352
+ console.warn("Unable to display model, no gltf/glb source provided");
3353
+ if (props2.onLoad) {
3354
+ props2.onLoad({
3355
+ target: { ready: false, currentSrc: gltfSourceURL }
3356
+ });
3357
+ }
3358
+ }
3359
+ }, []);
3347
3360
  const myModelViewer = useRef12(null);
3348
3361
  const { className, style = {}, ...props2 } = inProps;
3349
3362
  const isDragging = useRef12(false);