@terraware/web-components 4.3.1-rc.0 → 4.3.1-rc.1

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.
@@ -46,7 +46,8 @@ const SplatControls = ({
46
46
  }) => {
47
47
  const theme = useTheme();
48
48
  const {
49
- isDesktop
49
+ isDesktop,
50
+ isMobile
50
51
  } = useDeviceInfo();
51
52
  const {
52
53
  setCamera,
@@ -139,10 +140,10 @@ const SplatControls = ({
139
140
  gap: 1,
140
141
  pointerEvents: 'auto'
141
142
  },
142
- children: [isXrAvailable('AR') && !isEdit && /*#__PURE__*/jsx(Button, {
143
+ children: [isMobile && isXrAvailable('AR') && !isEdit && /*#__PURE__*/jsx(Button, {
143
144
  label: strings.ar,
144
145
  onClick: () => startXr('AR')
145
- }), isXrAvailable('VR') && !isEdit && /*#__PURE__*/jsx(Button, {
146
+ }), !isMobile && isXrAvailable('VR') && !isEdit && /*#__PURE__*/jsx(Button, {
146
147
  label: strings.vr,
147
148
  onClick: () => startXr('VR')
148
149
  }), isDesktop && editable && !isEdit && onToggleEdit && /*#__PURE__*/jsx(Button, {
@@ -1 +1 @@
1
- {"version":3,"file":"VirtualWalkthroughViewer.d.ts","sourceRoot":"","sources":["../../../src/components/VirtualWalkthrough/VirtualWalkthroughViewer.tsx"],"names":[],"mappings":"AAYA,OAAmB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAM3D,OAAsB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAUtE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAkB5C;;;;GAIG;AACH,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,6CAA6C;IAC7C,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,8CAA8C;IAC9C,cAAc,CAAC,EAAE,CAAC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, [cameraPosition, sceneBounds, origin]);
103
103
  const sceneBoundsCenter = useMemo(() => sceneBounds ? new Vec3(sceneBounds.x, sceneBounds.y, sceneBounds.z) : new Vec3(origin[0], cameraPosition[1], origin[2]), [sceneBounds, origin, cameraPosition]);
104
104
  const groundPlane = useMemo(() => groundPlaneProp?.length === 3 ? groundPlaneProp.map(p => new Vec3(p[0], p[1], p[2])) : [], [groundPlaneProp]);
105
+
106
+ // Also runs when a session ends. WalkthroughCamera is unmounted for the duration of a session, so
107
+ // the camera entity is left holding the last head pose — an eye height above wherever in the rig
108
+ // the user was standing — which is neither where nor how high the walkthrough left off.
105
109
  useEffect(() => {
110
+ if (isCurrentlyInXr) {
111
+ return;
112
+ }
106
113
  setCamera(origin, cameraPosition);
107
- }, [origin, cameraPosition, setCamera]);
114
+ }, [origin, cameraPosition, setCamera, isCurrentlyInXr]);
115
+
116
+ // Re-applied when a session ends for the same reason: the script that comes back is a new
117
+ // instance, and without the ground plane it walks the camera at the bounds centre's height
118
+ // instead of an eye height above the ground.
108
119
  useEffect(() => {
109
- if (!groundPlane.length) {
120
+ if (!groundPlane.length || isCurrentlyInXr) {
110
121
  return;
111
122
  }
112
123
  // @ts-expect-error - scripts are added dynamically to the camera entity
@@ -115,7 +126,7 @@ const VirtualWalkthroughViewer = ({
115
126
  // Should be changed to a react prop if shallowEquals in playcanvas/react is fixed (see https://github.com/playcanvas/react/pull/298)
116
127
  walkthroughCam.groundPlane = groundPlane;
117
128
  }
118
- }, [groundPlane, app]);
129
+ }, [groundPlane, app, isCurrentlyInXr]);
119
130
  useEffect(() => {
120
131
  // Set imperatively for the same reason as BoundaryRing: boundsCenter is a Vec3, and the
121
132
  // @playcanvas/react memo() comparator stops at the first prop with an .equals() method.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@terraware/web-components",
3
- "version": "4.3.1-rc.0",
3
+ "version": "4.3.1-rc.1",
4
4
  "author": "Terraformation Inc.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {