Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(react-components): don't select objects when clicking in measurement #4544

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions react-components/src/hooks/useClickedNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import { usePointCloudAnnotationMappingForAssetId } from '../components/CachePro
import { type PointCloudAnnotationMappedAssetData } from './types';
import { MOUSE, Vector2 } from 'three';
import { type DmsUniqueIdentifier, type Source } from '../utilities/FdmSDK';
import { useReveal } from '../components/RevealCanvas/ViewerContext';
import { useRenderTarget, useReveal } from '../components/RevealCanvas/ViewerContext';
import { NavigationTool } from '../architecture/base/commands/NavigationTool';

export type AssetMappingDataResult = {
cadNode: Node3D;
Expand All @@ -39,6 +40,7 @@ export type ClickedNodeData = {

export const useClickedNodeData = (): ClickedNodeData | undefined => {
const viewer = useReveal();
const renderTarget = useRenderTarget();

const [intersection, setIntersection] = useState<AnyIntersection | undefined>(undefined);

Expand All @@ -49,7 +51,10 @@ export const useClickedNodeData = (): ClickedNodeData | undefined => {
useEffect(() => {
const callback = (event: PointerEventData): void => {
void (async () => {
if (event.button !== MOUSE.LEFT) {
const navigationTool = renderTarget.toolController.getEqual(new NavigationTool());
const isNavigationActive = renderTarget.toolController.activeTool === navigationTool;

if (event.button !== MOUSE.LEFT || !isNavigationActive) {
return;
}

Expand Down
Loading