diff --git a/src/packages/selection/Selection.tsx b/src/packages/selection/Selection.tsx index 92e8d69f..dc9f1007 100644 --- a/src/packages/selection/Selection.tsx +++ b/src/packages/selection/Selection.tsx @@ -124,11 +124,11 @@ export const Selection: FC = (props) => { const currentSourceStatus = useSourceStatus(currentSource, defaultNotAvailableMessage); const selectionDefault = "extent"; - const [selectionKind, setSelectionKind] = useState(selectionDefault); + const [selectionMethod, setSelectionMethod] = useState(selectionDefault); useEffect(() => { let method = selectionMethods ?? selectionDefault; method = Array.isArray(method) && method.length > 0 ? method[0]! : method as SelectionMethod; - setSelectionKind(method); + setSelectionMethod(method); }, [selectionMethods]); const showSelectionButtons = useMemo(() => { return Boolean(selectionMethods && Array.isArray(selectionMethods) && selectionMethods.length > 1); @@ -146,7 +146,7 @@ export const Selection: FC = (props) => { const [isOpenSelect, setIsOpenSelect] = useState(false); useInteractiveSelection( - selectionKind, + selectionMethod, mapState.map, intl, onExtentSelected, @@ -182,18 +182,18 @@ export const Selection: FC = (props) => { return ( {showSelectionButtons && - {intl.formatMessage({ id: "selectionKind" })} + {intl.formatMessage({ id: "selectionMethod" })} } label={intl.formatMessage({id: "EXTENT"})} - onClick={() => setSelectionKind("extent")} - isActive={selectionKind === "extent"}/> + onClick={() => setSelectionMethod("extent")} + isActive={selectionMethod === "extent"}/> } label={intl.formatMessage({id: "POINT"})} - onClick={() => setSelectionKind("point")} - isActive={selectionKind === "point"}/> + onClick={() => setSelectionMethod("point")} + isActive={selectionMethod === "point"}/> } @@ -422,7 +422,7 @@ function useSourceStatus( * Hook to manage map controls and tooltip */ function useInteractiveSelection( - selectionKind: SelectionMethod, + selectionMethod: SelectionMethod, map: MapModel | undefined, intl: PackageIntl, onExtentSelected: (geometry: Geometry) => void, @@ -430,16 +430,16 @@ function useInteractiveSelection( hasSelectedSource: boolean ) { - function selectionKindFactory( - selectionKind: SelectionMethod, + function selectionMethodFactory( + selectionMethod: SelectionMethod, ): ISelectionTypeHandler { - switch (selectionKind) { + switch (selectionMethod) { case "extent": return DragController; case "point": return ClickController; default: - throw new Error(`Unknown selection kind: ${selectionKind}`); + throw new Error(`Unknown selection kind: ${selectionMethod}`); } } @@ -452,10 +452,10 @@ function useInteractiveSelection( ? intl.formatMessage({ id: "disabledTooltip" }) : intl.formatMessage({ id: "noSourceTooltip" }); - const controlerCls = selectionKindFactory(selectionKind); + const controlerCls = selectionMethodFactory(selectionMethod); const dragController = new controlerCls( map.olMap, - intl.formatMessage({ id: `tooltip.${selectionKind}` }), + intl.formatMessage({ id: `tooltip.${selectionMethod}` }), disabledMessage, onExtentSelected ); @@ -464,7 +464,7 @@ function useInteractiveSelection( return () => { dragController?.destroy(); }; - }, [map, intl, onExtentSelected, isActive, hasSelectedSource, selectionKind]); + }, [map, intl, onExtentSelected, isActive, hasSelectedSource, selectionMethod]); } /** diff --git a/src/packages/selection/i18n/de.yaml b/src/packages/selection/i18n/de.yaml index 4424ed90..a4c489a0 100644 --- a/src/packages/selection/i18n/de.yaml +++ b/src/packages/selection/i18n/de.yaml @@ -5,7 +5,7 @@ messages: FREEPOLYGON: "Freies Zeichnen" CIRCLE: "Kreis" POINT: "Punkt" - selectionKind: "Selektionsart" + selectionMethod: "Selektionsart" selectSource: "Quelle auswählen" tooltip: extent: "Klicken Sie in die Karte, halten Sie die Maustaste gedrückt und ziehen Sie ein Rechteck auf" diff --git a/src/packages/selection/i18n/en.yaml b/src/packages/selection/i18n/en.yaml index 10df2db6..8e47a882 100644 --- a/src/packages/selection/i18n/en.yaml +++ b/src/packages/selection/i18n/en.yaml @@ -5,7 +5,7 @@ messages: FREEPOLYGON: "Freies Zeichnen" CIRCLE: "Kreis" POINT: "Point" - selectionKind: "Selection type" + selectionMethod: "Selection type" selectSource: "Select source" tooltip: extent: "Click on the map, hold down the mouse button and draw a rectangle"