@reactvision/react-viro 2.41.6 → 2.43.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/android/react_viro/react_viro-release.aar +0 -0
- package/components/AR/ViroARPlaneSelector.tsx +76 -37
- package/components/AR/ViroARScene.tsx +7 -4
- package/components/AR/ViroARSceneNavigator.tsx +1 -2
- package/components/Utilities/ViroVersion.ts +1 -1
- package/components/Viro3DSceneNavigator.tsx +1 -1
- package/components/ViroCamera.tsx +1 -0
- package/components/ViroOrbitCamera.tsx +1 -0
- package/components/ViroScene.tsx +7 -3
- package/components/ViroSceneContext.tsx +4 -3
- package/components/ViroSceneNavigator.tsx +1 -1
- package/dist/components/AR/ViroARCamera.d.ts +1 -1
- package/dist/components/AR/ViroARCamera.js +17 -7
- package/dist/components/AR/ViroARImageMarker.d.ts +2 -2
- package/dist/components/AR/ViroARImageMarker.js +17 -7
- package/dist/components/AR/ViroARObjectMarker.d.ts +2 -2
- package/dist/components/AR/ViroARObjectMarker.js +17 -7
- package/dist/components/AR/ViroARPlane.d.ts +2 -2
- package/dist/components/AR/ViroARPlane.js +17 -7
- package/dist/components/AR/ViroARPlaneSelector.d.ts +3 -3
- package/dist/components/AR/ViroARPlaneSelector.js +63 -25
- package/dist/components/AR/ViroARScene.d.ts +2 -2
- package/dist/components/AR/ViroARScene.js +17 -7
- package/dist/components/AR/ViroARSceneNavigator.d.ts +2 -2
- package/dist/components/AR/ViroARSceneNavigator.js +17 -9
- package/dist/components/Types/ViroEvents.d.ts +6 -6
- package/dist/components/Types/ViroEvents.js +6 -6
- package/dist/components/Types/ViroUtils.d.ts +0 -1
- package/dist/components/Utilities/ViroProps.js +1 -2
- package/dist/components/Utilities/ViroUtils.js +3 -4
- package/dist/components/Utilities/ViroVersion.d.ts +1 -1
- package/dist/components/Utilities/ViroVersion.js +1 -1
- package/dist/components/Viro360Image.d.ts +1 -1
- package/dist/components/Viro360Image.js +17 -7
- package/dist/components/Viro360Video.d.ts +1 -1
- package/dist/components/Viro360Video.js +17 -7
- package/dist/components/Viro3DObject.d.ts +2 -2
- package/dist/components/Viro3DObject.js +17 -7
- package/dist/components/Viro3DSceneNavigator.d.ts +2 -2
- package/dist/components/Viro3DSceneNavigator.js +17 -7
- package/dist/components/ViroAmbientLight.d.ts +1 -1
- package/dist/components/ViroAmbientLight.js +17 -7
- package/dist/components/ViroAnimatedComponent.d.ts +1 -1
- package/dist/components/ViroAnimatedComponent.js +17 -7
- package/dist/components/ViroAnimatedImage.d.ts +2 -2
- package/dist/components/ViroAnimatedImage.js +17 -7
- package/dist/components/ViroBase.js +17 -7
- package/dist/components/ViroBox.d.ts +2 -2
- package/dist/components/ViroBox.js +17 -7
- package/dist/components/ViroButton.d.ts +1 -1
- package/dist/components/ViroButton.js +18 -8
- package/dist/components/ViroCamera.d.ts +3 -1
- package/dist/components/ViroCamera.js +17 -7
- package/dist/components/ViroConstants.js +3 -3
- package/dist/components/ViroController.d.ts +1 -1
- package/dist/components/ViroController.js +17 -7
- package/dist/components/ViroDirectionalLight.d.ts +1 -1
- package/dist/components/ViroDirectionalLight.js +17 -7
- package/dist/components/ViroFlexView.d.ts +2 -2
- package/dist/components/ViroFlexView.js +17 -7
- package/dist/components/ViroGeometry.d.ts +2 -2
- package/dist/components/ViroGeometry.js +17 -7
- package/dist/components/ViroImage.d.ts +2 -2
- package/dist/components/ViroImage.js +17 -7
- package/dist/components/ViroLightingEnvironment.d.ts +1 -1
- package/dist/components/ViroLightingEnvironment.js +17 -7
- package/dist/components/ViroMaterialVideo.d.ts +1 -1
- package/dist/components/ViroMaterialVideo.js +17 -7
- package/dist/components/ViroNode.d.ts +2 -2
- package/dist/components/ViroNode.js +17 -7
- package/dist/components/ViroOmniLight.d.ts +1 -1
- package/dist/components/ViroOmniLight.js +17 -7
- package/dist/components/ViroOrbitCamera.d.ts +3 -1
- package/dist/components/ViroOrbitCamera.js +17 -7
- package/dist/components/ViroParticleEmitter.d.ts +1 -1
- package/dist/components/ViroParticleEmitter.js +17 -7
- package/dist/components/ViroPolygon.d.ts +2 -2
- package/dist/components/ViroPolygon.js +17 -7
- package/dist/components/ViroPolyline.d.ts +2 -2
- package/dist/components/ViroPolyline.js +17 -7
- package/dist/components/ViroPortal.d.ts +2 -2
- package/dist/components/ViroPortal.js +17 -7
- package/dist/components/ViroPortalScene.d.ts +2 -2
- package/dist/components/ViroPortalScene.js +17 -7
- package/dist/components/ViroQuad.d.ts +2 -2
- package/dist/components/ViroQuad.js +17 -7
- package/dist/components/ViroScene.d.ts +10 -2
- package/dist/components/ViroScene.js +17 -7
- package/dist/components/ViroSceneContext.d.ts +4 -3
- package/dist/components/ViroSceneContext.js +17 -7
- package/dist/components/ViroSceneNavigator.d.ts +2 -2
- package/dist/components/ViroSceneNavigator.js +17 -7
- package/dist/components/ViroSkyBox.d.ts +1 -1
- package/dist/components/ViroSkyBox.js +17 -7
- package/dist/components/ViroSound.d.ts +1 -1
- package/dist/components/ViroSound.js +17 -7
- package/dist/components/ViroSoundField.d.ts +1 -1
- package/dist/components/ViroSoundField.js +17 -7
- package/dist/components/ViroSpatialSound.d.ts +1 -1
- package/dist/components/ViroSpatialSound.js +17 -7
- package/dist/components/ViroSphere.d.ts +2 -2
- package/dist/components/ViroSphere.js +17 -7
- package/dist/components/ViroSpinner.d.ts +2 -2
- package/dist/components/ViroSpinner.js +17 -7
- package/dist/components/ViroSpotLight.d.ts +1 -1
- package/dist/components/ViroSpotLight.js +17 -7
- package/dist/components/ViroSurface.d.ts +2 -2
- package/dist/components/ViroSurface.js +17 -7
- package/dist/components/ViroText.d.ts +2 -2
- package/dist/components/ViroText.js +17 -7
- package/dist/components/ViroVRSceneNavigator.d.ts +2 -2
- package/dist/components/ViroVRSceneNavigator.js +17 -7
- package/dist/components/ViroVideo.d.ts +10 -2
- package/dist/components/ViroVideo.js +17 -7
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -3
- package/dist/plugins/withViroAndroid.js +15 -11
- package/dist/plugins/withViroIos.js +1 -1
- package/index.ts +0 -2
- package/package.json +23 -14
- package/components/Telemetry/ViroTelemetry.ts +0 -93
|
Binary file
|
|
@@ -68,52 +68,91 @@ export class ViroARPlaneSelector extends React.Component<Props, State> {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
_getARPlanes() {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return arPlanes;
|
|
101
|
-
} else {
|
|
102
|
-
return (
|
|
71
|
+
// Always render a fixed number of planes, controlling visibility instead of conditional rendering
|
|
72
|
+
let arPlanes: JSX.Element[] = [];
|
|
73
|
+
let numPlanes = this.props.maxPlanes || _maxPlanes;
|
|
74
|
+
|
|
75
|
+
// Create all plane slots (both detected and placeholder)
|
|
76
|
+
for (let i = 0; i < numPlanes; i++) {
|
|
77
|
+
// Determine if this is the selected plane
|
|
78
|
+
const isSelected = this.state.selectedSurface === i;
|
|
79
|
+
|
|
80
|
+
// Get real plane data if available, or use defaults
|
|
81
|
+
const foundARPlane = this.state.foundARPlanes[i];
|
|
82
|
+
const hasPlaneData = !!foundARPlane;
|
|
83
|
+
|
|
84
|
+
// Extract plane data or use defaults
|
|
85
|
+
const surfaceWidth = hasPlaneData ? foundARPlane.width || 0.5 : 0.5;
|
|
86
|
+
const surfaceHeight = hasPlaneData ? foundARPlane.height || 0.5 : 0.5;
|
|
87
|
+
const surfacePosition = hasPlaneData
|
|
88
|
+
? foundARPlane.center || [0, 0, 0]
|
|
89
|
+
: [0, 0, 0];
|
|
90
|
+
const anchorId = hasPlaneData
|
|
91
|
+
? (foundARPlane as any).anchorId
|
|
92
|
+
: undefined;
|
|
93
|
+
|
|
94
|
+
// Determine visibility based on selection state
|
|
95
|
+
// - In selection mode (selectedSurface === -1): show all planes
|
|
96
|
+
// - In selected mode: only show the selected plane
|
|
97
|
+
const isVisible = this.state.selectedSurface === -1 || isSelected;
|
|
98
|
+
|
|
99
|
+
arPlanes.push(
|
|
103
100
|
<ViroARPlane
|
|
104
|
-
key={_planePrefix +
|
|
105
|
-
{
|
|
106
|
-
|
|
101
|
+
key={_planePrefix + i}
|
|
102
|
+
minWidth={this.props.minWidth || 0.5}
|
|
103
|
+
minHeight={this.props.minHeight || 0.5}
|
|
104
|
+
alignment={this.props.alignment}
|
|
105
|
+
anchorId={anchorId}
|
|
106
|
+
onAnchorFound={(anchor) => {
|
|
107
|
+
// If we find an anchor, update our plane data
|
|
108
|
+
this._onARPlaneUpdated(i)(anchor);
|
|
109
|
+
}}
|
|
110
|
+
onAnchorUpdated={this._onARPlaneUpdated(i)}
|
|
111
|
+
>
|
|
112
|
+
{/* Always render both the quad and children, controlling only visibility */}
|
|
113
|
+
<ViroQuad
|
|
114
|
+
materials={"ViroARPlaneSelector_Translucent"}
|
|
115
|
+
onClickState={(clickState, position, source) =>
|
|
116
|
+
this._getOnClickSurface(i, { clickState, position, source })
|
|
117
|
+
}
|
|
118
|
+
position={surfacePosition}
|
|
119
|
+
width={surfaceWidth}
|
|
120
|
+
height={surfaceHeight}
|
|
121
|
+
rotation={[-90, 0, 0]}
|
|
122
|
+
opacity={isSelected ? 0 : isVisible ? 1 : 0}
|
|
123
|
+
/>
|
|
124
|
+
|
|
125
|
+
{/* Wrap children in a ViroNode to control visibility if children exist */}
|
|
126
|
+
{this.props.children && (
|
|
127
|
+
<ViroNode opacity={isSelected ? 1 : 0}>
|
|
128
|
+
{this.props.children}
|
|
129
|
+
</ViroNode>
|
|
130
|
+
)}
|
|
131
|
+
</ViroARPlane>
|
|
107
132
|
);
|
|
108
133
|
}
|
|
134
|
+
|
|
135
|
+
return arPlanes;
|
|
109
136
|
}
|
|
110
137
|
|
|
111
138
|
_getOnClickSurface = (index: number, event: ViroClickStateEvent) => {
|
|
112
139
|
if (event.clickState < 3) {
|
|
113
140
|
return;
|
|
114
141
|
}
|
|
115
|
-
|
|
116
|
-
|
|
142
|
+
|
|
143
|
+
// Get the plane data before updating state to avoid race conditions
|
|
144
|
+
const selectedPlane = this.state.foundARPlanes[index];
|
|
145
|
+
if (!selectedPlane) {
|
|
146
|
+
console.warn(
|
|
147
|
+
"ViroARPlaneSelector: Cannot select plane - plane data not found"
|
|
148
|
+
);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Update state and call callback with the captured data
|
|
153
|
+
this.setState({ selectedSurface: index }, () => {
|
|
154
|
+
this._onPlaneSelected(selectedPlane);
|
|
155
|
+
});
|
|
117
156
|
};
|
|
118
157
|
|
|
119
158
|
_onARPlaneUpdated = (index: number) => {
|
|
@@ -47,7 +47,7 @@ import { ViroBase } from "../ViroBase";
|
|
|
47
47
|
import { ViroCamera } from "../ViroCamera";
|
|
48
48
|
import { ViroTrackingStateConstants } from "../ViroConstants";
|
|
49
49
|
import { ViroCommonProps } from "./ViroCommonProps";
|
|
50
|
-
import {
|
|
50
|
+
import { ViroOrbitCamera } from "components/ViroOrbitCamera";
|
|
51
51
|
|
|
52
52
|
const ViroCameraModule = NativeModules.ViroCameraModule;
|
|
53
53
|
|
|
@@ -394,7 +394,7 @@ export class ViroARScene extends ViroBase<Props> {
|
|
|
394
394
|
return (
|
|
395
395
|
<ViroSceneContext.Provider
|
|
396
396
|
value={{
|
|
397
|
-
cameraDidMount: (camera: ViroCamera) => {
|
|
397
|
+
cameraDidMount: (camera: ViroCamera | ViroOrbitCamera) => {
|
|
398
398
|
if (camera.props.active) {
|
|
399
399
|
NativeModules.VRTCameraModule.setSceneCamera(
|
|
400
400
|
findNodeHandle(this),
|
|
@@ -402,7 +402,7 @@ export class ViroARScene extends ViroBase<Props> {
|
|
|
402
402
|
);
|
|
403
403
|
}
|
|
404
404
|
},
|
|
405
|
-
cameraWillUnmount: (camera: ViroCamera) => {
|
|
405
|
+
cameraWillUnmount: (camera: ViroCamera | ViroOrbitCamera) => {
|
|
406
406
|
if (camera.props.active) {
|
|
407
407
|
NativeModules.VRTCameraModule.removeSceneCamera(
|
|
408
408
|
findNodeHandle(this),
|
|
@@ -410,7 +410,10 @@ export class ViroARScene extends ViroBase<Props> {
|
|
|
410
410
|
);
|
|
411
411
|
}
|
|
412
412
|
},
|
|
413
|
-
cameraDidUpdate: (
|
|
413
|
+
cameraDidUpdate: (
|
|
414
|
+
camera: ViroCamera | ViroOrbitCamera,
|
|
415
|
+
active: boolean
|
|
416
|
+
) => {
|
|
414
417
|
if (active) {
|
|
415
418
|
NativeModules.VRTCameraModule.setSceneCamera(
|
|
416
419
|
findNodeHandle(this),
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
ViroScene,
|
|
28
28
|
ViroSceneDictionary,
|
|
29
29
|
} from "../Types/ViroUtils";
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
|
|
32
32
|
const ViroARSceneNavigatorModule = NativeModules.VRTARSceneNavigatorModule;
|
|
33
33
|
|
|
@@ -80,7 +80,6 @@ export class ViroARSceneNavigator extends React.Component<Props, State> {
|
|
|
80
80
|
|
|
81
81
|
constructor(props: Props) {
|
|
82
82
|
super(props);
|
|
83
|
-
ViroTelemetry.recordTelemetry("INIT", { ar: true });
|
|
84
83
|
let initialSceneTag = this.props.initialSceneKey;
|
|
85
84
|
if (initialSceneTag == null) {
|
|
86
85
|
initialSceneTag = this.getRandomTag();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VIRO_VERSION = "2.
|
|
1
|
+
export const VIRO_VERSION = "2.43.0";
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
ViroSceneDictionary,
|
|
26
26
|
} from "./Types/ViroUtils";
|
|
27
27
|
import { ViroScene } from "./ViroScene";
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
const Viro3DSceneNavigatorModule = NativeModules.VRT3DSceneNavigatorModule;
|
|
30
30
|
|
|
31
31
|
var mathRandomOffset = 0;
|
|
@@ -46,6 +46,7 @@ type State = {
|
|
|
46
46
|
export class ViroCamera extends React.Component<Props, State> {
|
|
47
47
|
_component: any;
|
|
48
48
|
static contextType?: React.Context<any> | undefined = ViroSceneContext;
|
|
49
|
+
declare context: React.ContextType<typeof ViroSceneContext>;
|
|
49
50
|
|
|
50
51
|
componentDidMount() {
|
|
51
52
|
this.context.cameraDidMount(this);
|
|
@@ -29,6 +29,7 @@ export class ViroOrbitCamera extends React.Component<Props> {
|
|
|
29
29
|
_component: ViroNativeRef = null;
|
|
30
30
|
|
|
31
31
|
static contextType?: React.Context<any> | undefined = ViroSceneContext;
|
|
32
|
+
declare context: React.ContextType<typeof ViroSceneContext>;
|
|
32
33
|
|
|
33
34
|
componentDidMount() {
|
|
34
35
|
this.context.cameraDidMount(this);
|
package/components/ViroScene.tsx
CHANGED
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
import { ViroBase } from "./ViroBase";
|
|
32
32
|
import { ViroCamera } from "./ViroCamera";
|
|
33
33
|
import { ViroSceneContext } from "./ViroSceneContext";
|
|
34
|
+
import { ViroOrbitCamera } from "./ViroOrbitCamera";
|
|
34
35
|
|
|
35
36
|
type Props = ViroCommonProps & {
|
|
36
37
|
onPlatformUpdate?: (platformInfo: ViroPlatformInfo) => void;
|
|
@@ -185,7 +186,7 @@ export class ViroScene extends ViroBase<Props> {
|
|
|
185
186
|
return (
|
|
186
187
|
<ViroSceneContext.Provider
|
|
187
188
|
value={{
|
|
188
|
-
cameraDidMount: (camera: ViroCamera) => {
|
|
189
|
+
cameraDidMount: (camera: ViroCamera | ViroOrbitCamera) => {
|
|
189
190
|
if (camera.props.active) {
|
|
190
191
|
NativeModules.VRTCameraModule.setSceneCamera(
|
|
191
192
|
findNodeHandle(this),
|
|
@@ -193,7 +194,7 @@ export class ViroScene extends ViroBase<Props> {
|
|
|
193
194
|
);
|
|
194
195
|
}
|
|
195
196
|
},
|
|
196
|
-
cameraWillUnmount: (camera: ViroCamera) => {
|
|
197
|
+
cameraWillUnmount: (camera: ViroCamera | ViroOrbitCamera) => {
|
|
197
198
|
if (camera.props.active) {
|
|
198
199
|
NativeModules.VRTCameraModule.removeSceneCamera(
|
|
199
200
|
findNodeHandle(this),
|
|
@@ -201,7 +202,10 @@ export class ViroScene extends ViroBase<Props> {
|
|
|
201
202
|
);
|
|
202
203
|
}
|
|
203
204
|
},
|
|
204
|
-
cameraDidUpdate: (
|
|
205
|
+
cameraDidUpdate: (
|
|
206
|
+
camera: ViroCamera | ViroOrbitCamera,
|
|
207
|
+
active: boolean
|
|
208
|
+
) => {
|
|
205
209
|
if (active) {
|
|
206
210
|
NativeModules.VRTCameraModule.setSceneCamera(
|
|
207
211
|
findNodeHandle(this),
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { ViroCamera } from "./ViroCamera";
|
|
3
|
+
import { ViroOrbitCamera } from "./ViroOrbitCamera";
|
|
3
4
|
|
|
4
5
|
export const ViroSceneContext = React.createContext({
|
|
5
|
-
cameraDidMount: (camera: ViroCamera) => {
|
|
6
|
+
cameraDidMount: (camera: ViroCamera | ViroOrbitCamera) => {
|
|
6
7
|
console.log("ViroSceneContext.cameraDidMount: " + camera);
|
|
7
8
|
},
|
|
8
|
-
cameraWillUnmount: (camera: ViroCamera) => {
|
|
9
|
+
cameraWillUnmount: (camera: ViroCamera | ViroOrbitCamera) => {
|
|
9
10
|
console.log("ViroSceneContext.cameraWillUnmount: " + camera);
|
|
10
11
|
},
|
|
11
|
-
cameraDidUpdate: (camera: ViroCamera, active: boolean) => {
|
|
12
|
+
cameraDidUpdate: (camera: ViroCamera | ViroOrbitCamera, active: boolean) => {
|
|
12
13
|
console.log(
|
|
13
14
|
"ViroSceneContext.cameraDidUpdate: " + camera + " active: " + active
|
|
14
15
|
);
|
|
@@ -25,7 +25,7 @@ import { ViroExitViroEvent } from "./Types/ViroEvents";
|
|
|
25
25
|
import { Viro3DPoint } from "./Types/ViroUtils";
|
|
26
26
|
import { ViroSceneDictionary } from "./Types/ViroUtils";
|
|
27
27
|
import { ViroScene } from "./ViroScene";
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
var ViroSceneNavigatorModule = NativeModules.VRTSceneNavigatorModule;
|
|
30
30
|
|
|
31
31
|
var mathRandomOffset = 0;
|
|
@@ -26,13 +26,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
26
26
|
}) : function(o, v) {
|
|
27
27
|
o["default"] = v;
|
|
28
28
|
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || function (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
};
|
|
29
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
+
var ownKeys = function(o) {
|
|
31
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
+
var ar = [];
|
|
33
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
+
return ar;
|
|
35
|
+
};
|
|
36
|
+
return ownKeys(o);
|
|
37
|
+
};
|
|
38
|
+
return function (mod) {
|
|
39
|
+
if (mod && mod.__esModule) return mod;
|
|
40
|
+
var result = {};
|
|
41
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
+
__setModuleDefault(result, mod);
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
36
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
47
|
exports.ViroARCamera = void 0;
|
|
38
48
|
const React = __importStar(require("react"));
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @providesModule ViroARImageMarker
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
import * as React from "react";
|
|
12
12
|
import { NativeSyntheticEvent } from "react-native";
|
|
13
13
|
import { ViroARAnchorFoundEvent, ViroARAnchorRemovedEvent, ViroARAnchorUpdatedEvent } from "../Types/ViroEvents";
|
|
14
14
|
import { ViroBase } from "../ViroBase";
|
|
@@ -19,5 +19,5 @@ export declare class ViroARImageMarker extends ViroBase<{}> {
|
|
|
19
19
|
_onAnchorFound: (event: NativeSyntheticEvent<ViroARAnchorFoundEvent>) => void;
|
|
20
20
|
_onAnchorUpdated: (event: NativeSyntheticEvent<ViroARAnchorUpdatedEvent>) => void;
|
|
21
21
|
_onAnchorRemoved: (_event: NativeSyntheticEvent<ViroARAnchorRemovedEvent>) => void;
|
|
22
|
-
render(): JSX.Element;
|
|
22
|
+
render(): React.JSX.Element;
|
|
23
23
|
}
|
|
@@ -25,13 +25,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
25
25
|
}) : function(o, v) {
|
|
26
26
|
o["default"] = v;
|
|
27
27
|
});
|
|
28
|
-
var __importStar = (this && this.__importStar) || function (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
28
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
29
|
+
var ownKeys = function(o) {
|
|
30
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
31
|
+
var ar = [];
|
|
32
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
33
|
+
return ar;
|
|
34
|
+
};
|
|
35
|
+
return ownKeys(o);
|
|
36
|
+
};
|
|
37
|
+
return function (mod) {
|
|
38
|
+
if (mod && mod.__esModule) return mod;
|
|
39
|
+
var result = {};
|
|
40
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
41
|
+
__setModuleDefault(result, mod);
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
})();
|
|
35
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
46
|
exports.ViroARImageMarker = void 0;
|
|
37
47
|
const React = __importStar(require("react"));
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @providesModule ViroARObjectMarker
|
|
10
10
|
*/
|
|
11
|
-
/// <reference types="react" />
|
|
12
11
|
import { ViroBase } from "../ViroBase";
|
|
12
|
+
import * as React from "react";
|
|
13
13
|
import { NativeSyntheticEvent } from "react-native";
|
|
14
14
|
import { ViroARAnchorFoundEvent, ViroARAnchorRemovedEvent, ViroARAnchorUpdatedEvent } from "../Types/ViroEvents";
|
|
15
15
|
type Props = {};
|
|
@@ -20,6 +20,6 @@ export declare class ViroARObjectMarker extends ViroBase<Props> {
|
|
|
20
20
|
_onAnchorFound(event: NativeSyntheticEvent<ViroARAnchorFoundEvent>): void;
|
|
21
21
|
_onAnchorUpdated(event: NativeSyntheticEvent<ViroARAnchorUpdatedEvent>): void;
|
|
22
22
|
_onAnchorRemoved(_event: NativeSyntheticEvent<ViroARAnchorRemovedEvent>): void;
|
|
23
|
-
render(): JSX.Element;
|
|
23
|
+
render(): React.JSX.Element;
|
|
24
24
|
}
|
|
25
25
|
export {};
|
|
@@ -25,13 +25,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
25
25
|
}) : function(o, v) {
|
|
26
26
|
o["default"] = v;
|
|
27
27
|
});
|
|
28
|
-
var __importStar = (this && this.__importStar) || function (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
28
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
29
|
+
var ownKeys = function(o) {
|
|
30
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
31
|
+
var ar = [];
|
|
32
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
33
|
+
return ar;
|
|
34
|
+
};
|
|
35
|
+
return ownKeys(o);
|
|
36
|
+
};
|
|
37
|
+
return function (mod) {
|
|
38
|
+
if (mod && mod.__esModule) return mod;
|
|
39
|
+
var result = {};
|
|
40
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
41
|
+
__setModuleDefault(result, mod);
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
})();
|
|
35
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
46
|
exports.ViroARObjectMarker = void 0;
|
|
37
47
|
const ViroBase_1 = require("../ViroBase");
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @providesModule ViroARPlane
|
|
10
10
|
*/
|
|
11
|
-
/// <reference types="react" />
|
|
12
11
|
import { ViroARAnchorFoundEvent, ViroARAnchorRemovedEvent, ViroARAnchorUpdatedEvent } from "../Types/ViroEvents";
|
|
13
12
|
import { ViroBase } from "../ViroBase";
|
|
13
|
+
import * as React from "react";
|
|
14
14
|
import { NativeSyntheticEvent } from "react-native";
|
|
15
15
|
type Props = {
|
|
16
16
|
anchorId?: string;
|
|
@@ -25,6 +25,6 @@ export declare class ViroARPlane extends ViroBase<Props> {
|
|
|
25
25
|
_onAnchorFound: (event: NativeSyntheticEvent<ViroARAnchorFoundEvent>) => void;
|
|
26
26
|
_onAnchorUpdated: (event: NativeSyntheticEvent<ViroARAnchorUpdatedEvent>) => void;
|
|
27
27
|
_onAnchorRemoved: (_event: NativeSyntheticEvent<ViroARAnchorRemovedEvent>) => void;
|
|
28
|
-
render(): JSX.Element;
|
|
28
|
+
render(): React.JSX.Element;
|
|
29
29
|
}
|
|
30
30
|
export {};
|
|
@@ -25,13 +25,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
25
25
|
}) : function(o, v) {
|
|
26
26
|
o["default"] = v;
|
|
27
27
|
});
|
|
28
|
-
var __importStar = (this && this.__importStar) || function (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
28
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
29
|
+
var ownKeys = function(o) {
|
|
30
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
31
|
+
var ar = [];
|
|
32
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
33
|
+
return ar;
|
|
34
|
+
};
|
|
35
|
+
return ownKeys(o);
|
|
36
|
+
};
|
|
37
|
+
return function (mod) {
|
|
38
|
+
if (mod && mod.__esModule) return mod;
|
|
39
|
+
var result = {};
|
|
40
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
41
|
+
__setModuleDefault(result, mod);
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
})();
|
|
35
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
46
|
exports.ViroARPlane = void 0;
|
|
37
47
|
const ViroBase_1 = require("../ViroBase");
|
|
@@ -33,11 +33,11 @@ export declare class ViroARPlaneSelector extends React.Component<Props, State> {
|
|
|
33
33
|
_component: ViroNativeRef;
|
|
34
34
|
state: {
|
|
35
35
|
selectedSurface: number;
|
|
36
|
-
foundARPlanes:
|
|
36
|
+
foundARPlanes: ViroARPlaneType[];
|
|
37
37
|
arPlaneSizes: number[];
|
|
38
38
|
};
|
|
39
|
-
render(): JSX.Element;
|
|
40
|
-
_getARPlanes(): JSX.Element
|
|
39
|
+
render(): React.JSX.Element;
|
|
40
|
+
_getARPlanes(): JSX.Element[];
|
|
41
41
|
_getOnClickSurface: (index: number, event: ViroClickStateEvent) => void;
|
|
42
42
|
_onARPlaneUpdated: (index: number) => (updateMap: ViroPlaneUpdatedMap) => void;
|
|
43
43
|
_onPlaneSelected: (updateMap: ViroPlaneUpdatedMap) => void;
|
|
@@ -25,13 +25,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
25
25
|
}) : function(o, v) {
|
|
26
26
|
o["default"] = v;
|
|
27
27
|
});
|
|
28
|
-
var __importStar = (this && this.__importStar) || function (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
28
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
29
|
+
var ownKeys = function(o) {
|
|
30
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
31
|
+
var ar = [];
|
|
32
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
33
|
+
return ar;
|
|
34
|
+
};
|
|
35
|
+
return ownKeys(o);
|
|
36
|
+
};
|
|
37
|
+
return function (mod) {
|
|
38
|
+
if (mod && mod.__esModule) return mod;
|
|
39
|
+
var result = {};
|
|
40
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
41
|
+
__setModuleDefault(result, mod);
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
})();
|
|
35
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
46
|
exports.ViroARPlaneSelector = void 0;
|
|
37
47
|
const React = __importStar(require("react"));
|
|
@@ -59,30 +69,58 @@ class ViroARPlaneSelector extends React.Component {
|
|
|
59
69
|
return <ViroNode_1.ViroNode>{this._getARPlanes()}</ViroNode_1.ViroNode>;
|
|
60
70
|
}
|
|
61
71
|
_getARPlanes() {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
// Always render a fixed number of planes, controlling visibility instead of conditional rendering
|
|
73
|
+
let arPlanes = [];
|
|
74
|
+
let numPlanes = this.props.maxPlanes || _maxPlanes;
|
|
75
|
+
// Create all plane slots (both detected and placeholder)
|
|
76
|
+
for (let i = 0; i < numPlanes; i++) {
|
|
77
|
+
// Determine if this is the selected plane
|
|
78
|
+
const isSelected = this.state.selectedSurface === i;
|
|
79
|
+
// Get real plane data if available, or use defaults
|
|
80
|
+
const foundARPlane = this.state.foundARPlanes[i];
|
|
81
|
+
const hasPlaneData = !!foundARPlane;
|
|
82
|
+
// Extract plane data or use defaults
|
|
83
|
+
const surfaceWidth = hasPlaneData ? foundARPlane.width || 0.5 : 0.5;
|
|
84
|
+
const surfaceHeight = hasPlaneData ? foundARPlane.height || 0.5 : 0.5;
|
|
85
|
+
const surfacePosition = hasPlaneData
|
|
86
|
+
? foundARPlane.center || [0, 0, 0]
|
|
87
|
+
: [0, 0, 0];
|
|
88
|
+
const anchorId = hasPlaneData
|
|
89
|
+
? foundARPlane.anchorId
|
|
90
|
+
: undefined;
|
|
91
|
+
// Determine visibility based on selection state
|
|
92
|
+
// - In selection mode (selectedSurface === -1): show all planes
|
|
93
|
+
// - In selected mode: only show the selected plane
|
|
94
|
+
const isVisible = this.state.selectedSurface === -1 || isSelected;
|
|
95
|
+
arPlanes.push(<ViroARPlane_1.ViroARPlane key={_planePrefix + i} minWidth={this.props.minWidth || 0.5} minHeight={this.props.minHeight || 0.5} alignment={this.props.alignment} anchorId={anchorId} onAnchorFound={(anchor) => {
|
|
96
|
+
// If we find an anchor, update our plane data
|
|
97
|
+
this._onARPlaneUpdated(i)(anchor);
|
|
98
|
+
}} onAnchorUpdated={this._onARPlaneUpdated(i)}>
|
|
99
|
+
{/* Always render both the quad and children, controlling only visibility */}
|
|
100
|
+
<ViroQuad_1.ViroQuad materials={"ViroARPlaneSelector_Translucent"} onClickState={(clickState, position, source) => this._getOnClickSurface(i, { clickState, position, source })} position={surfacePosition} width={surfaceWidth} height={surfaceHeight} rotation={[-90, 0, 0]} opacity={isSelected ? 0 : isVisible ? 1 : 0}/>
|
|
101
|
+
|
|
102
|
+
{/* Wrap children in a ViroNode to control visibility if children exist */}
|
|
103
|
+
{this.props.children && (<ViroNode_1.ViroNode opacity={isSelected ? 1 : 0}>
|
|
104
|
+
{this.props.children}
|
|
105
|
+
</ViroNode_1.ViroNode>)}
|
|
106
|
+
</ViroARPlane_1.ViroARPlane>);
|
|
78
107
|
}
|
|
108
|
+
return arPlanes;
|
|
79
109
|
}
|
|
80
110
|
_getOnClickSurface = (index, event) => {
|
|
81
111
|
if (event.clickState < 3) {
|
|
82
112
|
return;
|
|
83
113
|
}
|
|
84
|
-
|
|
85
|
-
this.
|
|
114
|
+
// Get the plane data before updating state to avoid race conditions
|
|
115
|
+
const selectedPlane = this.state.foundARPlanes[index];
|
|
116
|
+
if (!selectedPlane) {
|
|
117
|
+
console.warn("ViroARPlaneSelector: Cannot select plane - plane data not found");
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
// Update state and call callback with the captured data
|
|
121
|
+
this.setState({ selectedSurface: index }, () => {
|
|
122
|
+
this._onPlaneSelected(selectedPlane);
|
|
123
|
+
});
|
|
86
124
|
};
|
|
87
125
|
_onARPlaneUpdated = (index) => {
|
|
88
126
|
return (updateMap) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
import { NativeSyntheticEvent } from "react-native";
|
|
3
3
|
import { ViroAmbientLightInfo, ViroAmbientLightUpdateEvent, ViroARAnchorFoundEvent, ViroARAnchorRemovedEvent, ViroARAnchorUpdatedEvent, ViroARPointCloud, ViroARPointCloudUpdateEvent, ViroCameraARHitTest, ViroCameraARHitTestEvent, ViroCameraTransform, ViroCameraTransformEvent, ViroPlatformInfo, ViroPlatformUpdateEvent, ViroTrackingReason, ViroTrackingState, ViroTrackingUpdatedEvent } from "../Types/ViroEvents";
|
|
4
4
|
import { Viro3DPoint, ViroPhysicsWorld, ViroRay, ViroScale, ViroSoundRoom, ViroSource } from "../Types/ViroUtils";
|
|
@@ -67,6 +67,6 @@ export declare class ViroARScene extends ViroBase<Props> {
|
|
|
67
67
|
up: any[];
|
|
68
68
|
}>;
|
|
69
69
|
getCameraPositionAsync: () => Promise<any>;
|
|
70
|
-
render(): JSX.Element;
|
|
70
|
+
render(): React.JSX.Element;
|
|
71
71
|
}
|
|
72
72
|
export {};
|