/** * @file Grid size settings section */ import * as React from "react"; import { useI18n } from "../../../i18n/context"; import { InspectorField } from "../../inspector/parts/InspectorField"; import { InspectorInput } from "../../inspector/parts/InspectorInput"; type GridSizeSectionProps = { gridSize: number; snapThreshold: number; onGridSizeChange: (size: number) => void; onSnapThresholdChange: (threshold: number) => void; }; /** * Section for grid size and snap threshold settings */ export function GridSizeSection({ gridSize, snapThreshold, onGridSizeChange, onSnapThresholdChange, }: GridSizeSectionProps): React.ReactElement { const { t } = useI18n(); const handleGridSizeChange = React.useEffectEvent((e: React.ChangeEvent) => { const size = parseInt(e.target.value, 10); if (!isNaN(size) && size > 0) { onGridSizeChange(size); } }); const handleSnapThresholdChange = React.useEffectEvent( (e: React.ChangeEvent) => { const threshold = parseInt(e.target.value, 10); if (!isNaN(threshold) && threshold > 0) { onSnapThresholdChange(threshold); } }, ); return ( <> ); }