@abi-software/flatmapvuer 0.6.1-annotator.0 → 0.6.1-auth.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -151,11 +151,10 @@
151
151
  <template #reference>
152
152
  <map-svg-icon
153
153
  icon="connection"
154
- class="icon-button connection"
155
- @click="displayRelevanceDialog(true)"
154
+ class="icon-button drawRelevance inactive"
155
+ @click="relevanceDialogPopup"
156
156
  @mouseover="showToolitip(10)"
157
157
  @mouseout="hideToolitip(10)"
158
- v-show="hasRelevance && !inDrawing"
159
158
  />
160
159
  </template>
161
160
  </el-popover>
@@ -167,13 +166,13 @@
167
166
  width="80"
168
167
  popper-class="flatmap-popper"
169
168
  :visible="hoverVisibilities[11].value"
170
- v-if="drawingType !== 'LineString' && drawingType !== 'Polygon'"
169
+ v-if="drawnType !== 'LineString' && drawnType !== 'Polygon'"
171
170
  >
172
171
  <template #reference>
173
172
  <map-svg-icon
174
173
  icon="drawPoint"
175
174
  class="icon-button drawPoint"
176
- @click="drawnEvent('Point')"
175
+ @click="drawingEvent('Point')"
177
176
  @mouseover="showToolitip(11)"
178
177
  @mouseout="hideToolitip(11)"
179
178
  />
@@ -187,13 +186,13 @@
187
186
  width="80"
188
187
  popper-class="flatmap-popper"
189
188
  :visible="hoverVisibilities[12].value"
190
- v-if="drawingType !== 'Point' && drawingType !== 'Polygon'"
189
+ v-if="drawnType !== 'Point' && drawnType !== 'Polygon'"
191
190
  >
192
191
  <template #reference>
193
192
  <map-svg-icon
194
193
  icon="drawLine"
195
194
  class="icon-button drawLineString"
196
- @click="drawnEvent('LineString')"
195
+ @click="drawingEvent('LineString')"
197
196
  @mouseover="showToolitip(12)"
198
197
  @mouseout="hideToolitip(12)"
199
198
  />
@@ -207,13 +206,13 @@
207
206
  width="80"
208
207
  popper-class="flatmap-popper"
209
208
  :visible="hoverVisibilities[13].value"
210
- v-if="drawingType !== 'Point' && drawingType !== 'LineString'"
209
+ v-if="drawnType !== 'Point' && drawnType !== 'LineString'"
211
210
  >
212
211
  <template #reference>
213
212
  <map-svg-icon
214
213
  icon="drawPolygon"
215
214
  class="icon-button drawPolygon"
216
- @click="drawnEvent('Polygon')"
215
+ @click="drawingEvent('Polygon')"
217
216
  @mouseover="showToolitip(13)"
218
217
  @mouseout="hideToolitip(13)"
219
218
  />
@@ -231,8 +230,8 @@
231
230
  <template #reference>
232
231
  <map-svg-icon
233
232
  icon="drawTrash"
234
- class="icon-button drawTrash"
235
- @click="drawnEvent('Delete')"
233
+ class="icon-button drawDelete"
234
+ @click="drawingEvent('Delete')"
236
235
  @mouseover="showToolitip(14)"
237
236
  @mouseout="hideToolitip(14)"
238
237
  />
@@ -250,8 +249,8 @@
250
249
  <template #reference>
251
250
  <map-svg-icon
252
251
  icon="comment"
253
- class="icon-button comment"
254
- @click="drawnEvent('Edit')"
252
+ class="icon-button drawEdit"
253
+ @click="drawingEvent('Edit')"
255
254
  @mouseover="showToolitip(15)"
256
255
  @mouseout="hideToolitip(15)"
257
256
  />
@@ -342,7 +341,7 @@
342
341
  class="pathway-container"
343
342
  :class="{ open: drawerOpen, close: !drawerOpen }"
344
343
  :style="{ 'max-height': pathwaysMaxHeight + 'px' }"
345
- v-if="pathControls"
344
+
346
345
  v-popover:checkBoxPopover
347
346
  >
348
347
  <svg-legends v-if="!isFC" class="svg-legends-container" />
@@ -473,7 +472,14 @@
473
472
  virtual-triggering
474
473
  >
475
474
  <el-row v-for="item in openMapOptions" :key="item.key">
476
- <el-button type="primary" plain @click="$emit('open-map', item.key)">
475
+ <el-button type="primary" plain
476
+ @click="/**
477
+ * This event is emitted when the user chooses a different map option
478
+ * from ``openMapOptions`` props.
479
+ * @arg mapOption.key
480
+ * */
481
+ $emit('open-map', item.key)"
482
+ >
477
483
  {{ item.display }}
478
484
  </el-button>
479
485
  </el-row>
@@ -485,7 +491,7 @@
485
491
  width="200"
486
492
  :teleported="false"
487
493
  trigger="click"
488
- popper-class="background-popper"
494
+ popper-class="background-popper h-auto"
489
495
  virtual-triggering
490
496
  >
491
497
  <div>
@@ -499,8 +505,8 @@
499
505
  popper-class="flatmap_dropdown"
500
506
  >
501
507
  <el-option
502
- v-for="item in viewingModes"
503
- :key="item"
508
+ v-for="(item, i) in viewingModes"
509
+ :key="item + i"
504
510
  :label="item"
505
511
  :value="item"
506
512
  >
@@ -511,18 +517,18 @@
511
517
  </el-select>
512
518
  </el-row>
513
519
  <template v-if="viewingMode === 'Annotation' && userInformation">
514
- <el-row class="backgroundText">Drawing Type*</el-row>
520
+ <el-row class="backgroundText">Drawn By*</el-row>
515
521
  <el-row class="backgroundControl">
516
522
  <el-select
517
523
  :teleported="false"
518
- v-model="drawingType"
524
+ v-model="drawnType"
519
525
  placeholder="Select"
520
526
  class="select-box"
521
527
  popper-class="flatmap_dropdown"
522
- @change="setDrawingType"
528
+ @change="setDrawnType"
523
529
  >
524
530
  <el-option
525
- v-for="item in drawingTypes"
531
+ v-for="item in drawnTypes"
526
532
  :key="item"
527
533
  :label="item"
528
534
  :value="item"
@@ -533,18 +539,18 @@
533
539
  </el-option>
534
540
  </el-select>
535
541
  </el-row>
536
- <el-row class="backgroundText">Participation Type*</el-row>
542
+ <el-row class="backgroundText">Annotated By*</el-row>
537
543
  <el-row class="backgroundControl">
538
544
  <el-select
539
545
  :teleported="false"
540
- v-model="participationType"
546
+ v-model="annotatedType"
541
547
  placeholder="Select"
542
548
  class="select-box"
543
549
  popper-class="flatmap_dropdown"
544
- @change="setParticipationType"
550
+ @change="setAnnotatedType"
545
551
  >
546
552
  <el-option
547
- v-for="item in participationTypes"
553
+ v-for="item in annotatedTypes"
548
554
  :key="item"
549
555
  :label="item"
550
556
  :value="item"
@@ -556,13 +562,13 @@
556
562
  </el-select>
557
563
  </el-row>
558
564
  </template>
559
- <el-row class="backgroundSpacer"></el-row>
560
- <el-row class="backgroundText">Dimension display</el-row>
561
- <el-row class="backgroundControl">
565
+ <el-row class="backgroundSpacer" v-if="displayFlightPathOption"></el-row>
566
+ <el-row class="backgroundText" v-if="displayFlightPathOption">Flight path display</el-row>
567
+ <el-row class="backgroundControl" v-if="displayFlightPathOption">
562
568
  <el-radio-group
563
- v-model="dimensionRadio"
569
+ v-model="flightPath3DRadio"
564
570
  class="flatmap-radio"
565
- @change="setDimension"
571
+ @change="setFlightPath3D"
566
572
  >
567
573
  <el-radio :label="false">2D</el-radio>
568
574
  <el-radio :label="true">3D</el-radio>
@@ -663,53 +669,18 @@
663
669
  :annotationDisplay="viewingMode === 'Annotation'"
664
670
  @annotation="commitAnnotationEvent"
665
671
  />
666
- <el-dialog
667
- v-model="relevanceDisplay"
668
- width="200"
669
- :modal="false"
670
- :show-close="false"
671
- :lock-scroll="false"
672
- :close-on-click-modal="false"
673
- :close-on-press-escape="false"
674
- draggable
675
- >
676
- <template #header v-if="inDrawing">
677
- <span class="dialog-title">Finalise drawing</span>
678
- </template>
679
- <template #header v-else>
680
- <el-button type="primary" plain @click="displayRelevanceDialog(false)">
681
- Close
682
- </el-button>
683
- </template>
684
- <el-row v-if="inDrawing">
685
- <el-col :span="13">
686
- <el-button type="primary" plain @click="confirmDrawnFeature">
687
- Confirm
688
- </el-button>
689
- </el-col>
690
- <el-col :span="11">
691
- <el-button type="primary" plain @click="cancelDrawnFeature">
692
- Cancel
693
- </el-button>
694
- </el-col>
695
- </el-row>
696
- <el-row v-if="hasRelevance">
697
- <el-col :span="20">
698
- <b><span>Related Features</span></b>
699
- </el-col>
700
- <el-col :span="4">
701
- <el-icon><el-icon-circle-close @click="closePopup()"/></el-icon>
702
- </el-col>
703
- <el-card
704
- shadow="hover"
705
- v-for="(value, key) in relevanceEntry"
706
- :key="key"
707
- @click="displayRelevanceTooltip(value)"
708
- >
709
- <span>{{ key }}</span>
710
- </el-card>
711
- </el-row>
712
- </el-dialog>
672
+ <RelevanceDialog
673
+ class="relevance-dialog"
674
+ v-show="relevanceDisplay"
675
+ :entry="relevanceEntry"
676
+ :drawing="inDrawing"
677
+ :relevance="relevance"
678
+ @display="relevanceDialogPopup"
679
+ @confirm="confirmDrawnFeature"
680
+ @cancel="cancelDrawnFeature"
681
+ @popup="closePopup"
682
+ @tooltip="checkAndCreatePopups"
683
+ />
713
684
  </div>
714
685
  </div>
715
686
  </template>
@@ -721,7 +692,6 @@ import {
721
692
  WarningFilled as ElIconWarningFilled,
722
693
  ArrowDown as ElIconArrowDown,
723
694
  ArrowLeft as ElIconArrowLeft,
724
- CircleClose as ElIconCircleClose,
725
695
  } from '@element-plus/icons-vue'
726
696
  import Tooltip from './Tooltip.vue'
727
697
  import SelectionsGroup from './SelectionsGroup.vue'
@@ -746,14 +716,62 @@ import {
746
716
  } from '../services/flatmapQueries.js'
747
717
  import yellowstar from '../icons/yellowstar'
748
718
  import ResizeSensor from 'css-element-queries/src/ResizeSensor'
749
- import * as flatmap from 'customised-viewer'
719
+ import * as flatmap from '@abi-software/flatmap-viewer'
750
720
  import { AnnotationService } from '@abi-software/sparc-annotation'
721
+ import RelevanceDialog from './RelevanceDialog.vue'
722
+
723
+ /**
724
+ * @param scopeElement Draggable scope area (Optional)
725
+ * @param dragElement Draggable element
726
+ */
727
+ const draggable = (scopeElement, dragElement) => {
728
+ let startX, startY, clickX, clickY, posX, posY
729
+ // reset position in case previous pupped up dialog is dragged
730
+ dragElement.style.left = ''
731
+ dragElement.style.top = ''
732
+ // const scopeRect = scopeElement.getBoundingClientRect()
733
+ // const dragRect = dragElement.getBoundingClientRect()
734
+
735
+ dragElement.addEventListener('mousedown', (e) => {
736
+ e.preventDefault();
737
+ startX = dragElement.offsetLeft
738
+ startY = dragElement.offsetTop
739
+ clickX = e.clientX
740
+ clickY = e.clientY
741
+
742
+ dragElement.addEventListener('mousemove', drag, false);
743
+ document.addEventListener('mouseup', () => {
744
+ dragElement.removeEventListener('mousemove', drag, false);
745
+ }, false);
746
+ }, false);
747
+
748
+ function drag(e) {
749
+ e.preventDefault();
750
+ posX = startX - (clickX - e.clientX)
751
+ posY = startY - (clickY - e.clientY)
752
+ // if (
753
+ // (posX > scopeRect.left && ((posX + dragRect.width) < scopeRect.right)) &&
754
+ // (posY > scopeRect.top && ((posY + dragRect.height) < scopeRect.bottom))
755
+ // ) {
756
+ dragElement.style.left = `${posX}px`;
757
+ dragElement.style.top = `${posY}px`;
758
+ // } else {
759
+ // if (posX <= scopeRect.left) {
760
+ // dragElement.style.left = '0px';
761
+ // } else if (posX + dragRect.width >= scopeRect.right) {
762
+ // dragElement.style.left = `${scopeRect.right - dragRect.width}px`;
763
+ // }
764
+ // if (posY <= scopeRect.top) {
765
+ // dragElement.style.top = '0px';
766
+ // } else if (posY + dragRect.height >= scopeRect.bottom) {
767
+ // dragElement.style.top = `${scopeRect.bottom - dragRect.height}px`;
768
+ // }
769
+ // }
770
+ }
771
+ }
751
772
 
752
773
  const centroid = (geometry) => {
753
- let featureGeometry = {
754
- lng: 0,
755
- lat: 0,
756
- }
774
+ let featureGeometry = { lng: 0, lat: 0, }
757
775
  let coordinates
758
776
  if (geometry.type === "Polygon") {
759
777
  coordinates = geometry.coordinates[0]
@@ -834,6 +852,9 @@ const createUnfilledTooltipData = function () {
834
852
  }
835
853
  }
836
854
 
855
+ /**
856
+ * A vue component of the flatmap viewer.
857
+ */
837
858
  export default {
838
859
  name: 'FlatmapVuer',
839
860
  components: {
@@ -868,111 +889,73 @@ export default {
868
889
  return { annotator }
869
890
  },
870
891
  methods: {
871
- displayRelevanceTooltip: function (value) {
872
- if (this.mapImp) {
873
- this.checkAndCreatePopups(value)
874
- }
875
- },
876
892
  // This should be called when create is confirmed or cancelled
877
- initialiseDraw: function () {
893
+ initialiseDrawing: function () {
878
894
  this.inDrawing = false
879
- this.relevanceDisplay = false
880
- this.relevanceEntry = {}
895
+ this.initialiseDialog()
881
896
  this.activeDrawTool = undefined
882
897
  this.createdEvent = undefined
883
- this.setActiveDrawIcon()
884
898
  },
885
899
  cancelDrawnFeature: function () {
886
900
  if (this.createdEvent) {
887
- // For 'created' callback
888
901
  this.closePopup()
889
902
  this.annotationEntry = {
890
903
  ...this.createdEvent.feature,
891
904
  resourceId: this.serverUUID,
892
905
  }
893
906
  this.rollbackAnnotationEvent()
894
- this.initialiseDraw()
907
+ this.initialiseDrawing()
895
908
  }
896
909
  },
897
910
  confirmDrawnFeature: function () {
898
911
  if (this.createdEvent) {
899
912
  this.checkAndCreatePopups(this.createdEvent)
900
913
  // Add relevance if exist to annotationEntry
901
- // Relevance will only be added in creating draw annotation
902
- // And will not be updated if move drawn annotation
914
+ // Relevance will only be added in creating new drawn feature annotation
915
+ // And will not be updated if move drawn features
903
916
  if (Object.keys(this.relevanceEntry).length > 0) {
904
917
  this.annotationEntry.feature.relevance = this.relevanceEntry
905
918
  }
906
- this.initialiseDraw()
919
+ this.initialiseDrawing()
907
920
  }
908
921
  },
909
- displayRelevanceDialog: function (display) {
910
- // Change back to the initial window size
911
- // For a better view of the relevance popup
912
- if (display) this.resetView()
913
- this.closePopup()
914
- // Used when check exist drawn annotation relevance
915
- if (
916
- !this.createdEvent && !this.currentDrawnFeature &&
917
- Object.keys(this.relevanceEntry).length === 0
918
- ) {
919
- // Reset drawn event
920
- this.drawnEvent()
921
- } else if (this.createdEvent || Object.keys(this.relevanceEntry).length > 0) {
922
- this.relevanceDisplay = display
923
- if (!display && this.activeDrawMode === 'Delete') this.relevanceEntry = {}
924
- }
925
- },
926
- setActiveDrawIcon: function () {
927
- let mclass
928
- if (document.querySelector('.toolSelected')) {
929
- this.drawingTypes.map((t) => {
930
- if (t !== 'All' && t !== 'None') {
931
- document.querySelector(`.draw${t}`).classList.remove('toolSelected');
932
- }
933
- })
934
- this.drawModes.map((m) => {
935
- if (m === 'Delete') mclass = '.drawTrash'
936
- else if (m === 'Edit') mclass = '.comment'
937
- document.querySelector(mclass).classList.remove('toolSelected');
938
- })
939
- }
940
- if (this.activeDrawTool) {
941
- document.querySelector(`.draw${this.activeDrawTool}`).classList.add('toolSelected');
942
- } else if (this.activeDrawMode) {
943
- if (this.activeDrawMode === 'Delete') mclass = '.drawTrash'
944
- else if (this.activeDrawMode === 'Edit') mclass = '.comment'
945
- document.querySelector(mclass).classList.add('toolSelected');
922
+ initialiseDialog: function () {
923
+ this.relevanceDisplay = false
924
+ this.relevanceEntry = {}
925
+ },
926
+ relevanceDialogPopup: function () {
927
+ const inactive = this.$el.querySelector('.drawRelevance').classList.contains('inactive')
928
+ // disable click popup if icon inactive or in drawing
929
+ if (!inactive && !this.inDrawing) {
930
+ this.closePopup()
931
+ this.relevanceDisplay = !this.relevanceDisplay
946
932
  }
947
933
  },
948
- drawnEvent: function (type = undefined) {
934
+ drawingEvent: function (type) {
949
935
  this.closePopup()
950
- if (!type) {
951
- this.activeDrawTool = undefined
952
- this.activeDrawMode = undefined
953
- this.inDrawing = false
954
- } else if (this.drawingTypes.includes(type)) {
955
- if (this.activeDrawMode) {
956
- document.querySelector('.mapbox-gl-draw_trash').click()
957
- this.activeDrawMode = undefined
958
- }
936
+ // disable mode icon click if any tool is active
937
+ if (this.drawnTypes.includes(type) && !this.activeDrawMode && !this.relevanceDisplay) {
959
938
  if (type === 'Point') {
960
- document.querySelector('.mapbox-gl-draw_point').click()
961
- this.activeDrawTool = this.activeDrawTool === 'Point' ? undefined : 'Point'
939
+ const point = this.$el.querySelector('.mapbox-gl-draw_point')
940
+ this.$el.querySelector('.mapbox-gl-draw_point').click()
941
+ this.activeDrawTool = point.classList.contains('active') ? 'Point' : undefined
962
942
  } else if (type === 'LineString') {
963
- document.querySelector('.mapbox-gl-draw_line').click()
964
- this.activeDrawTool = this.activeDrawTool === 'LineString' ? undefined : 'LineString'
943
+ const line = this.$el.querySelector('.mapbox-gl-draw_line')
944
+ this.$el.querySelector('.mapbox-gl-draw_line').click()
945
+ this.activeDrawTool = line.classList.contains('active') ? 'LineString' : undefined
965
946
  } else if (type === 'Polygon') {
966
- document.querySelector('.mapbox-gl-draw_polygon').click()
967
- this.activeDrawTool = this.activeDrawTool === 'Polygon' ? undefined : 'Polygon'
968
- }
969
- } else if (this.drawModes.includes(type)) {
970
- if (this.activeDrawTool) {
971
- document.querySelector('.mapbox-gl-draw_trash').click()
972
- this.activeDrawTool = undefined
947
+ const polygon = this.$el.querySelector('.mapbox-gl-draw_polygon')
948
+ this.$el.querySelector('.mapbox-gl-draw_polygon').click()
949
+ this.activeDrawTool = polygon.classList.contains('active') ? 'Polygon' : undefined
973
950
  }
951
+ // disable tool icon click if any mode is on
952
+ } else if (this.drawModes.includes(type) && !this.activeDrawTool) {
974
953
  if (type === 'Delete') {
975
- if (this.currentDrawnFeature && !this.activeDrawMode) {
954
+ if (
955
+ this.currentDrawnFeature &&
956
+ // For either no mode is on or edit is on
957
+ (!this.activeDrawMode || this.activeDrawMode === 'Edit')
958
+ ) {
976
959
  // Force simple_select a feature for delete event
977
960
  this.doubleClickedFeature = false
978
961
  this.changeAnnotationDrawMode({
@@ -982,11 +965,14 @@ export default {
982
965
  this.trashAnnotationFeature()
983
966
  }
984
967
  this.activeDrawMode = this.activeDrawMode === 'Delete' ? undefined : 'Delete'
968
+ // clear currentDrawnFeature when quit delete mode
969
+ if (!this.activeDrawMode) {
970
+ this.currentDrawnFeature = undefined
971
+ }
985
972
  } else if (type === 'Edit') {
986
973
  this.activeDrawMode = this.activeDrawMode === 'Edit' ? undefined : 'Edit'
987
974
  }
988
975
  }
989
- this.setActiveDrawIcon()
990
976
  },
991
977
  changeAnnotationDrawMode: function (mode) {
992
978
  if (this.mapImp) {
@@ -1009,11 +995,12 @@ export default {
1009
995
  }
1010
996
  },
1011
997
  rollbackAnnotationEvent: function () {
1012
- if (this.mapImp) {
1013
- // For 'updated' and 'deleted' callback
1014
- if (this.drawnAnnotationEvent.includes(this.annotationEntry.type)) {
1015
- this.mapImp.rollbackAnnotationEvent(this.annotationEntry)
1016
- }
998
+ // For 'updated' and 'deleted' callback
999
+ if (
1000
+ this.mapImp &&
1001
+ this.drawnAnnotationEvent.includes(this.annotationEntry.type)
1002
+ ) {
1003
+ this.mapImp.rollbackAnnotationEvent(this.annotationEntry)
1017
1004
  }
1018
1005
  },
1019
1006
  commitAnnotationEvent: function (annotation) {
@@ -1024,13 +1011,18 @@ export default {
1024
1011
  annotation
1025
1012
  ) {
1026
1013
  this.annotationSubmitted = true
1027
- if (this.annotationEntry.type === 'deleted') this.closePopup()
1028
1014
  this.mapImp.commitAnnotationEvent(this.annotationEntry)
1015
+ if (this.annotationEntry.type === 'deleted') {
1016
+ this.closePopup()
1017
+ } else {
1018
+ // Use to update 'this.drawnAnnotationFeatures' when created or updated
1019
+ this.addAnnotationFeature()
1020
+ }
1029
1021
  }
1030
1022
  },
1031
1023
  setFeatureAnnotated: function () {
1032
1024
  if (this.mapImp) {
1033
- this.annotator.annotatedItemIds(this.serverUUID)
1025
+ this.annotator.annotatedItemIds(this.userApiKey, this.serverUUID)
1034
1026
  .then((annotatedItemIds) => {
1035
1027
  for (const id of annotatedItemIds) {
1036
1028
  this.mapImp.setFeatureAnnotated(id)
@@ -1043,39 +1035,42 @@ export default {
1043
1035
  },
1044
1036
  addAnnotationFeature: function () {
1045
1037
  if (this.mapImp) {
1046
- this.clearAnnotationFeature()
1047
- if (this.drawingType !== 'None') {
1048
- this.annotator.drawnFeatures(this.serverUUID)
1038
+ if (!this.annotationSubmitted) this.clearAnnotationFeature()
1039
+ if (this.drawnType !== 'None') {
1040
+ this.annotator.drawnFeatures(this.userApiKey, this.serverUUID)
1049
1041
  .then((drawnFeatures) => {
1050
1042
  // Use to switch the displayed feature type
1051
- if (this.drawingType !== 'All') {
1043
+ if (this.drawnType !== 'All tools') {
1052
1044
  drawnFeatures = drawnFeatures.filter((feature) => {
1053
- return feature.geometry.type === this.drawingType
1045
+ return feature.geometry.type === this.drawnType
1054
1046
  })
1055
1047
  }
1056
1048
  this.drawnAnnotationFeatures = drawnFeatures
1057
- for (const feature of drawnFeatures) {
1058
- if (this.participationType !== 'All') {
1059
- this.annotator
1060
- .itemAnnotations(this.serverUUID, feature.id)
1061
- .then((value) => {
1062
- let participated = value.filter((v) => {
1063
- return (
1064
- v.creator.name === this.userInformation.name &&
1065
- v.creator.email === this.userInformation.email
1066
- )
1067
- }).length > 0
1068
- if (
1069
- (this.participationType === 'Participated' && participated) ||
1070
- (this.participationType === 'Not participated' && !participated)
1071
- ) {
1072
- this.mapImp.addAnnotationFeature(feature)
1073
- }
1074
- })
1075
- .catch((reason) => {
1076
- console.log(reason) // Error!
1077
- })
1078
- } else this.mapImp.addAnnotationFeature(feature)
1049
+ // No need to call 'addAnnotationFeature' when a new feature created
1050
+ if (!this.annotationSubmitted) {
1051
+ for (const feature of drawnFeatures) {
1052
+ if (this.annotatedType !== 'Everyone') {
1053
+ this.annotator
1054
+ .itemAnnotations(this.userApiKey, this.serverUUID, feature.id)
1055
+ .then((value) => {
1056
+ let participated = value.filter((v) => {
1057
+ return (
1058
+ v.creator.name === this.userInformation.name &&
1059
+ v.creator.email === this.userInformation.email
1060
+ )
1061
+ }).length > 0
1062
+ if (
1063
+ (this.annotatedType === 'Me' && participated) ||
1064
+ (this.annotatedType === 'Others' && !participated)
1065
+ ) {
1066
+ this.mapImp.addAnnotationFeature(feature)
1067
+ }
1068
+ })
1069
+ .catch((reason) => {
1070
+ console.log(reason) // Error!
1071
+ })
1072
+ } else this.mapImp.addAnnotationFeature(feature)
1073
+ }
1079
1074
  }
1080
1075
  })
1081
1076
  .catch((reason) => {
@@ -1089,27 +1084,36 @@ export default {
1089
1084
  // Control the show/hide of the drawn annotations
1090
1085
  this.mapImp.showAnnotator(flag)
1091
1086
  // Hide default toolbar, we will use customised SVG icons instead
1092
- document.querySelector('.maplibregl-ctrl-group').style.display = 'none'
1087
+ this.$el.querySelector('.maplibregl-ctrl-group').style.display = 'none'
1093
1088
  }
1094
1089
  },
1095
- setDrawingType: function (flag) {
1096
- this.drawingType = flag
1090
+ setDrawnType: function (flag) {
1091
+ this.drawnType = flag
1097
1092
  if (this.mapImp) {
1098
1093
  this.addAnnotationFeature()
1099
1094
  }
1100
1095
  },
1101
- setParticipationType: function (flag) {
1102
- this.participationType = flag
1096
+ setAnnotatedType: function (flag) {
1097
+ this.annotatedType = flag
1103
1098
  if (this.mapImp) {
1104
1099
  this.addAnnotationFeature()
1105
1100
  }
1106
1101
  },
1107
- setDimension: function (flag) {
1108
- this.dimensionRadio = flag
1102
+ /**
1103
+ * @vuese
1104
+ * Function to switch from 2D to 3D
1105
+ * @arg flag
1106
+ */
1107
+ setFlightPath3D: function (flag) {
1108
+ this.flightPath3DRadio = flag
1109
1109
  if (this.mapImp) {
1110
1110
  this.mapImp.enable3dPaths(flag)
1111
1111
  }
1112
1112
  },
1113
+ /**
1114
+ * @vuese
1115
+ * Function to view the latest map (example when you are on legacy map).
1116
+ */
1113
1117
  viewLatestMap: function () {
1114
1118
  let biologicalSex = this.biologicalSex ? this.biologicalSex : undefined
1115
1119
  //Human requires special handling
@@ -1121,14 +1125,28 @@ export default {
1121
1125
  biologicalSex,
1122
1126
  viewport: this.mapImp.getState(),
1123
1127
  }
1128
+ /**
1129
+ * The event emitted by ``viewLatestMap`` method.
1130
+ */
1124
1131
  this.$emit('view-latest-map', state)
1125
1132
  },
1133
+ /**
1134
+ * @vuese
1135
+ * Function to change the background colour of the map
1136
+ * by providing the ``colour``.
1137
+ * @arg colour
1138
+ */
1126
1139
  backgroundChangeCallback: function (colour) {
1127
1140
  this.currentBackground = colour
1128
1141
  if (this.mapImp) {
1129
1142
  this.mapImp.setBackgroundColour(this.currentBackground, 1)
1130
1143
  }
1131
1144
  },
1145
+ /**
1146
+ * @vuese
1147
+ * Function to process a list of a FC flatmap's systems.
1148
+ * @arg systems
1149
+ */
1132
1150
  processSystems: function (systems) {
1133
1151
  this.systems.length = 0
1134
1152
  if (systems && systems.length > 0) {
@@ -1148,6 +1166,13 @@ export default {
1148
1166
  this.systems.push(data)
1149
1167
  }
1150
1168
  },
1169
+ /**
1170
+ * @vuese
1171
+ * Function to add taxon identifiers into the taxon connectivity array,
1172
+ * by retrieving their corresponding labels using the flatmap API.
1173
+ * @arg flatmapAPI,
1174
+ * @arg taxonIdentifiers
1175
+ */
1151
1176
  processTaxon: function (flatmapAPI, taxonIdentifiers) {
1152
1177
  this.taxonConnectivity.length = 0
1153
1178
  taxonIdentifiers.forEach((taxon) => {
@@ -1157,11 +1182,18 @@ export default {
1157
1182
  })
1158
1183
  })
1159
1184
  },
1185
+ /**
1186
+ * @vuese
1187
+ * Function to show or hide the display of the bottom-left drawer container.
1188
+ */
1160
1189
  toggleDrawer: function () {
1161
1190
  this.drawerOpen = !this.drawerOpen
1162
1191
  },
1163
1192
  /**
1193
+ * @vuese
1164
1194
  * Function to toggle colour/greyscale of organs.
1195
+ * The parameter ``flag`` is a boolean, ``true`` (colour) and ``false`` (greyscale).
1196
+ * @arg flag
1165
1197
  */
1166
1198
  setColour: function (flag) {
1167
1199
  this.colourRadio = flag
@@ -1170,7 +1202,10 @@ export default {
1170
1202
  }
1171
1203
  },
1172
1204
  /**
1205
+ * @vuese
1173
1206
  * Function to toggle outlines f organs.
1207
+ * The parameter ``flag`` is a boolean, ``true`` to show outlines, ``false`` to hide outlines.
1208
+ * @arg flag
1174
1209
  */
1175
1210
  setOutlines: function (flag) {
1176
1211
  this.outlineRadio = flag
@@ -1179,6 +1214,7 @@ export default {
1179
1214
  }
1180
1215
  },
1181
1216
  /**
1217
+ * @vuese
1182
1218
  * Function to toggle paths to default.
1183
1219
  * Also called when the associated button is pressed.
1184
1220
  */
@@ -1203,6 +1239,7 @@ export default {
1203
1239
  }
1204
1240
  },
1205
1241
  /**
1242
+ * @vuese
1206
1243
  * Function to zoom in.
1207
1244
  * Also called when the associated button is pressed.
1208
1245
  */
@@ -1212,6 +1249,7 @@ export default {
1212
1249
  }
1213
1250
  },
1214
1251
  /**
1252
+ * @vuese
1215
1253
  * Function to zoom out.
1216
1254
  * Also called when the associated button is pressed.
1217
1255
  */
@@ -1220,16 +1258,34 @@ export default {
1220
1258
  this.mapImp.zoomOut()
1221
1259
  }
1222
1260
  },
1261
+ /**
1262
+ * @vuese
1263
+ * Function to show or hide centrelines and nodes.
1264
+ * The parameter ``payload`` is an object with a boolean property, ``value``,
1265
+ * ``payload.value = true/false``.
1266
+ * @arg payload
1267
+ */
1223
1268
  centreLinesSelected: function (payload) {
1224
1269
  if (this.mapImp) {
1225
1270
  this.mapImp.enableCentrelines(payload.value)
1226
1271
  }
1227
1272
  },
1273
+ /**
1274
+ * // Currently not in use
1275
+ * Function to show or hide paths valid in SCKAN
1276
+ * by providing ``{key, value}`` pair in ``payload``.
1277
+ * @arg payload
1278
+ */
1228
1279
  sckanSelected: function (payload) {
1229
1280
  if (this.mapImp) {
1230
1281
  this.mapImp.enableSckanPath(payload.key, payload.value)
1231
1282
  }
1232
1283
  },
1284
+ /**
1285
+ * // Currently not in use
1286
+ * Function to show or hide all paths valid in SCKAN.
1287
+ * @arg payload
1288
+ */
1233
1289
  checkAllSCKAN: function (payload) {
1234
1290
  if (this.mapImp) {
1235
1291
  payload.keys.forEach((key) =>
@@ -1237,6 +1293,12 @@ export default {
1237
1293
  )
1238
1294
  }
1239
1295
  },
1296
+ /**
1297
+ * @vuese
1298
+ * Function to highlight the connected paths
1299
+ * by providing path model identifier, ``pathId``.
1300
+ * @arg pathId
1301
+ */
1240
1302
  highlightConnectedPaths: function (payload) {
1241
1303
  if (this.mapImp) {
1242
1304
  let paths = [...this.mapImp.pathModelNodes(payload)]
@@ -1253,11 +1315,23 @@ export default {
1253
1315
  this.mapImp.zoomToFeatures(toHighlight, { noZoomIn: true })
1254
1316
  }
1255
1317
  },
1318
+ /**
1319
+ * @vuese
1320
+ * Function to enable/disable (show/hide) the system
1321
+ * by providing ``kay, value`` ``payload`` object ``{systemId, true/false}``.
1322
+ * @arg payload
1323
+ */
1256
1324
  systemSelected: function (payload) {
1257
1325
  if (this.mapImp) {
1258
1326
  this.mapImp.enableSystem(payload.key, payload.value)
1259
1327
  }
1260
1328
  },
1329
+ /**
1330
+ * @vuese
1331
+ * Function to enable/disable (show/hide) all systems
1332
+ * by providing ``flag`` (true/false).
1333
+ * @arg flag
1334
+ */
1261
1335
  checkAllSystems: function (flag) {
1262
1336
  if (this.mapImp) {
1263
1337
  this.systems[0].children.forEach((key) =>
@@ -1265,14 +1339,31 @@ export default {
1265
1339
  )
1266
1340
  }
1267
1341
  },
1342
+ /**
1343
+ * @vuese
1344
+ * Function to display features with annotation matching the provided term.
1345
+ * @arg models
1346
+ */
1268
1347
  ftuSelected: function (models) {
1269
1348
  this.searchAndShowResult(models, true)
1270
1349
  },
1350
+ /**
1351
+ * @vuese
1352
+ * Function to show or hide the layer
1353
+ * by providing ``{layerId, true/false}`` in ``payload``.
1354
+ * @arg payload
1355
+ */
1271
1356
  layersSelected: function (payload) {
1272
1357
  if (this.mapImp) {
1273
1358
  this.mapImp.enableLayer(payload.key, payload.value)
1274
1359
  }
1275
1360
  },
1361
+ /**
1362
+ * @vuese
1363
+ * Function to show or hide all layers
1364
+ * by providing ``payload`` with ``payload.keys`` array and ``payload.value`` flag.
1365
+ * @arg payload
1366
+ */
1276
1367
  checkAllLayers: function (payload) {
1277
1368
  if (this.mapImp) {
1278
1369
  payload.keys.forEach((key) =>
@@ -1280,11 +1371,23 @@ export default {
1280
1371
  )
1281
1372
  }
1282
1373
  },
1374
+ /**
1375
+ * @vuese
1376
+ * Function to show or hide connectivity features observed in particular species
1377
+ * by providing ``{taxonId, true/false}`` in ``payload.key, payload.value``.
1378
+ * @arg payload
1379
+ */
1283
1380
  taxonsSelected: function (payload) {
1284
1381
  if (this.mapImp) {
1285
1382
  this.mapImp.enableConnectivityByTaxonIds(payload.key, payload.value)
1286
1383
  }
1287
1384
  },
1385
+ /**
1386
+ * @vuese
1387
+ * Function to show or hide connectivity features observed in particular species
1388
+ * by providing ``payload`` with ``payload.keys`` array and ``payload.value`` flag.
1389
+ * @arg payload
1390
+ */
1288
1391
  checkAllTaxons: function (payload) {
1289
1392
  if (this.mapImp) {
1290
1393
  payload.keys.forEach((key) =>
@@ -1292,11 +1395,23 @@ export default {
1292
1395
  )
1293
1396
  }
1294
1397
  },
1398
+ /**
1399
+ * @vuese
1400
+ * Function to hide or show paths of a given type
1401
+ * by providing ``{pathType, true/false}`` in ``payload.key, payload.value``.
1402
+ * @arg payload
1403
+ */
1295
1404
  pathwaysSelected: function (payload) {
1296
1405
  if (this.mapImp) {
1297
1406
  this.mapImp.enablePath(payload.key, payload.value)
1298
1407
  }
1299
1408
  },
1409
+ /**
1410
+ * @vuese
1411
+ * Function to hide or show paths of a given type
1412
+ * by providing ``payload`` with ``payload.keys`` array and ``payload.value`` flag.
1413
+ * @arg payload
1414
+ */
1300
1415
  checkAllPathways: function (payload) {
1301
1416
  if (this.mapImp) {
1302
1417
  payload.keys.forEach((key) =>
@@ -1304,9 +1419,21 @@ export default {
1304
1419
  )
1305
1420
  }
1306
1421
  },
1422
+ /**
1423
+ * @vuese
1424
+ * Function to generate callbacks as a result of panning/zooming the map.
1425
+ * ``flag`` (boolean) - generate callbacks when ``true``, otherwise disable them.
1426
+ * @arg flag
1427
+ */
1307
1428
  enablePanZoomEvents: function (flag) {
1308
1429
  this.mapImp.enablePanZoomEvents(flag)
1309
1430
  },
1431
+ /**
1432
+ * @vuese
1433
+ * A callback function, invoked when events occur with the map.
1434
+ * The first parameter gives the type of event, the second provides details about the event.
1435
+ * _(This is the ``callback`` function from ``MapManager.loadMap()``)_.
1436
+ */
1310
1437
  eventCallback: function () {
1311
1438
  return (eventType, data, ...args) => {
1312
1439
  if (eventType === 'annotation') {
@@ -1318,17 +1445,21 @@ export default {
1318
1445
  // Popup closed will trigger aborted event
1319
1446
  if (data.type === 'aborted') {
1320
1447
  // Rollback drawing when no new annotation submitted
1321
- if (!this.annotationSubmitted) {
1322
- this.rollbackAnnotationEvent()
1323
- }
1448
+ if (!this.annotationSubmitted) this.rollbackAnnotationEvent()
1449
+ else this.annotationSubmitted = false
1324
1450
  } else if (data.type === 'modeChanged') {
1325
1451
  // 'modeChanged' event is before 'created' event
1326
1452
  if (data.feature.mode.startsWith('draw_')) {
1327
1453
  // Reset data entry for every draw
1328
- this.relevanceEntry = {}
1454
+ this.initialiseDialog()
1329
1455
  this.inDrawing = true
1330
1456
  } else if (data.feature.mode === 'simple_select' && this.inDrawing) {
1331
- this.displayRelevanceDialog(true)
1457
+ if (this.createdEvent) {
1458
+ this.relevanceDisplay = true
1459
+ } else {
1460
+ // Reset if a invalid draw
1461
+ this.initialiseDrawing()
1462
+ }
1332
1463
  } else if (data.feature.mode === 'direct_select') {
1333
1464
  this.doubleClickedFeature = true
1334
1465
  }
@@ -1338,8 +1469,14 @@ export default {
1338
1469
  undefined :
1339
1470
  data.feature.features[0]
1340
1471
  payload.feature.feature = this.currentDrawnFeature
1341
- // For exist drawn annotation features
1342
- this.checkAndCreateDrawnFeaturePopups(payload)
1472
+ if (!this.inDrawing) {
1473
+ this.initialiseDialog()
1474
+ // For exist drawn annotation features
1475
+ if (this.currentDrawnFeature) {
1476
+ this.processRelevance()
1477
+ this.checkAndCreateDrawnFeaturePopups(payload)
1478
+ }
1479
+ }
1343
1480
  } else {
1344
1481
  if (data.type === 'created' || data.type === 'updated') {
1345
1482
  if (data.type === 'updated' && data.feature.action) {
@@ -1364,6 +1501,15 @@ export default {
1364
1501
  const resource = [data.models]
1365
1502
  const taxonomy = this.entry
1366
1503
  const biologicalSex = this.biologicalSex
1504
+ let taxons = undefined
1505
+ if (data.taxons) {
1506
+ // check if data.taxons is string or array
1507
+ if (typeof data.taxons !== 'object') {
1508
+ taxons = JSON.parse(data.taxons)
1509
+ } else {
1510
+ taxons = data.taxons
1511
+ }
1512
+ }
1367
1513
  const payload = {
1368
1514
  dataset: data.dataset,
1369
1515
  biologicalSex: biologicalSex,
@@ -1373,16 +1519,17 @@ export default {
1373
1519
  feature: data,
1374
1520
  userData: args,
1375
1521
  eventType: eventType,
1376
- provenanceTaxonomy: data.taxons
1377
- ? JSON.parse(data.taxons)
1378
- : undefined,
1522
+ provenanceTaxonomy: taxons,
1379
1523
  }
1380
1524
  if (eventType === 'click') {
1381
1525
  if (this.viewingMode === 'Network Discovery') {
1382
1526
  this.highlightConnectedPaths([data.models])
1383
1527
  } else {
1384
1528
  this.currentActive = data.models ? data.models : ''
1385
- this.allocateRelevance(payload)
1529
+ // Stop adding features if dialog displayed
1530
+ if (this.inDrawing && !this.relevanceDisplay ) {
1531
+ this.processRelevance(payload)
1532
+ }
1386
1533
  }
1387
1534
  } else if (
1388
1535
  eventType === 'mouseenter' &&
@@ -1407,60 +1554,115 @@ export default {
1407
1554
  }
1408
1555
  }
1409
1556
  },
1410
- allocateRelevance: function (data = undefined) {
1557
+ // for dialog popup
1558
+ dialogCssHacks: function () {
1559
+ this.$nextTick(() => {
1560
+ const dialog = this.$el.querySelector('.relevance-dialog')
1561
+ draggable(this.$el, dialog)
1562
+ // dialog popup at the click position
1563
+ // slightly change x or y if close to boundary
1564
+ let posX, posY
1565
+ const containerRect = this.$el.getBoundingClientRect()
1566
+ const dialogRect = dialog.getBoundingClientRect()
1567
+ if (this.dialogPosition.x > containerRect.width / 2) {
1568
+ posX = this.dialogPosition.x - dialogRect.width
1569
+ } else {
1570
+ posX = this.dialogPosition.x
1571
+ }
1572
+ if (this.dialogPosition.y > containerRect.height / 2) {
1573
+ posY = this.dialogPosition.y - dialogRect.height
1574
+ } else {
1575
+ posY = this.dialogPosition.y
1576
+ }
1577
+ dialog.style.transform =
1578
+ `translate(${posX - this.dialogPosition.offsetX}px, ${posY - this.dialogPosition.offsetY}px)`
1579
+ })
1580
+ },
1581
+ drawIconCssHacks: function () {
1582
+ // set tool/mode icon status
1583
+ if (this.$el.querySelector('.iconSelected') || !this.relevanceDisplay) {
1584
+ this.drawnTypes.map((t) => {
1585
+ const dtype = this.$el.querySelector(`.draw${t}`)
1586
+ if (dtype) {
1587
+ dtype.classList.remove('iconSelected');
1588
+ dtype.classList.remove('inactive');
1589
+ }
1590
+ })
1591
+ this.drawModes.map((m) => {
1592
+ this.$el.querySelector(`.draw${m}`).classList.remove('iconSelected');
1593
+ this.$el.querySelector(`.draw${m}`).classList.remove('inactive');
1594
+ })
1595
+ }
1596
+ if (this.activeDrawTool) {
1597
+ this.$el.querySelector(`.draw${this.activeDrawTool}`).classList.add('iconSelected');
1598
+ this.drawModes.map((m) => {
1599
+ this.$el.querySelector(`.draw${m}`).classList.add('inactive');
1600
+ })
1601
+ } else if (this.activeDrawMode || this.relevanceDisplay) {
1602
+ if (this.activeDrawMode) {
1603
+ this.$el.querySelector(`.draw${this.activeDrawMode}`).classList.add('iconSelected');
1604
+ }
1605
+ this.drawnTypes.map((t) => {
1606
+ const dtype = this.$el.querySelector(`.draw${t}`)
1607
+ if (dtype) dtype.classList.add('inactive');
1608
+ })
1609
+ }
1610
+ },
1611
+ processRelevance: function (data = undefined) {
1612
+ // process while drawing new features
1411
1613
  if (data && data.feature) {
1412
1614
  // Only clicked relevance data will be added
1413
- let relevance = data.feature.models ?
1414
- data.feature.models :
1415
- data.feature.featureId
1416
- if (
1417
- relevance &&
1418
- this.inDrawing &&
1419
- // Currently only draw line will show relevance
1420
- this.activeDrawTool === 'LineString' &&
1421
- !(relevance in this.relevanceEntry)
1422
- ) {
1423
- this.relevanceEntry[relevance] = data
1615
+ let relevant = data.feature.models ? data.feature.models : data.feature.featureId
1616
+ // only the linestring will have relevance at the current stage
1617
+ if (relevant && this.activeDrawTool === 'LineString') {
1618
+ this.relevanceEntry[relevant] = data
1619
+ }
1620
+ } else {
1621
+ // process while checking exist features
1622
+ if (this.currentDrawnFeature && this.drawnAnnotationFeatures) {
1623
+ let feature = this.drawnAnnotationFeatures
1624
+ .filter((feature) => {
1625
+ return feature.id === this.currentDrawnFeature.id
1626
+ })[0]
1627
+ if (feature && feature.relevance) {
1628
+ this.relevanceEntry = feature.relevance
1629
+ }
1424
1630
  }
1425
- } else if (this.currentDrawnFeature && this.drawnAnnotationFeatures) {
1426
- let relevance = this.drawnAnnotationFeatures
1427
- .filter((feature) => {
1428
- return feature.id === this.currentDrawnFeature.id
1429
- })[0].relevance
1430
- if (relevance) this.relevanceEntry = relevance
1431
1631
  }
1432
1632
  },
1633
+ // This is used only when either edit or delete mode is on
1433
1634
  checkAndCreateDrawnFeaturePopups: function (data) {
1434
- if (!this.inDrawing) {
1435
- this.relevanceEntry = {}
1436
- if (this.currentDrawnFeature) {
1437
- this.allocateRelevance()
1438
- if (this.activeDrawMode) {
1439
- // double click fires 'updated' callback
1440
- if (this.doubleClickedFeature) {
1441
- if (data.feature.feature.geometry.type !== 'Point') {
1442
- // show tooltip and enter edit mode
1443
- this.changeAnnotationDrawMode({
1444
- mode: 'direct_select',
1445
- options: { featureId: data.feature.feature.id }
1446
- })
1447
- this.trashAnnotationFeature()
1448
- }
1449
- this.doubleClickedFeature = false
1450
- } else { // single click
1451
- if (this.activeDrawMode === 'Delete') {
1452
- this.changeAnnotationDrawMode({
1453
- mode: 'simple_select',
1454
- options: { featureIds: [data.feature.feature.id] }
1455
- })
1456
- this.trashAnnotationFeature()
1457
- }
1458
- }
1635
+ if (this.activeDrawMode) {
1636
+ // double click fires 'updated' callback
1637
+ if (this.doubleClickedFeature) {
1638
+ if (data.feature.feature.geometry.type !== 'Point') {
1639
+ // show tooltip and enter edit mode
1640
+ this.changeAnnotationDrawMode({
1641
+ mode: 'direct_select',
1642
+ options: { featureId: data.feature.feature.id }
1643
+ })
1644
+ this.trashAnnotationFeature()
1645
+ }
1646
+ this.doubleClickedFeature = false
1647
+ } else {
1648
+ // single click fires delete
1649
+ if (this.activeDrawMode === 'Delete') {
1650
+ this.changeAnnotationDrawMode({
1651
+ mode: 'simple_select',
1652
+ options: { featureIds: [data.feature.feature.id] }
1653
+ })
1654
+ this.trashAnnotationFeature()
1459
1655
  }
1460
1656
  }
1461
1657
  }
1462
1658
  },
1463
1659
  // checkNeuronClicked shows a neuron path pop up if a path was recently clicked
1660
+ /**
1661
+ * @vuese
1662
+ * Function to create/display tooltips from the provided ``data``.
1663
+ * _checkNeuronClicked shows a neuron path pop up if a path was recently clicked._
1664
+ * @arg data
1665
+ */
1464
1666
  checkAndCreatePopups: async function (data) {
1465
1667
  // Call flatmap database to get the connection data
1466
1668
  if (this.viewingMode === 'Annotation') {
@@ -1475,14 +1677,20 @@ export default {
1475
1677
  if (this.inDrawing || this.activeDrawMode) {
1476
1678
  this.annotationSubmitted = false
1477
1679
  this.annotationEntry.featureId = data.feature.feature.id
1478
- let featureGeometry = centroid(data.feature.feature.geometry)
1479
- this.displayTooltip(data.feature.feature.id, featureGeometry)
1680
+ this.displayTooltip(
1681
+ data.feature.feature.id,
1682
+ centroid(data.feature.feature.geometry)
1683
+ )
1480
1684
  } else {
1481
- // Not allowed to update feature if edit mode not on
1685
+ // Not allowed to update feature if not on edit mode
1482
1686
  if (data.feature.type === 'updated') {
1483
1687
  this.rollbackAnnotationEvent()
1484
1688
  }
1485
1689
  }
1690
+ // Hide dialog when updated or deleted event is fired and tooltip is displayed
1691
+ if (data.feature.type === 'updated' || data.feature.type === 'deleted') {
1692
+ this.initialiseDialog()
1693
+ }
1486
1694
  }
1487
1695
  } else {
1488
1696
  this.annotation = {}
@@ -1503,6 +1711,9 @@ export default {
1503
1711
  }
1504
1712
  }
1505
1713
  },
1714
+ /**
1715
+ * A hack to remove flatmap tooltips while popup is open
1716
+ */
1506
1717
  popUpCssHacks: function () {
1507
1718
  // Below is a hack to remove flatmap tooltips while popup is open
1508
1719
  let ftooltip = document.querySelector('.flatmap-tooltip-popup')
@@ -1518,18 +1729,34 @@ export default {
1518
1729
  let cbutton = document.querySelector('.maplibregl-popup-close-button')
1519
1730
  if (cbutton) cbutton.click()
1520
1731
  },
1732
+ /**
1733
+ * @vuese
1734
+ * Function to close tooltip.
1735
+ */
1521
1736
  closeTooltip: function () {
1522
1737
  this.$refs.tooltip.$el.style.display = 'none'
1523
1738
  document.querySelectorAll('.maplibregl-popup').forEach((item) => {
1524
1739
  item.style.display = 'none'
1525
1740
  })
1526
1741
  },
1742
+ /**
1743
+ * @vuese
1744
+ * Function to create tooltip from Neuron Curation ``data``.
1745
+ * @arg data
1746
+ */
1527
1747
  createTooltipFromNeuronCuration: async function (data) {
1528
1748
  this.tooltipEntry = await this.flatmapQueries.createTooltipData(data)
1529
1749
  this.displayTooltip(data.resource[0])
1530
1750
  },
1531
- // Keeping this as an API
1751
+ /**
1752
+ * @vuese
1753
+ * Function to show popup on map.
1754
+ * @arg featureId,
1755
+ * @arg node,
1756
+ * @arg options
1757
+ */
1532
1758
  showPopup: function (featureId, node, options) {
1759
+ // Keeping this as an API
1533
1760
  let myOptions = options
1534
1761
  if (this.mapImp) {
1535
1762
  if (myOptions) {
@@ -1540,11 +1767,22 @@ export default {
1540
1767
  this.mapImp.showPopup(featureId, node, myOptions)
1541
1768
  }
1542
1769
  },
1770
+ /**
1771
+ * @vuese
1772
+ * Function to show marker popup.
1773
+ * @arg featureId,
1774
+ * @arg node,
1775
+ * @arg options
1776
+ */
1543
1777
  showMarkerPopup: function (featureId, node, options) {
1544
1778
  if (this.mapImp) {
1545
1779
  this.mapImp.showMarkerPopup(featureId, node, options)
1546
1780
  }
1547
1781
  },
1782
+ /**
1783
+ * @vuese
1784
+ * Function to close minimap.
1785
+ */
1548
1786
  closeMinimap: function () {
1549
1787
  let minimapEl = this.$refs.flatmapContainer.querySelector(
1550
1788
  '.maplibregl-ctrl-minimap'
@@ -1559,6 +1797,9 @@ export default {
1559
1797
  }
1560
1798
  this.minimapSmall = !this.minimapSmall
1561
1799
  },
1800
+ /**
1801
+ * Function to add resize button to minimap.
1802
+ */
1562
1803
  addResizeButtonToMinimap: function () {
1563
1804
  let minimapEl = this.$refs.flatmapContainer.querySelector(
1564
1805
  '.maplibregl-ctrl-minimap'
@@ -1573,6 +1814,12 @@ export default {
1573
1814
  this.minimapResizeShow = true
1574
1815
  }
1575
1816
  },
1817
+ /**
1818
+ * @vuese
1819
+ * Function to set help mode
1820
+ * by providing flag ``helpMode`` (true/false).
1821
+ * @arg helpMode
1822
+ */
1576
1823
  setHelpMode: function (helpMode) {
1577
1824
  if (helpMode) {
1578
1825
  this.inHelp = true
@@ -1588,6 +1835,12 @@ export default {
1588
1835
  this.closeFlatmapHelpPopup()
1589
1836
  }
1590
1837
  },
1838
+ /**
1839
+ * @vuese
1840
+ * Function to show tooltip
1841
+ * by providing ``tooltipNumber``.
1842
+ * @arg tooltipNumber
1843
+ */
1591
1844
  showToolitip: function (tooltipNumber) {
1592
1845
  if (!this.inHelp) {
1593
1846
  clearTimeout(this.tooltipWait[tooltipNumber])
@@ -1596,6 +1849,12 @@ export default {
1596
1849
  }, 500)
1597
1850
  }
1598
1851
  },
1852
+ /**
1853
+ * @vuese
1854
+ * Function to hide tooltip
1855
+ * by providing ``tooltipNumber``.
1856
+ * @arg tooltipNumber
1857
+ */
1599
1858
  hideToolitip: function (tooltipNumber) {
1600
1859
  if (!this.inHelp) {
1601
1860
  clearTimeout(this.tooltipWait[tooltipNumber])
@@ -1604,6 +1863,12 @@ export default {
1604
1863
  }, 500)
1605
1864
  }
1606
1865
  },
1866
+ /**
1867
+ * @vuese
1868
+ * Function to display tooltip
1869
+ * by providing featureId (``feature``).
1870
+ * @arg feature
1871
+ */
1607
1872
  displayTooltip: function (feature, geometry = undefined) {
1608
1873
  this.tooltipDisplay = true
1609
1874
  let featureId = undefined
@@ -1618,10 +1883,16 @@ export default {
1618
1883
  }
1619
1884
  }
1620
1885
  if (!this.disableUI) {
1621
- this.mapImp.showPopup(featureId, this.$refs.tooltip.$el, options)
1886
+ this.$nextTick(() => {
1887
+ this.mapImp.showPopup(featureId, this.$refs.tooltip.$el, options)
1888
+ this.popUpCssHacks()
1889
+ })
1622
1890
  }
1623
- this.popUpCssHacks()
1624
1891
  },
1892
+ /**
1893
+ * @vuese
1894
+ * Function to open Flatmap Help Popup.
1895
+ */
1625
1896
  openFlatmapHelpPopup: function () {
1626
1897
  if (this.mapImp) {
1627
1898
  let heartId = this.mapImp.modelFeatureIds('UBERON:0000948')
@@ -1634,6 +1905,10 @@ export default {
1634
1905
  }
1635
1906
  }
1636
1907
  },
1908
+ /**
1909
+ * @vuese
1910
+ * Function to close Flatmap Help Popup.
1911
+ */
1637
1912
  closeFlatmapHelpPopup: function () {
1638
1913
  this.$el
1639
1914
  .querySelectorAll('.maplibregl-popup-close-button')
@@ -1641,6 +1916,10 @@ export default {
1641
1916
  item.click()
1642
1917
  })
1643
1918
  },
1919
+ /**
1920
+ * @vuese
1921
+ * Function to get annotation labels.
1922
+ */
1644
1923
  getLabels: function () {
1645
1924
  let labels = []
1646
1925
  if (this.mapImp) {
@@ -1651,6 +1930,10 @@ export default {
1651
1930
  return Array.from(new Set(labels))
1652
1931
  }
1653
1932
  },
1933
+ /**
1934
+ * @vuese
1935
+ * Function to get the state (object) of the map.
1936
+ */
1654
1937
  getState: function () {
1655
1938
  if (this.mapImp) {
1656
1939
  let state = {
@@ -1666,6 +1949,11 @@ export default {
1666
1949
  }
1667
1950
  return undefined
1668
1951
  },
1952
+ /**
1953
+ * @vuese
1954
+ * Function to set state (object) for the map.
1955
+ * @arg state
1956
+ */
1669
1957
  setState: function (state) {
1670
1958
  if (state) {
1671
1959
  if (
@@ -1683,12 +1971,40 @@ export default {
1683
1971
  this.setStateRequired = false
1684
1972
  }
1685
1973
  },
1974
+ /**
1975
+ * @vuese
1976
+ * Function to restore map's state
1977
+ * from the ``state`` provided.
1978
+ * @arg state
1979
+ */
1686
1980
  restoreMapState: function (state) {
1687
1981
  if (state) {
1688
1982
  if (state.viewport) this.mapImp.setState(state.viewport)
1689
1983
  if (state.searchTerm) this.searchAndShowResult(state.searchTerm, true)
1690
1984
  }
1691
1985
  },
1986
+ /**
1987
+ * @vuese
1988
+ * Function to show flight path option
1989
+ * (3D option)
1990
+ * based on the map version (currently 1.6 and above).
1991
+ * @arg mapVersion
1992
+ */
1993
+ setFlightPathInfo: function (mapVersion) {
1994
+ const mapVersionForFlightPath = 1.6
1995
+ if (mapVersion === mapVersionForFlightPath || mapVersion > mapVersionForFlightPath) {
1996
+ // Show flight path option UI
1997
+ this.displayFlightPathOption = true
1998
+ // Show 3D as default on FC type
1999
+ this.setFlightPath3D(true)
2000
+ }
2001
+ },
2002
+ /**
2003
+ * @vuese
2004
+ * Function to create Flatmap
2005
+ * by providing the ``state``.
2006
+ * @arg state
2007
+ */
1692
2008
  createFlatmap: function (state) {
1693
2009
  if (!this.mapImp && !this.loading) {
1694
2010
  this.loading = true
@@ -1746,11 +2062,7 @@ export default {
1746
2062
  //fullscreenControl: false,
1747
2063
  //annotatable: false,
1748
2064
  //debug: true,
1749
- featureInfo: this.featureInfo,
1750
- 'min-zoom': this.minZoom,
1751
- layerControl: true,
1752
- pathControls: true,
1753
- searchable: this.searchable,
2065
+ minZoom: this.minZoom,
1754
2066
  tooltips: this.tooltips,
1755
2067
  minimap: minimap,
1756
2068
  }
@@ -1758,6 +2070,8 @@ export default {
1758
2070
  promise1.then((returnedObject) => {
1759
2071
  this.mapImp = returnedObject
1760
2072
  this.serverUUID = this.mapImp.getIdentifier().uuid
2073
+ let mapVersion = this.mapImp.details.version
2074
+ this.setFlightPathInfo(mapVersion)
1761
2075
  this.onFlatmapReady()
1762
2076
  if (this._stateToBeSet) this.restoreMapState(this._stateToBeSet)
1763
2077
  else {
@@ -1773,6 +2087,10 @@ export default {
1773
2087
  this.restoreMapState(this._stateToBeSet)
1774
2088
  }
1775
2089
  },
2090
+ /**
2091
+ * @vuese
2092
+ * Function to compute path controls maximum height.
2093
+ */
1776
2094
  computePathControlsMaximumHeight() {
1777
2095
  const elem = this.$refs.display
1778
2096
  if (elem) {
@@ -1783,6 +2101,10 @@ export default {
1783
2101
  this.pathwaysMaxHeight = height - 170
1784
2102
  }
1785
2103
  },
2104
+ /**
2105
+ * @vuese
2106
+ * Function to resize the map.
2107
+ */
1786
2108
  mapResize: function () {
1787
2109
  try {
1788
2110
  this.computePathControlsMaximumHeight()
@@ -1797,6 +2119,10 @@ export default {
1797
2119
  console.error('Map resize error')
1798
2120
  }
1799
2121
  },
2122
+ /**
2123
+ * @vuese
2124
+ * This function is used for functions that need to run immediately after the flatmap is loaded.
2125
+ */
1800
2126
  onFlatmapReady: function () {
1801
2127
  // onFlatmapReady is used for functions that need to run immediately after the flatmap is loaded
1802
2128
  this.sensor = new ResizeSensor(this.$refs.display, this.mapResize)
@@ -1816,17 +2142,36 @@ export default {
1816
2142
  this.computePathControlsMaximumHeight()
1817
2143
  this.drawerOpen = true
1818
2144
  this.mapResize()
2145
+ /**
2146
+ * This is ``onFlatmapReady`` event.
2147
+ * @arg ``this`` (Component Vue Instance)
2148
+ */
1819
2149
  this.$emit('ready', this)
1820
2150
  },
2151
+ /**
2152
+ * @vuese
2153
+ * Function to show or hide the minimap
2154
+ * by providing ``flag`` (boolean) value.
2155
+ * @arg flag
2156
+ */
1821
2157
  showMinimap: function (flag) {
1822
2158
  if (this.mapImp) this.mapImp.showMinimap(flag)
1823
2159
  },
2160
+ /**
2161
+ * @vuese
2162
+ * Function to show or hide the pathways drawer
2163
+ * by providing ``flag`` (boolean) value.
2164
+ * @arg flag
2165
+ */
1824
2166
  showPathwaysDrawer: function (flag) {
1825
2167
  this.drawerOpen = flag
1826
2168
  },
1827
2169
  /**
2170
+ * @vuese
1828
2171
  * Function to display features with annotation matching the provided term,
1829
2172
  * with the option to display the label using displayLabel flag.
2173
+ * @arg term,
2174
+ * @arg displayLabel
1830
2175
  */
1831
2176
  searchAndShowResult: function (term, displayLabel) {
1832
2177
  if (this.mapImp) {
@@ -1866,7 +2211,10 @@ export default {
1866
2211
  return false
1867
2212
  },
1868
2213
  /**
1869
- * Get the list of suggested terms
2214
+ * @vuese
2215
+ * Function to show search suggestions
2216
+ * from the ``term`` provided.
2217
+ * @arg term
1870
2218
  */
1871
2219
  searchSuggestions: function (term) {
1872
2220
  if (this.mapImp) return this.mapImp.search(term)
@@ -1874,48 +2222,66 @@ export default {
1874
2222
  },
1875
2223
  },
1876
2224
  props: {
1877
- entry: String,
2225
+ /**
2226
+ * The taxon identifier of the species represented by the map.
2227
+ */
2228
+ entry: {
2229
+ type: String,
2230
+ required: true,
2231
+ },
2232
+ /**
2233
+ * The unique ``uuid`` of the flatmap.
2234
+ * If given then this exact map will be loaded,
2235
+ * overriding ``taxon`` and ``biologicalSex``.
2236
+ */
1878
2237
  uuid: String,
2238
+ /**
2239
+ * The biological sex of the species represented by the map.
2240
+ * This is specified as metadata in the map's source file.
2241
+ */
1879
2242
  biologicalSex: {
1880
2243
  type: String,
1881
2244
  default: '',
1882
2245
  },
1883
- featureInfo: {
1884
- type: Boolean,
1885
- default: false,
1886
- },
2246
+ /**
2247
+ * The minimum zoom level of the map.
2248
+ */
1887
2249
  minZoom: {
1888
2250
  type: Number,
1889
2251
  default: 4,
1890
2252
  },
1891
- pathControls: {
1892
- type: Boolean,
1893
- default: false,
1894
- },
1895
- searchable: {
1896
- type: Boolean,
1897
- default: false,
1898
- },
1899
- layerControl: {
1900
- type: Boolean,
1901
- default: false,
1902
- },
2253
+ /**
2254
+ * The option to add another feature label _(`FeatureSmallSymbolLayer`)_
2255
+ * when this `tooltips` is set to `false`.
2256
+ */
1903
2257
  tooltips: {
1904
2258
  type: Boolean,
1905
2259
  default: true,
1906
2260
  },
2261
+ /**
2262
+ * The option to show tooltips for help mode.
2263
+ */
1907
2264
  helpMode: {
1908
2265
  type: Boolean,
1909
2266
  default: false,
1910
2267
  },
2268
+ /**
2269
+ * The option to create map on component mounted.
2270
+ */
1911
2271
  renderAtMounted: {
1912
2272
  type: Boolean,
1913
2273
  default: true,
1914
2274
  },
2275
+ /**
2276
+ * The option to display minimap at the top-right corner of the map.
2277
+ */
1915
2278
  displayMinimap: {
1916
2279
  type: Boolean,
1917
2280
  default: false,
1918
2281
  },
2282
+ /**
2283
+ * The option to show warning. Example for legacy or beta maps.
2284
+ */
1919
2285
  displayWarning: {
1920
2286
  type: Boolean,
1921
2287
  default: false,
@@ -1928,8 +2294,28 @@ export default {
1928
2294
  type: Boolean,
1929
2295
  default: false,
1930
2296
  },
2297
+ /**
2298
+ * The data to show different map options.
2299
+ * Available at the bottom-left corner ("Open new map" tooltip).
2300
+ */
1931
2301
  openMapOptions: {
1932
2302
  type: Array,
2303
+ /**
2304
+ * ```[
2305
+ {
2306
+ display: 'Open AC Map',
2307
+ key: 'AC',
2308
+ },
2309
+ {
2310
+ display: 'Open FC Map',
2311
+ key: 'FC',
2312
+ },
2313
+ {
2314
+ display: 'Open 3D Human Map',
2315
+ key: '3D',
2316
+ },
2317
+ ]```
2318
+ */
1933
2319
  default: function () {
1934
2320
  return [
1935
2321
  {
@@ -1947,14 +2333,24 @@ export default {
1947
2333
  ]
1948
2334
  },
1949
2335
  },
2336
+ /**
2337
+ * The option to show star in legend area.
2338
+ */
1950
2339
  showStarInLegend: {
1951
2340
  type: Boolean,
1952
2341
  default: false,
1953
2342
  },
2343
+ /**
2344
+ * Flag to determine whether this is legacy map or not.
2345
+ * ``displayWarning`` should be shown for legacy map.
2346
+ */
1954
2347
  isLegacy: {
1955
2348
  type: Boolean,
1956
2349
  default: false,
1957
2350
  },
2351
+ /**
2352
+ * The option to show the latest changes.
2353
+ */
1958
2354
  displayLatestChanges: {
1959
2355
  type: Boolean,
1960
2356
  default: false,
@@ -1973,10 +2369,17 @@ export default {
1973
2369
  type: String,
1974
2370
  default: 'https://mapcore-demo.org/current/flatmap/v3/',
1975
2371
  },
2372
+ /**
2373
+ * Specify the endpoint of the SPARC API.
2374
+ */
1976
2375
  sparcAPI: {
1977
2376
  type: String,
1978
2377
  default: 'https://api.sparc.science/',
1979
2378
  },
2379
+ userApiKey: {
2380
+ type: String,
2381
+ default: undefined,
2382
+ },
1980
2383
  /**
1981
2384
  * Flag to disable UIs on Map
1982
2385
  */
@@ -1989,6 +2392,7 @@ export default {
1989
2392
  return {
1990
2393
  flatmapAPI: this.flatmapAPI,
1991
2394
  sparcAPI: this.sparcAPI,
2395
+ userApiKey: this.userApiKey,
1992
2396
  $annotator: this.annotator
1993
2397
  }
1994
2398
  },
@@ -2046,7 +2450,8 @@ export default {
2046
2450
  tooltipEntry: createUnfilledTooltipData(),
2047
2451
  connectivityTooltipVisible: false,
2048
2452
  drawerOpen: false,
2049
- dimensionRadio: false,
2453
+ flightPath3DRadio: false,
2454
+ displayFlightPathOption: false,
2050
2455
  colourRadio: true,
2051
2456
  outlinesRadio: true,
2052
2457
  minimapResizeShow: false,
@@ -2056,10 +2461,10 @@ export default {
2056
2461
  currentHover: '',
2057
2462
  viewingMode: 'Exploration',
2058
2463
  viewingModes: ['Annotation', 'Exploration', 'Network Discovery'],
2059
- drawingType: 'All',
2060
- drawingTypes: ['All', 'Point', 'LineString', 'Polygon', 'None'],
2061
- participationType: 'All',
2062
- participationTypes: ['All', 'Participated', 'Not participated'],
2464
+ drawnType: 'All tools',
2465
+ drawnTypes: ['All tools', 'Point', 'LineString', 'Polygon', 'None'],
2466
+ annotatedType: 'Everyone',
2467
+ annotatedTypes: ['Everyone', 'Me', 'Others'],
2063
2468
  openMapRef: undefined,
2064
2469
  backgroundIconRef: undefined,
2065
2470
  annotator: undefined,
@@ -2071,14 +2476,20 @@ export default {
2071
2476
  inDrawing: false,
2072
2477
  relevanceDisplay: false,
2073
2478
  relevanceEntry: {},
2074
- drawnAnnotationFeatures: undefined, // Store all exist drawn annotations
2479
+ drawnAnnotationFeatures: undefined, // Store all exist drawn features
2075
2480
  doubleClickedFeature: false,
2076
2481
  activeDrawMode: undefined,
2077
2482
  drawModes: ['Delete', 'Edit'],
2483
+ dialogPosition: {
2484
+ offsetX: 0,
2485
+ offsetY: 0,
2486
+ x: undefined,
2487
+ y: undefined
2488
+ }
2078
2489
  }
2079
2490
  },
2080
2491
  computed: {
2081
- hasRelevance: function () {
2492
+ relevance: function () {
2082
2493
  return Object.keys(this.relevanceEntry).length > 0
2083
2494
  }
2084
2495
  },
@@ -2086,25 +2497,81 @@ export default {
2086
2497
  entry: function () {
2087
2498
  if (!this.state) this.createFlatmap()
2088
2499
  },
2089
- helpMode: function (val) {
2090
- this.setHelpMode(val)
2500
+ helpMode: function (newVal, oldVal) {
2501
+ if (newVal !== oldVal) {
2502
+ this.setHelpMode(val)
2503
+ }
2091
2504
  },
2092
2505
  state: {
2093
- handler: function (state) {
2094
- if (this.mapManager) {
2095
- this.setState(state)
2096
- } else {
2097
- //this component has not been mounted yet
2098
- this.setStateRequired = true
2506
+ handler: function (state, oldVal) {
2507
+ if (state !== oldVal) {
2508
+ if (this.mapManager) {
2509
+ this.setState(state)
2510
+ } else {
2511
+ //this component has not been mounted yet
2512
+ this.setStateRequired = true
2513
+ }
2099
2514
  }
2100
2515
  },
2101
2516
  immediate: true,
2102
2517
  deep: true,
2103
2518
  },
2519
+ activeDrawTool: function () {
2520
+ this.drawIconCssHacks()
2521
+ },
2522
+ activeDrawMode: function () {
2523
+ this.drawIconCssHacks()
2524
+ },
2525
+ /**
2526
+ * hide dialog when relevanceEntry is empty
2527
+ */
2528
+ relevance: function (value) {
2529
+ const relevanceIcon = this.$el.querySelector('.drawRelevance')
2530
+ if (!value) {
2531
+ this.relevanceDisplay = false
2532
+ relevanceIcon.classList.add('inactive')
2533
+ } else {
2534
+ relevanceIcon.classList.remove('inactive')
2535
+ }
2536
+ },
2537
+ /**
2538
+ * popup dialog via click icon
2539
+ */
2540
+ relevanceDisplay: function (display) {
2541
+ const relevanceIcon = this.$el.querySelector('.drawRelevance')
2542
+ if (display) {
2543
+ relevanceIcon.classList.add('iconSelected')
2544
+ this.dialogCssHacks()
2545
+ } else {
2546
+ relevanceIcon.classList.remove('iconSelected')
2547
+ }
2548
+ this.drawIconCssHacks()
2549
+ },
2550
+ /**
2551
+ * Set dialog offset when flatmap annotator used
2552
+ */
2553
+ dialogPosition: {
2554
+ handler: function () {
2555
+ const containerRect = this.$el.getBoundingClientRect()
2556
+ this.dialogPosition.offsetX = containerRect.x
2557
+ this.dialogPosition.offsetY = containerRect.y
2558
+ },
2559
+ deep: true,
2560
+ once: true,
2561
+ },
2104
2562
  viewingMode: function (mode) {
2105
2563
  if (mode === 'Annotation') {
2564
+ this.$el.querySelector('.maplibregl-canvas').addEventListener('click', (e) => {
2565
+ e.preventDefault();
2566
+ this.dialogPosition.x = e.clientX
2567
+ this.dialogPosition.y = e.clientY
2568
+ // use to fix the draw point pop up position issue
2569
+ if (this.activeDrawTool === 'Point') {
2570
+ this.dialogCssHacks()
2571
+ }
2572
+ }, false)
2106
2573
  this.showAnnotator(true)
2107
- this.annotator.authenticate().then((userData) => {
2574
+ this.annotator.authenticate(this.userApiKey).then((userData) => {
2108
2575
  if (userData.name && userData.email) {
2109
2576
  this.userInformation = userData
2110
2577
  this.setFeatureAnnotated()
@@ -2120,8 +2587,12 @@ export default {
2120
2587
  this.closeTooltip()
2121
2588
  }
2122
2589
  }
2590
+ },
2591
+ created: function () {
2592
+
2123
2593
  },
2124
2594
  mounted: function () {
2595
+
2125
2596
  this.openMapRef = shallowRef(this.$refs.openMapRef)
2126
2597
  this.backgroundIconRef = shallowRef(this.$refs.backgroundIconRef)
2127
2598
  this.tooltipWait = []
@@ -2227,6 +2698,8 @@ export default {
2227
2698
  transition: all 1s ease;
2228
2699
  &.open {
2229
2700
  opacity: 1;
2701
+ position: relative;
2702
+ z-index: 2;
2230
2703
  }
2231
2704
  &.close {
2232
2705
  opacity: 0;
@@ -2269,6 +2742,7 @@ export default {
2269
2742
  }
2270
2743
 
2271
2744
  :deep(.maplibregl-popup) {
2745
+ z-index: 10;
2272
2746
  max-width: 300px !important;
2273
2747
  }
2274
2748
 
@@ -2383,15 +2857,21 @@ export default {
2383
2857
  }
2384
2858
  }
2385
2859
 
2386
- .drawPoint, .drawLineString, .drawPolygon, .drawTrash,
2387
- .connection, .comment, .zoomIn, .zoomOut, .fitWindow {
2388
- padding-left: 8px;
2860
+ .drawPoint, .drawLineString, .drawPolygon,
2861
+ .drawDelete, .drawEdit, .drawRelevance,
2862
+ .zoomIn, .zoomOut, .fitWindow {
2863
+ padding: 4px;
2389
2864
  }
2390
2865
 
2391
- .toolSelected {
2866
+ .iconSelected {
2392
2867
  color: var(--el-color-primary-light-5) !important;
2393
2868
  }
2394
2869
 
2870
+ .inactive {
2871
+ color: #DDDDDD !important;
2872
+ cursor: not-allowed !important;
2873
+ }
2874
+
2395
2875
  .yellow-star-legend {
2396
2876
  width: 130px;
2397
2877
  cursor: pointer;
@@ -2423,6 +2903,10 @@ export default {
2423
2903
  }
2424
2904
  }
2425
2905
 
2906
+ :deep(.background-popper.el-popover.el-popper.h-auto) {
2907
+ height: auto !important;
2908
+ }
2909
+
2426
2910
  :deep(.open-map-popper.el-popover.el-popper) {
2427
2911
  padding-top: 5px;
2428
2912
  padding-bottom: 5px;
@@ -2598,8 +3082,13 @@ export default {
2598
3082
  }
2599
3083
 
2600
3084
  .bottom-draw-control {
3085
+ background-color: var(--el-color-primary-light-9);
3086
+ padding: 4px 4px 2px 4px;
3087
+ border-style: solid;
3088
+ border-color: var(--el-color-primary-light-5);
3089
+ border-radius: 1rem;
2601
3090
  position: absolute;
2602
- right: 40%;
3091
+ right: calc(50vw - 100px);;
2603
3092
  bottom: 16px;
2604
3093
  }
2605
3094
 
@@ -2793,34 +3282,10 @@ export default {
2793
3282
  }
2794
3283
  }
2795
3284
 
2796
- :deep(.el-dialog) {
2797
- text-align: justify;
2798
- border-radius: 4px;
2799
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
2800
- pointer-events: auto;
2801
- background: #fff;
2802
- border: 1px solid $app-primary-color;
2803
- display: flex;
2804
- flex-direction: column;
3285
+ .relevance-dialog {
2805
3286
  position: absolute;
2806
- left: 100px;
2807
- bottom: 0px;
2808
- }
2809
-
2810
- :deep(.el-dialog__body, .el-dialog__header) {
2811
- padding-top: 10px;
2812
- padding-bottom: 10px;
2813
- }
2814
-
2815
- .dialog-title {
2816
- font-size: 18px;
2817
- font-weight: bold;
2818
- color: rgb(131, 0, 191);
2819
- }
2820
-
2821
- :deep(.el-card) {
2822
- --el-card-padding: 12px;
2823
- border: 0;
3287
+ z-index: 10;
3288
+ cursor: move;
2824
3289
  }
2825
3290
  </style>
2826
3291