-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feature/geolocation outside extent or boundary #166
base: main
Are you sure you want to change the base?
Changes from 8 commits
a59194f
6ea4af3
c439490
b6cb224
a9fd197
ea7bbaf
e1f31e3
c16e9b8
84b390d
a9255fa
79cac2a
88ff58f
71b9295
c5f83f2
e5c2b5b
1015533
48cfcc5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,8 +12,8 @@ either `true` or `false`. When a users denies the location tracking, the button | |
|
||
| fieldName | type | description | | ||
| - | - | - | | ||
| boundaryLayerId | string? | Id of a vector layer to restrict geolocation markers and zooms to. When geolocation outside of its features occurs, an information will be shown once and the feature is stopped. The map will wait at most 10s for the layer to load; should it not happen, the geolocation feature is turned off. | | ||
| boundaryOnError | ('strict' \| 'permissive')? | If the boundary layer check does not work due to loading or configuration errors, style `'strict'` will disable the geolocation feature, and style `'permissive'` will act as if no boundaryLayerId was set. Defaults to `'permissive'`. | | ||
| boundaryLayerId | string? | Id of a vector layer to restrict geolocation markers and zooms to. When geolocation outside of its features occurs, an information will be shown. When loading the boundary layer, the map will wait at most 10s; should it not happen, the geolocation feature is turned off. | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please return to only showing the message once per "user is outside the boundary" state. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| boundaryOnError | ('strict' \| 'permissive')? | If the boundary layer check does not work due to loading or configuration errors, style `'strict'` will disable the geolocation feature, and style `'permissive'` will act as if no boundaryLayerId was set. Defaults to `'permissive'`. | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a random extra whitespace here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| checkLocationInitially | boolean? | If `true` the location gets checked on page load. When `false` this can be triggered with a button. Defaults to `false`. | | ||
| keepCentered | boolean? | If `true`, the map will re-center on the user on any position change. If `false`, only the first position will be centered on. Defaults to `false`. | | ||
| renderType | 'iconMenu' \| 'independent'? | If nested in `IconMenu`, select 'iconMenu' to match styling. Defaults to 'independent'. | | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -38,7 +38,11 @@ const getters: PolarGetterTree<GeoLocationState, GeoLocationGetters> = { | |||||||||||||
return rootGetters.configuration?.geoLocation?.toastAction | ||||||||||||||
}, | ||||||||||||||
zoomLevel: (_, __, ___, rootGetters): number => { | ||||||||||||||
return rootGetters.configuration?.geoLocation?.zoomLevel || 7 | ||||||||||||||
const zoomLevel = rootGetters.configuration?.geoLocation?.zoomLevel | ||||||||||||||
if (zoomLevel !== undefined && zoomLevel !== null) { | ||||||||||||||
return zoomLevel | ||||||||||||||
} | ||||||||||||||
return 7 | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch. I'm pretty sure the nullish coalescing operator also works in our setup, so you may write it shorter as this:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||||||
}, | ||||||||||||||
geoLocationMarkerLayer(_, __, ___, rootGetters) { | ||||||||||||||
return rootGetters?.map | ||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export default function positionChanged( | ||
position: number[], | ||
transformedCoords: number[] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The names are confusing to me, I'd prefer something like "oldPosition" and "newPosition". I know they're named like that in the other spot, but for a multi-purpose function this is oddly specific. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
): boolean { | ||
return ( | ||
position[0] !== transformedCoords[0] || position[1] !== transformedCoords[1] | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c439490