From a372c2a18cf9605d4e6c3cfacb2b70a2d609d4b9 Mon Sep 17 00:00:00 2001
From: RoryPTB <47696929+RoryPTB@users.noreply.github.com>
Date: Thu, 25 Jan 2024 19:24:00 +0100
Subject: [PATCH] Added bounding box map
---
src/components/BboxEditor.vue | 82 ++++---------
src/components/BboxEditorOld.vue | 140 +++++++++++++++++++++++
src/components/DiscoveryMetadataForm.vue | 28 +++--
3 files changed, 181 insertions(+), 69 deletions(-)
create mode 100644 src/components/BboxEditorOld.vue
diff --git a/src/components/BboxEditor.vue b/src/components/BboxEditor.vue
index 497d794..8d1dd4a 100644
--- a/src/components/BboxEditor.vue
+++ b/src/components/BboxEditor.vue
@@ -7,9 +7,9 @@
-
+
+ :draggable="false">
@@ -19,11 +19,11 @@
+
+
\ No newline at end of file
diff --git a/src/components/DiscoveryMetadataForm.vue b/src/components/DiscoveryMetadataForm.vue
index 255ec68..bd1f63e 100644
--- a/src/components/DiscoveryMetadataForm.vue
+++ b/src/components/DiscoveryMetadataForm.vue
@@ -66,7 +66,7 @@
-
+
@@ -495,7 +495,7 @@ export default defineComponent({
// Whether or not the metadata is new or existing
const isNew = ref(false);
// Geometry bounds
- const bounds = ref([90, 180, -90, -180]);
+ const bounds = ref([[0, 0], [0, 0]]);
// Phone number validation for each field
const isPocPhoneValid = ref(null);
const isDistribPhoneValid = ref(null);
@@ -712,14 +712,14 @@ export default defineComponent({
}
};
- // Update the geometry of the form based on the bounding box editor input
- const updateGeometry = (bbox) => {
- if (bbox) {
- model.value.origin.northLatitude = bbox.northLatitude;
- model.value.origin.eastLongitude = bbox.eastLongitude;
- model.value.origin.southLatitude = bbox.southLatitude;
- model.value.origin.westLongitude = bbox.westLongitude;
- }
+ // Update the rectangle in the map when the user changes the bounding box
+ const updateBbox = () => {
+ bounds.value = [
+ model.value.origin.northLatitude || 90,
+ model.value.origin.eastLongitude || -180,
+ model.value.origin.southLatitude || -90,
+ model.value.origin.westLongitude || 180
+ ];
};
// Validates the phone numbers entered by the user
@@ -1017,7 +1017,7 @@ export default defineComponent({
}
});
- // Also check if the formFilled value changes
+ // Also set the validation state to false if the formFilled value changes
watch(() => formFilled.value, (oldVal, newVal) => {
// Set metadataValidated.value to false whenever formFilled is changed
if (oldVal !== newVal) {
@@ -1025,6 +1025,11 @@ export default defineComponent({
}
});
+ // Update the map when the user changes the bounding box
+ watch(() => deepClone(model.value.origin), () => {
+ updateBbox();
+ });
+
// Watch for the distributor checkbox to duplicate the contact info any time the POC information is changed
// Note that watchEffect is used here instead of watch, because it should re run whenever any reactive dependency changes
watchEffect(() => {
@@ -1051,7 +1056,6 @@ export default defineComponent({
languageCodeList,
countryCodeList,
isNew,
- updateGeometry,
bounds,
isPocPhoneValid,
isDistribPhoneValid,