Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix interface extendedMasterportalapiMarkers to align with documentation #219

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'`. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Feature, MapBrowserEvent } from 'ol'
import {
CoreGetters,
CoreState,
ExtendedMasterportalapiMarkersIsSelectableFunction,
ExtendedMasterportalapiMarkers,
MarkerStyle,
PolarActionContext,
PolarStore,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions packages/types/custom/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions packages/types/custom/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down