Skip to content

Commit

Permalink
Merge pull request #219 from Dataport/fix/extendedMasterportalapiMark…
Browse files Browse the repository at this point in the history
…ers-edits-to-align-with-documentation

Fix interface extendedMasterportalapiMarkers to align with documentation
  • Loading branch information
jedi-of-the-sea authored Jan 30, 2025
2 parents c77b1db + b9d2528 commit 7eda14b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
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

0 comments on commit 7eda14b

Please sign in to comment.