diff --git a/client/web/compose/src/components/ModuleFields/Configurator/Geometry.vue b/client/web/compose/src/components/ModuleFields/Configurator/Geometry.vue
index 3e1a389d5..660fdc677 100644
--- a/client/web/compose/src/components/ModuleFields/Configurator/Geometry.vue
+++ b/client/web/compose/src/components/ModuleFields/Configurator/Geometry.vue
@@ -1,21 +1,44 @@
+
+ {{ $t('prefillWithCurrentLocation') }}
+
+
+
+ {{ $t('hideCurrentLocationButton') }}
+
+
+
+
+
+
+
@@ -23,10 +46,16 @@
diff --git a/client/web/compose/src/components/ModuleFields/Editor/Geometry.vue b/client/web/compose/src/components/ModuleFields/Editor/Geometry.vue
index 098c566d8..4a9a44d22 100644
--- a/client/web/compose/src/components/ModuleFields/Editor/Geometry.vue
+++ b/client/web/compose/src/components/ModuleFields/Editor/Geometry.vue
@@ -33,13 +33,14 @@
@@ -55,15 +56,31 @@
+
+
+
+
+
@@ -72,23 +89,40 @@
+
+
+
+
@@ -100,16 +134,11 @@
-
- {{ $t('clickToPlaceMarker') }}
-
+ {{ $t('clickToPlaceMarker') }}
+
+
+
+
+
@@ -136,6 +179,7 @@
diff --git a/client/web/compose/src/components/ModuleFields/Viewer/Geometry.vue b/client/web/compose/src/components/ModuleFields/Viewer/Geometry.vue
index 4e48872f0..e80000717 100644
--- a/client/web/compose/src/components/ModuleFields/Viewer/Geometry.vue
+++ b/client/web/compose/src/components/ModuleFields/Viewer/Geometry.vue
@@ -30,6 +30,7 @@
:zoom="map.zoom"
:center="map.center"
style="height: 75vh; width: 100%;"
+ @locationfound="onLocationFound"
>
+
+
+
+
+
@@ -50,15 +64,20 @@
diff --git a/client/web/compose/src/components/PageBlocks/GeometryBase.vue b/client/web/compose/src/components/PageBlocks/GeometryBase.vue
index e4604ab1d..41d6aa6ef 100644
--- a/client/web/compose/src/components/PageBlocks/GeometryBase.vue
+++ b/client/web/compose/src/components/PageBlocks/GeometryBase.vue
@@ -25,6 +25,7 @@
:bounds="map.bounds"
:max-bounds="map.bounds"
class="w-100 h-100"
+ @locationfound="onLocationFound"
>
+
+
+
+
+
@@ -51,16 +65,17 @@
diff --git a/client/web/compose/src/components/PageBlocks/GeometryConfigurator/Configurator.vue b/client/web/compose/src/components/PageBlocks/GeometryConfigurator/Configurator.vue
index 4a6cca02d..e5534f8ab 100644
--- a/client/web/compose/src/components/PageBlocks/GeometryConfigurator/Configurator.vue
+++ b/client/web/compose/src/components/PageBlocks/GeometryConfigurator/Configurator.vue
@@ -14,11 +14,25 @@
@update:zoom="zoomUpdated"
@update:center="updateCenter"
@update:bounds="boundsUpdated"
+ @locationfound="onLocationFound"
>
+
+
+
+
+
{{ $t('geometry.mapHelpText') }}
@@ -130,16 +144,19 @@
diff --git a/client/web/compose/src/components/faIcons.js b/client/web/compose/src/components/faIcons.js
index 6721331e5..78dd4fee0 100644
--- a/client/web/compose/src/components/faIcons.js
+++ b/client/web/compose/src/components/faIcons.js
@@ -62,6 +62,7 @@ import {
faSync,
faExclamationTriangle,
faEllipsisV,
+ faLocationArrow,
} from '@fortawesome/free-solid-svg-icons'
import {
@@ -172,4 +173,5 @@ library.add(
faExclamationTriangle,
faSync,
faEllipsisV,
+ faLocationArrow,
)
diff --git a/lib/js/src/compose/types/module-field/geometry.ts b/lib/js/src/compose/types/module-field/geometry.ts
index 1a661b03c..653b0f226 100644
--- a/lib/js/src/compose/types/module-field/geometry.ts
+++ b/lib/js/src/compose/types/module-field/geometry.ts
@@ -7,6 +7,8 @@ interface GeometryOptions extends Options {
center: number[];
zoom: number;
multiDelimiter: string;
+ prefillWithCurrentLocation: boolean;
+ hideCurrentLocationButton: boolean;
}
const defaults = (): Readonly => Object.freeze({
@@ -14,6 +16,8 @@ const defaults = (): Readonly => Object.freeze({
center: [30, 30],
zoom: 3,
multiDelimiter: '\n',
+ prefillWithCurrentLocation: false,
+ hideCurrentLocationButton: false,
})
export class ModuleFieldGeometry extends ModuleField {
@@ -32,6 +36,8 @@ export class ModuleFieldGeometry extends ModuleField {
Apply(this.options, o, String, 'multiDelimiter')
Apply(this.options, o, Number, 'zoom')
+ Apply(this.options, o, Boolean, 'prefillWithCurrentLocation')
+ Apply(this.options, o, Boolean, 'hideCurrentLocationButton')
if (o.center) {
this.options.center = o.center
diff --git a/locale/en/corteza-webapp-compose/field.yaml b/locale/en/corteza-webapp-compose/field.yaml
index c2119bfb6..eb24b7dc0 100644
--- a/locale/en/corteza-webapp-compose/field.yaml
+++ b/locale/en/corteza-webapp-compose/field.yaml
@@ -143,8 +143,14 @@ kind:
label: Geometry
latitude: Latitude
longitude: Longitude
- clickToPlaceMarker: Click to place a marker or click on a marker to remove it
+ clickToPlaceMarker: Click to place/remove a marker
initialZoomAndPosition: Set initial map zoom and position
+ prefillWithCurrentLocation: Prefill with current location
+ hideCurrentLocationButton: Hide current location button
+ tooltip:
+ goToCurrentLocation: Go to current location
+ useCurrentLocation: Use current location
+ openMap: Open map
noPermission: No permission to read field value
no-items-found: No items found
options:
diff --git a/locale/en/corteza-webapp-compose/notification.yaml b/locale/en/corteza-webapp-compose/notification.yaml
index 914349ae2..98065bb72 100644
--- a/locale/en/corteza-webapp-compose/notification.yaml
+++ b/locale/en/corteza-webapp-compose/notification.yaml
@@ -28,6 +28,14 @@ field:
field-datetime:
valueNotFuture: Past value on future only field
valueNotPast: Future value on past only field
+field-geometry:
+ geolocationErrors:
+ permissionDenied: User denied the request for geolocation
+ positionUnavailable: Location information is unavailable
+ timeout: The request to get user location timed out
+ unknownError: An unknown error occurred
+ notSupported: Geolocation is not supported by this browser
+ errorOccurred: An error occurred while getting user location
general:
composeAccessNotAllowed: Not allowed to access Compose
error: Error