-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsurfaceModule.js
More file actions
32 lines (31 loc) · 1.07 KB
/
surfaceModule.js
File metadata and controls
32 lines (31 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { Module } from 'react-360-web';
export default class SurfaceModule extends Module {
constructor() {
super('SurfaceModule');
this.canClick = false;
}
zoomCamera(newLocation) {
//newLocation example: [0, 0, 0]
const r360 = window.reactIns;
let cameraPosition = r360.getCameraPosition();
cameraPosition[0] = newLocation[0];
cameraPosition[1] = newLocation[1];
cameraPosition[2] = newLocation[2];
}
//attempting to disable button if camera is too far
disableButton(objDistance) {
//if z index of camera is close to obj --> can click
// const zIndex = cameraPosition[2]
// console.log("Camera2", zIndex)
// // //if zVertex is within objDistance +/- 100, canClick = true
// if (zIndex <= objDistance + 100 && zIndex >= objDistance - 100) {
// this.canClick = true
// }
}
changeSurfaceAngle(surfaceName, horizontalAngle, verticleAngle) {
window[surfaceName].setAngle(horizontalAngle, verticleAngle);
}
changeSurfaceSize(surfaceName, scaleX, scaleY) {
window[surfaceName].resize(scaleX, scaleY);
}
}