diff --git a/packages/core/README.md b/packages/core/README.md index 77aac6c89..ea3cf9b58 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -183,7 +183,7 @@ To figure out the name of the locales to override, inspect the matching plugin i | layers | string[] | List of layer ids. The effect will only be applied to these layers. | | clusterClickZoom | boolean? | If `true`, clicking a cluster feature will zoom into the clustered features' bounding box (with padding) so that the cluster is "resolved". This happens until the maximum zoom level is reached, at which no further zooming can take place. Defaults to `false`. | | defaultStyle | MarkerStyle? | Used as the default marker style. The default fill color for these markers is `'#005CA9'`. | -| dispatchOnMapSelect | string[]? | If set, the parameters will be spread to dispatchment on map selection. `['target', 'value']` will `dispatch(...['target', 'value'])`. This can be used to open the iconMenu's GFI with `['plugin/iconMenu/openMenuById', 'gfi']`, should the IconMenu exist and the gfi plugin be in it with this id. | +| dispatchOnMapSelect | [string, unknown]? | If set, the parameters will be spread to dispatchment on map selection. `['target', 'value']` will `dispatch(...['target', 'value'])`. This can be used to open the iconMenu's GFI with `['plugin/iconMenu/openMenuById', 'gfi']`, should the IconMenu exist and the gfi plugin be in it with this id. | | hoverStyle | MarkerStyle? | Used as map marker style for hovered features. The default fill color for these markers is `'#7B1045'`. | | isSelectable | ((feature: GeoJsonFeature) => boolean)? | If undefined, all features are selectable. If defined, this can be used to sort out features to be unselectable, and such features will be styled different and won't react on click. | | selectionStyle | MarkerStyle? | Used as map marker style for selected features. The default fill color for these markers is `'#679100'`. | diff --git a/packages/core/src/vuePlugins/actions/useExtendedMasterportalapiMarkers/index.ts b/packages/core/src/vuePlugins/actions/useExtendedMasterportalapiMarkers/index.ts index 12bf015bd..633d97197 100644 --- a/packages/core/src/vuePlugins/actions/useExtendedMasterportalapiMarkers/index.ts +++ b/packages/core/src/vuePlugins/actions/useExtendedMasterportalapiMarkers/index.ts @@ -2,7 +2,7 @@ import { Feature, MapBrowserEvent } from 'ol' import { CoreGetters, CoreState, - ExtendedMasterportalapiMarkersIsSelectableFunction, + ExtendedMasterportalapiMarkers, MarkerStyle, PolarActionContext, PolarStore, @@ -80,15 +80,7 @@ export function useExtendedMasterportalapiMarkers( layers, clusterClickZoom = false, dispatchOnMapSelect, - }: { - hoverStyle?: MarkerStyle - selectionStyle?: MarkerStyle - unselectableStyle?: MarkerStyle - isSelectable?: ExtendedMasterportalapiMarkersIsSelectableFunction - layers: string[] - clusterClickZoom: boolean - dispatchOnMapSelect?: string[] - } + }: ExtendedMasterportalapiMarkers ) { localSelectionStyle = selectionStyle const { map } = getters @@ -207,7 +199,6 @@ export function useExtendedMasterportalapiMarkers( setLayerId(map, feature) selected = feature if (dispatchOnMapSelect) { - // @ts-expect-error | May be one or two elements, no fixed tuple. dispatch(...dispatchOnMapSelect) } hovered?.setStyle?.(undefined) diff --git a/packages/types/custom/CHANGELOG.md b/packages/types/custom/CHANGELOG.md index 33f4b7932..370287f6e 100644 --- a/packages/types/custom/CHANGELOG.md +++ b/packages/types/custom/CHANGELOG.md @@ -6,6 +6,7 @@ - Feature: Add new type `MeasureOptions`. - Feature: Add new type `MeasureMode`. - Feature: Add optional property `measure` to `DrawStyle`. +- Fix: Make `selectionStyle`, `hoverStyle`, `defaultStyle` and `unselectableStyle` optional and edit type for `dispatchOnMapSelect` in interface `ExtendedMasterportalapiMarkers`. ## 1.5.0 diff --git a/packages/types/custom/core.ts b/packages/types/custom/core.ts index 66196aebd..4e3410294 100644 --- a/packages/types/custom/core.ts +++ b/packages/types/custom/core.ts @@ -603,12 +603,12 @@ export interface MarkerStyle { export interface ExtendedMasterportalapiMarkers { layers: string[] - defaultStyle: MarkerStyle - hoverStyle: MarkerStyle - selectionStyle: MarkerStyle - unselectableStyle: MarkerStyle + defaultStyle?: MarkerStyle + hoverStyle?: MarkerStyle + selectionStyle?: MarkerStyle + unselectableStyle?: MarkerStyle clusterClickZoom?: boolean - dispatchOnMapSelect?: string + dispatchOnMapSelect?: [string, unknown] isSelectable?: ExtendedMasterportalapiMarkersIsSelectableFunction }