Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export default function setCrossHair(
if (!crossHair) {
this.crossHair = undefined
this.crossHairPosition = undefined
} else if (crossHair in CrossHairs) {
} else if (Object.values(CrossHairs).includes(crossHair)) {
// Use Object.values().includes() to check if the crosshair is a valid enum value
// (e.g., 'point', 'cross', etc.) rather than checking if it's an enum key
this.crossHair = crossHair
// if a position is defined as param we use it
// if no position was given, we use the current center of the map as crosshair position
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ function setValuesInStore(to: RouteLocationNormalizedGeneric, urlParamValue?: st
},
STORE_DISPATCHER_ROUTER_PLUGIN
)
} else if (parsedValue.crossHair) {
// Handle case where only crosshair type is provided (without coordinates)
// The setCrossHair action will use the map center as the crosshair position
positionStore.setCrossHair(
{
crossHair: parsedValue.crossHair,
},
STORE_DISPATCHER_ROUTER_PLUGIN
)
}
}
}
Expand Down
Loading