Skip to content

Commit

Permalink
ISSUE #5125 - calibration steps are not enabled by default
Browse files Browse the repository at this point in the history
  • Loading branch information
The-Daniel committed Sep 12, 2024
1 parent dc8d7e7 commit 06c8160
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ import { CalibrationContext } from '../../calibrationContext';
import { EMPTY_VECTOR } from '../../calibration.constants';

export const Calibration2DHandler = () => {
const { isCalibrating, step, setIsCalibrating2D, setVector2D } = useContext(CalibrationContext);

const canCalibrate2D = isCalibrating && step === 1;
const { setIsCalibrating2D, setVector2D } = useContext(CalibrationContext);

useEffect(() => {
UnityUtil.setCalibrationToolMode('Vector');
Expand All @@ -34,9 +32,5 @@ export const Calibration2DHandler = () => {
};
}, []);

useEffect(() => {
setIsCalibrating2D(canCalibrate2D);
}, [canCalibrate2D]);

return null;
};
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export const Calibration3DHandler = () => {

useEffect(() => {
UnityUtil.setCalibrationToolMode('Vector');
Viewer.isModelReady().then(() => setIsCalibrating3D(true));

return () => {
setIsCalibrating3D(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const VerticalSpatialBoundariesHandler = () => {
}, [isCalibratingPlanes, planesAreSet]);

useEffect(() => {
if (!planesAreSet) {
if (!planesAreSet && isCalibratingPlanes) {
const onClickFloorToObject = ({ account, model, id }) => {
Viewer.setCalibrationToolFloorToObject(account, model, id);
setSelectedPlane(PlaneType.UPPER);
Expand All @@ -86,7 +86,7 @@ export const VerticalSpatialBoundariesHandler = () => {
Viewer.off(VIEWER_EVENTS.OBJECT_SELECTED, onClickFloorToObject);
};
}
}, [planesAreSet]);
}, [planesAreSet, isCalibratingPlanes]);

useEffect(() => {
if (isAlignPlaneActive && planesAreSet) {
Expand Down Expand Up @@ -120,7 +120,6 @@ export const VerticalSpatialBoundariesHandler = () => {

useEffect(() => {
applyImageToPlane();
setIsCalibratingPlanes(true);
Viewer.setCalibrationToolVerticalPlanes(...verticalPlanes);

return () => {
Expand Down

0 comments on commit 06c8160

Please sign in to comment.