From 25448b5b306b51b2d4513e9d956faa18e26ec4bd Mon Sep 17 00:00:00 2001 From: nilscb Date: Thu, 7 Dec 2023 16:16:04 +0100 Subject: [PATCH] fix: Use double click to center component on mouse position. (#1821) - used to be single click - May be possible to remove the typecheck complaint if anybody has a suggestion. --- .../packages/subsurface-viewer/src/components/Map.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/typescript/packages/subsurface-viewer/src/components/Map.tsx b/typescript/packages/subsurface-viewer/src/components/Map.tsx index dca5a9584..1a69a5603 100644 --- a/typescript/packages/subsurface-viewer/src/components/Map.tsx +++ b/typescript/packages/subsurface-viewer/src/components/Map.tsx @@ -918,7 +918,12 @@ const Map: React.FC = ({ infos: PickingInfo[], event: MjolnirEvent ): void => { - if ((event as MjolnirPointerEvent).leftButton) { + if ( + (event as MjolnirPointerEvent).leftButton && + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-expect-error + event.tapCount == 2 // Note. Detect double click. + ) { // Left button click identifies new camera rotation anchor. const viewstateKeys = Object.keys(viewStates); if (infos.length >= 1 && viewstateKeys.length === 1) {