/** * @file Pinch zoom interaction configuration section. */ import * as React from "react"; import classes from "./InteractionCustomizationExample.module.css"; import type { PinchOptionsState } from "./panelTypes"; import type { PointerType } from "../../../../../types/interaction"; type PinchSettingsSectionProps = { options: PinchOptionsState; onChange: (next: PinchOptionsState) => void; }; const POINTER_OPTIONS: PointerType[] = ["touch", "pen"]; export const PinchSettingsSection: React.FC = ({ options, onChange }) => { const updateOption = React.useCallback( (partial: Partial) => { onChange({ ...options, ...partial }); }, [options, onChange], ); const handlePointerToggle = React.useCallback( (pointerType: PointerType, checked: boolean) => { const nextTypes = new Set(options.pointerTypes); if (checked) { nextTypes.add(pointerType); } else { nextTypes.delete(pointerType); } updateOption({ pointerTypes: Array.from(nextTypes) }); }, [options.pointerTypes, updateOption], ); return (
Pinch Zoom

Fine tune pinch-to-zoom support for touch and stylus inputs. Zoom wheel shortcuts remain available.

{POINTER_OPTIONS.map((pointer) => ( ))}
updateOption({ minDistance: Number.parseInt(event.target.value, 10) })} /> updateOption({ minDistance: Number.parseInt(event.target.value, 10) || 0 })} /> pixels
); };