Skip to content

Commit

Permalink
fix: Use double click to center component on mouse position. (#1821)
Browse files Browse the repository at this point in the history
- used to be single click

- May be possible to remove the typecheck complaint if anybody has a
suggestion.
  • Loading branch information
nilscb authored Dec 7, 2023
1 parent 626a361 commit 25448b5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion typescript/packages/subsurface-viewer/src/components/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,12 @@ const Map: React.FC<MapProps> = ({
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) {
Expand Down

0 comments on commit 25448b5

Please sign in to comment.