diff --git a/frontend/src/v4/services/viewer/viewer.tsx b/frontend/src/v4/services/viewer/viewer.tsx index b104ff81d0..658a8bb844 100644 --- a/frontend/src/v4/services/viewer/viewer.tsx +++ b/frontend/src/v4/services/viewer/viewer.tsx @@ -29,6 +29,7 @@ import { import { uuid as UUID } from '../../helpers/uuid'; import { clientConfigService } from '../clientConfig'; import { MultiSelect } from './multiSelect'; +import { COLOR, hexToOpacity } from '@/v5/ui/themes/theme'; declare const Module; @@ -1343,6 +1344,11 @@ export class ViewerService { } public selectCalibrationToolPlane(plane) { + const unselectedPlane = plane !== 'lower' ? 'lower' : 'upper'; + + Viewer.setCalibrationToolVerticalPlaneColours(plane, hexToOpacity(COLOR.PRIMARY_MAIN_CONTRAST, 44), COLOR.PRIMARY_MAIN, COLOR.PRIMARY_MAIN_CONTRAST); + Viewer.setCalibrationToolVerticalPlaneColours(unselectedPlane, hexToOpacity(COLOR.PRIMARY_MAIN_CONTRAST, 0), COLOR.PRIMARY_MAIN, hexToOpacity(COLOR.PRIMARY_MAIN_CONTRAST, 0)); + UnityUtil.selectCalibrationToolVerticalPlane(plane); } @@ -1358,7 +1364,7 @@ export class ViewerService { UnityUtil.setCalibrationToolFloorToObject(teamspace, modelId, meshId); } - public setCalibrationToolSelectedColors(plane, fill, border, drawing) { + public setCalibrationToolVerticalPlaneColours(plane, fill, border, drawing) { UnityUtil.setCalibrationToolVerticalPlaneColours(plane, fill, border, drawing); } } diff --git a/frontend/src/v5/ui/routes/dashboard/projects/calibration/calibration.types.ts b/frontend/src/v5/ui/routes/dashboard/projects/calibration/calibration.types.ts index eb5fad0cfd..eb1039abf5 100644 --- a/frontend/src/v5/ui/routes/dashboard/projects/calibration/calibration.types.ts +++ b/frontend/src/v5/ui/routes/dashboard/projects/calibration/calibration.types.ts @@ -27,4 +27,5 @@ export type Vector3D = Vector; export enum PlaneType { UPPER = 'upper', LOWER = 'lower', + NONE = 'none', } diff --git a/frontend/src/v5/ui/routes/dashboard/projects/calibration/calibrationStep/verticalSpatialBoundariesHandler/verticalSpatialBoundariesHandler.component.tsx b/frontend/src/v5/ui/routes/dashboard/projects/calibration/calibrationStep/verticalSpatialBoundariesHandler/verticalSpatialBoundariesHandler.component.tsx index 9e96896fb7..796e713734 100644 --- a/frontend/src/v5/ui/routes/dashboard/projects/calibration/calibrationStep/verticalSpatialBoundariesHandler/verticalSpatialBoundariesHandler.component.tsx +++ b/frontend/src/v5/ui/routes/dashboard/projects/calibration/calibrationStep/verticalSpatialBoundariesHandler/verticalSpatialBoundariesHandler.component.tsx @@ -53,9 +53,6 @@ export const VerticalSpatialBoundariesHandler = () => { [bottomLeft, bottomRight, topLeft].map((corner) => corner.applyMatrix3(tMatrix)); Viewer.setCalibrationToolDrawing(i, [...bottomLeft, ...bottomRight, ...topLeft]); - Viewer.setCalibrationToolSelectedColors(hexToOpacity(COLOR.PRIMARY_MAIN_CONTRAST, 40), COLOR.PRIMARY_MAIN); - Viewer.setCalibrationToolUnselectedColors(hexToOpacity(COLOR.PRIMARY_MAIN_CONTRAST, 10), COLOR.PRIMARY_MAIN_CONTRAST); - Viewer.setCalibrationToolOcclusionOpacity(0.5); }; }; @@ -74,15 +71,8 @@ export const VerticalSpatialBoundariesHandler = () => { }, [planesAreSet, isCalibratingPlanes]); useEffect(() => { - Viewer.setCalibrationToolMode(planesAreSet ? 'Vertical' : 'None'); - - if (!isCalibratingPlanes && planesAreSet) { - Viewer.selectCalibrationToolPlane('none'); - } - - if (isCalibratingPlanes) { - setSelectedPlane(PlaneType.UPPER); - } + Viewer.setCalibrationToolMode(planesAreSet ? 'Vertical' : 'None'); + setSelectedPlane(isCalibratingPlanes ? PlaneType.UPPER : PlaneType.NONE); if (!planesAreSet && isCalibratingPlanes) { const onClickFloorToObject = ({ account, model, id }) => {