@abi-software/flatmapvuer 1.17.1-demo.0 → 1.18.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.
@@ -7,9 +7,7 @@
7
7
  element-loading-background="rgba(0, 0, 0, 0.3)"
8
8
  >
9
9
  <map-svg-sprite-color />
10
- <div
11
- style="height: 100%; width: 100%; position: relative; overflow-y: none"
12
- >
10
+ <div style="height: 100%; width: 100%; position: relative; overflow-y: none">
13
11
  <!-- flatmap-display -->
14
12
  <div style="height: 100%; width: 100%" ref="display" class="flatmap-display"></div>
15
13
  <!-- flatmap-error -->
@@ -25,67 +23,41 @@
25
23
  :visible="hoverVisibilities[7].value"
26
24
  ref="warningPopover"
27
25
  >
28
- <!--
26
+ <!--
29
27
  What magic meaning do the numbers 6, 7, etc have?
30
28
 
31
29
  Please use `const` to assign meaningful names to them...
32
30
  -->
33
- <p
34
- v-if="isLegacy"
35
- @mouseover="showTooltip(7)"
36
- @mouseout="hideTooltip(7)"
37
- >
31
+ <p v-if="isLegacy" @mouseover="showTooltip(7)" @mouseout="hideTooltip(7)">
38
32
  This is a legacy map, you may view the latest map instead.
39
33
  </p>
40
- <p
41
- v-else-if="isFC"
42
- @mouseover="showTooltip(7)"
43
- @mouseout="hideTooltip(7)"
44
- >
45
- This map displays the connectivity of individual neurons.
46
- Specifically, those which align with (parts of) the neuron
47
- populations from the
48
- <a
49
- href="https://sparc.science/resources/1ZUKXU2YmLcn2reCyXjlew"
50
- target="_blank"
51
- >
34
+ <p v-else-if="isFC" @mouseover="showTooltip(7)" @mouseout="hideTooltip(7)">
35
+ This map displays the connectivity of individual neurons. Specifically, those which
36
+ align with (parts of) the neuron populations from the
37
+ <a href="https://sparc.science/resources/1ZUKXU2YmLcn2reCyXjlew" target="_blank">
52
38
  ApiNATOMY
53
39
  </a>
54
40
  models available in
55
- <a
56
- href="https://sparc.science/resources/6eg3VpJbwQR4B84CjrvmyD"
57
- target="_blank"
58
- >
59
- SCKAN </a
60
- >.
41
+ <a href="https://sparc.science/resources/6eg3VpJbwQR4B84CjrvmyD" target="_blank">
42
+ SCKAN
43
+ </a>
44
+ .
61
45
  </p>
62
- <p v-else
63
- @mouseover="showTooltip(7)"
64
- @mouseout="hideTooltip(7)"
65
- >
66
- This map displays the connectivity of neuron populations.
67
- Specifically, those from the primarily rat-based
68
- <a
69
- href="https://sparc.science/resources/1ZUKXU2YmLcn2reCyXjlew"
70
- target="_blank"
71
- >
46
+ <p v-else @mouseover="showTooltip(7)" @mouseout="hideTooltip(7)">
47
+ This map displays the connectivity of neuron populations. Specifically, those from the
48
+ primarily rat-based
49
+ <a href="https://sparc.science/resources/1ZUKXU2YmLcn2reCyXjlew" target="_blank">
72
50
  ApiNATOMY
73
51
  </a>
74
52
  models available in
75
- <a
76
- href="https://sparc.science/resources/6eg3VpJbwQR4B84CjrvmyD"
77
- target="_blank"
78
- >
79
- SCKAN </a
80
- >. New connectivity and species specificity will be added as the
81
- SPARC program progresses.
53
+ <a href="https://sparc.science/resources/6eg3VpJbwQR4B84CjrvmyD" target="_blank">
54
+ SCKAN
55
+ </a>
56
+ . New connectivity and species specificity will be added as the SPARC program
57
+ progresses.
82
58
  </p>
83
59
  <template #reference>
84
- <div
85
- class="warning-icon"
86
- @mouseover="showTooltip(7)"
87
- @mouseout="hideTooltip(7)"
88
- >
60
+ <div class="warning-icon" @mouseover="showTooltip(7)" @mouseout="hideTooltip(7)">
89
61
  <el-icon v-if="displayWarning || isLegacy"><el-icon-warning-filled /></el-icon>
90
62
  <template v-if="isLegacy">
91
63
  <span class="warning-text">Legacy Map</span>
@@ -122,14 +94,10 @@ Please use `const` to assign meaningful names to them...
122
94
  </template>
123
95
  <template #default>
124
96
  <b>Connectivity References</b>
125
- <p>
126
- Connectivity references have been improved and available
127
- in various formats.
128
- </p>
97
+ <p>Connectivity references have been improved and available in various formats.</p>
129
98
  <b>Improved state storing</b>
130
99
  <p>
131
- Current selection and visibility filters are now stored
132
- when creating a permalink.
100
+ Current selection and visibility filters are now stored when creating a permalink.
133
101
  </p>
134
102
  </template>
135
103
  </el-popover>
@@ -147,7 +115,9 @@ Please use `const` to assign meaningful names to them...
147
115
  </el-icon>
148
116
 
149
117
  <DrawToolbar
150
- v-if="viewingMode === 'Annotation' && (authorisedUser || offlineAnnotationEnabled) && !disableUI"
118
+ v-if="
119
+ viewingMode === 'Annotation' && (authorisedUser || offlineAnnotationEnabled) && !disableUI
120
+ "
151
121
  :mapCanvas="{
152
122
  containerHTML: this.$el,
153
123
  class: '.maplibregl-canvas',
@@ -185,10 +155,7 @@ Please use `const` to assign meaningful names to them...
185
155
  @mouseover="showTooltip(1)"
186
156
  @mouseout="hideTooltip(1)"
187
157
  >
188
- <map-svg-icon
189
- class="icon-button zoomIn"
190
- icon="zoomIn"
191
- />
158
+ <map-svg-icon class="icon-button zoomIn" icon="zoomIn" />
192
159
  </div>
193
160
  </template>
194
161
  </el-popover>
@@ -209,10 +176,7 @@ Please use `const` to assign meaningful names to them...
209
176
  @mouseover="showTooltip(2)"
210
177
  @mouseout="hideTooltip(2)"
211
178
  >
212
- <map-svg-icon
213
- class="icon-button zoomOut"
214
- icon="zoomOut"
215
- />
179
+ <map-svg-icon class="icon-button zoomOut" icon="zoomOut" />
216
180
  </div>
217
181
  </template>
218
182
  </el-popover>
@@ -238,10 +202,7 @@ Please use `const` to assign meaningful names to them...
238
202
  @mouseover="showTooltip(3)"
239
203
  @mouseout="hideTooltip(3)"
240
204
  >
241
- <map-svg-icon
242
- class="icon-button fitWindow"
243
- icon="fitWindow"
244
- />
205
+ <map-svg-icon class="icon-button fitWindow" icon="fitWindow" />
245
206
  </div>
246
207
  </template>
247
208
  </el-popover>
@@ -408,9 +369,7 @@ Please use `const` to assign meaningful names to them...
408
369
  @event open-map
409
370
  @arg {String} `mapOption.key`
410
371
  -->
411
- <el-button type="primary" plain
412
- @click="$emit('open-map', item.key)"
413
- >
372
+ <el-button type="primary" plain @click="$emit('open-map', item.key)">
414
373
  {{ item.display }}
415
374
  </el-button>
416
375
  </el-row>
@@ -428,23 +387,27 @@ Please use `const` to assign meaningful names to them...
428
387
  <div>
429
388
  <el-row class="backgroundText">Viewing Mode</el-row>
430
389
  <el-row class="backgroundControl">
431
- <div style="margin-bottom: 2px;">
432
- <template
433
- v-for="(value, key, index) in viewingModes"
434
- :key="key"
435
- >
436
- <template v-if="key === viewingMode">
437
- <span class="viewing-mode-title"><b >{{ key }}</b></span>
438
- </template>
439
- <template v-else>
440
- <span class="viewing-mode-unselected" @click="changeViewingMode(key)">{{ key }}</span>
441
- </template>
390
+ <div style="margin-bottom: 2px">
391
+ <template v-for="(value, key) in viewingModes" :key="key">
392
+ <template v-if="key === viewingMode">
393
+ <span class="viewing-mode-title">
394
+ <b>{{ key }}</b>
395
+ </span>
396
+ </template>
397
+ <template v-else>
398
+ <span class="viewing-mode-unselected" @click="changeViewingMode(key)">
399
+ {{ key }}
400
+ </span>
401
+ </template>
442
402
  </template>
443
403
  </div>
444
404
  <el-row class="viewing-mode-description">
445
405
  {{ modeDescription }}
446
406
  </el-row>
447
- <el-row v-if="viewingMode === 'Annotation' && offlineAnnotationEnabled" class="viewing-mode-description">
407
+ <el-row
408
+ v-if="viewingMode === 'Annotation' && offlineAnnotationEnabled"
409
+ class="viewing-mode-description"
410
+ >
448
411
  (Anonymous annotate)
449
412
  </el-row>
450
413
  </el-row>
@@ -459,12 +422,7 @@ Please use `const` to assign meaningful names to them...
459
422
  popper-class="flatmap_dropdown"
460
423
  @change="setAnnotationFrom"
461
424
  >
462
- <el-option
463
- v-for="item in annotatedSource"
464
- :key="item"
465
- :label="item"
466
- :value="item"
467
- >
425
+ <el-option v-for="item in annotatedSource" :key="item" :label="item" :value="item">
468
426
  <el-row>
469
427
  <el-col :span="12">{{ item }}</el-col>
470
428
  </el-row>
@@ -480,18 +438,14 @@ Please use `const` to assign meaningful names to them...
480
438
  class="flatmap-radio"
481
439
  @change="setFlightPath3D"
482
440
  >
483
- <el-radio :value="false">2D</el-radio>
484
- <el-radio :value="true">3D</el-radio>
441
+ <el-radio :value="false">2D</el-radio>
442
+ <el-radio :value="true">3D</el-radio>
485
443
  </el-radio-group>
486
444
  </el-row>
487
445
  <el-row class="backgroundSpacer"></el-row>
488
446
  <el-row class="backgroundText">Organs display</el-row>
489
447
  <el-row class="backgroundControl">
490
- <el-radio-group
491
- v-model="colourRadio"
492
- class="flatmap-radio"
493
- @change="setColour"
494
- >
448
+ <el-radio-group v-model="colourRadio" class="flatmap-radio" @change="setColour">
495
449
  <el-radio :value="true">Colour</el-radio>
496
450
  <el-radio :value="false">Greyscale</el-radio>
497
451
  </el-radio-group>
@@ -499,11 +453,7 @@ Please use `const` to assign meaningful names to them...
499
453
  <el-row class="backgroundSpacer"></el-row>
500
454
  <el-row class="backgroundText">Outlines display</el-row>
501
455
  <el-row class="backgroundControl">
502
- <el-radio-group
503
- v-model="outlinesRadio"
504
- class="flatmap-radio"
505
- @change="setOutlines"
506
- >
456
+ <el-radio-group v-model="outlinesRadio" class="flatmap-radio" @change="setOutlines">
507
457
  <el-radio :value="true">Show</el-radio>
508
458
  <el-radio :value="false">Hide</el-radio>
509
459
  </el-radio-group>
@@ -514,11 +464,7 @@ Please use `const` to assign meaningful names to them...
514
464
  <div
515
465
  v-for="item in availableBackground"
516
466
  :key="item"
517
- :class="[
518
- 'backgroundChoice',
519
- item,
520
- item == currentBackground ? 'active' : '',
521
- ]"
467
+ :class="['backgroundChoice', item, item == currentBackground ? 'active' : '']"
522
468
  @click="backgroundChangeCallback(item)"
523
469
  />
524
470
  </el-row>
@@ -546,10 +492,7 @@ Please use `const` to assign meaningful names to them...
546
492
  @mouseover="showTooltip(4)"
547
493
  @mouseout="hideTooltip(4)"
548
494
  >
549
- <map-svg-icon
550
- icon="openMap"
551
- class="icon-button open-map-button"
552
- />
495
+ <map-svg-icon icon="openMap" class="icon-button open-map-button" />
553
496
  </div>
554
497
  </template>
555
498
  </el-popover>
@@ -571,10 +514,7 @@ Please use `const` to assign meaningful names to them...
571
514
  @mouseover="showTooltip(5)"
572
515
  @mouseout="hideTooltip(5)"
573
516
  >
574
- <map-svg-icon
575
- icon="changeBckgd"
576
- class="icon-button"
577
- />
517
+ <map-svg-icon icon="changeBckgd" class="icon-button" />
578
518
  </div>
579
519
  </template>
580
520
  </el-popover>
@@ -595,113 +535,92 @@ Please use `const` to assign meaningful names to them...
595
535
  </template>
596
536
 
597
537
  <script>
598
- /* eslint-disable no-alert, no-console */
599
- import { inject, provide, shallowRef, markRaw } from 'vue'
538
+ import { inject, provide, shallowRef, markRaw } from 'vue';
600
539
  import {
601
540
  WarningFilled as ElIconWarningFilled,
602
541
  ArrowDown as ElIconArrowDown,
603
542
  ArrowLeft as ElIconArrowLeft,
604
- } from '@element-plus/icons-vue'
605
- import SelectionsGroup from './SelectionsGroup.vue'
606
- import { MapSvgIcon, MapSvgSpriteColor } from '@abi-software/svg-sprite'
607
- import '@abi-software/svg-sprite/dist/style.css'
608
- import SvgLegends from './legends/SvgLegends.vue'
609
- import DynamicLegends from './legends/DynamicLegends.vue'
610
- import {
611
- ElButton as Button,
612
- ElCol as Col,
613
- ElLoading as Loading,
614
- ElRadio as Radio,
615
- ElRadioGroup as RadioGroup,
616
- ElRow as Row,
617
- ElSelect as Select,
618
- ElDialog as Dialog,
619
- ElIcon as Icon,
620
- } from 'element-plus'
621
- import flatmapMarker from '../icons/flatmap-marker'
622
- import {
623
- FlatmapQueries,
624
- findTaxonomyLabels,
625
- } from '../services/flatmapQueries.js'
543
+ } from '@element-plus/icons-vue';
544
+ import SelectionsGroup from './SelectionsGroup.vue';
545
+ import { MapSvgIcon, MapSvgSpriteColor } from '@abi-software/svg-sprite';
546
+ import '@abi-software/svg-sprite/dist/style.css';
547
+ import flatmapMarker from '../icons/flatmap-marker';
548
+ import { FlatmapQueries, findTaxonomyLabels } from '../services/flatmapQueries.js';
626
549
  import {
627
550
  getReferenceConnectivitiesFromStorage,
628
551
  loadAndStoreKnowledge,
629
552
  refreshFlatmapKnowledgeCache,
630
553
  getKnowledgeSource,
631
554
  getReferenceConnectivitiesByAPI,
632
- } from '../services/flatmapKnowledge.js'
633
- import { capitalise, normaliseAlertToStringArray } from './utilities.js'
634
- import yellowstar from '../icons/yellowstar'
635
- import ResizeSensor from 'css-element-queries/src/ResizeSensor'
636
- import flatmap from '../services/flatmapLoader.js'
637
- import { attachSomaLocationMarkerMethods } from '../services/somaLocationMarkers.js'
638
- import { AnnotationService } from '@abi-software/sparc-annotation'
639
- import { mapState } from 'pinia'
640
- import { useMainStore } from '@/store/index'
555
+ } from '../services/flatmapKnowledge.js';
556
+ import { capitalise, normaliseAlertToStringArray } from './utilities.js';
557
+ import yellowstar from '../icons/yellowstar';
558
+ import ResizeSensor from 'css-element-queries/src/ResizeSensor';
559
+ import flatmap from '../services/flatmapLoader.js';
560
+ import { AnnotationService } from '@abi-software/sparc-annotation';
561
+ import { mapState } from 'pinia';
562
+ import { useMainStore } from '@/store/index';
641
563
  import {
642
564
  fetchLabels,
643
565
  DrawToolbar,
644
566
  Tooltip,
645
567
  TreeControls,
646
- getFlatmapFilterOptions
647
- } from '@abi-software/map-utilities'
648
- import '@abi-software/map-utilities/dist/style.css'
649
- import EventBus from './EventBus.js'
650
- import FlatmapError from './FlatmapError.vue'
568
+ getFlatmapFilterOptions,
569
+ } from '@abi-software/map-utilities';
570
+ import '@abi-software/map-utilities/dist/style.css';
571
+ import EventBus from './EventBus.js';
572
+ import FlatmapError from './FlatmapError.vue';
651
573
 
652
574
  const ERROR_MESSAGE = 'cannot be found on the map.';
653
575
 
654
576
  const centroid = (geometry) => {
655
- let featureGeometry = { lng: 0, lat: 0, }
656
- let coordinates
657
- if (geometry.type === "Polygon") {
577
+ let featureGeometry = { lng: 0, lat: 0 };
578
+ let coordinates;
579
+ if (geometry.type === 'Polygon') {
658
580
  if (geometry.coordinates.length) {
659
- coordinates = geometry.coordinates[0]
581
+ coordinates = geometry.coordinates[0];
660
582
  }
661
583
  } else {
662
- coordinates = geometry.coordinates
584
+ coordinates = geometry.coordinates;
663
585
  }
664
586
  if (coordinates) {
665
587
  if (!(geometry.type === 'Point')) {
666
588
  coordinates.map((coor) => {
667
- featureGeometry.lng += parseFloat(coor[0])
668
- featureGeometry.lat += parseFloat(coor[1])
669
- })
670
- featureGeometry.lng = featureGeometry.lng / coordinates.length
671
- featureGeometry.lat = featureGeometry.lat / coordinates.length
589
+ featureGeometry.lng += parseFloat(coor[0]);
590
+ featureGeometry.lat += parseFloat(coor[1]);
591
+ });
592
+ featureGeometry.lng = featureGeometry.lng / coordinates.length;
593
+ featureGeometry.lat = featureGeometry.lat / coordinates.length;
672
594
  } else {
673
- featureGeometry.lng += parseFloat(coordinates[0])
674
- featureGeometry.lat += parseFloat(coordinates[1])
595
+ featureGeometry.lng += parseFloat(coordinates[0]);
596
+ featureGeometry.lat += parseFloat(coordinates[1]);
675
597
  }
676
598
  }
677
- return featureGeometry
678
- }
599
+ return featureGeometry;
600
+ };
679
601
 
680
602
  const processFTUs = (parent, key) => {
681
- const ftus = []
682
- let items = parent.organs ? parent.organs : parent.ftus
603
+ const ftus = [];
604
+ let items = parent.organs ? parent.organs : parent.ftus;
683
605
  const children = items
684
- ? items.filter(
685
- (obj, index) =>
686
- items.findIndex((item) => item.label === obj.label) === index
687
- )
688
- : undefined
606
+ ? items.filter((obj, index) => items.findIndex((item) => item.label === obj.label) === index)
607
+ : undefined;
689
608
  if (children) {
690
609
  children.forEach((child) => {
691
610
  const data = {
692
611
  label: child.label,
693
612
  models: child.models,
694
613
  key: `${key}.${child.label}`,
695
- }
696
- const grandChildren = processFTUs(child, data.key)
614
+ };
615
+ const grandChildren = processFTUs(child, data.key);
697
616
  if (grandChildren.length > 0) {
698
- data.children = grandChildren
617
+ data.children = grandChildren;
699
618
  }
700
- ftus.push(data)
701
- })
619
+ ftus.push(data);
620
+ });
702
621
  }
703
- return ftus
704
- }
622
+ return ftus;
623
+ };
705
624
 
706
625
  /**
707
626
  * A vue component of the flatmap viewer.
@@ -709,21 +628,11 @@ const processFTUs = (parent, key) => {
709
628
  export default {
710
629
  name: 'FlatmapVuer',
711
630
  components: {
712
- Button,
713
- Col,
714
- Loading,
715
- Radio,
716
- Icon,
717
- RadioGroup,
718
- Row,
719
- Select,
720
- Dialog,
721
631
  MapSvgIcon,
722
632
  MapSvgSpriteColor,
723
633
  Tooltip,
724
634
  TreeControls,
725
635
  SelectionsGroup,
726
- SvgLegends,
727
636
  ElIconWarningFilled,
728
637
  ElIconArrowDown,
729
638
  ElIconArrowLeft,
@@ -734,20 +643,20 @@ export default {
734
643
  //The state watcher may triggered before
735
644
  //created causing issue, This flag will
736
645
  //resolve this issue.
737
- this.setStateRequired = false
646
+ this.setStateRequired = false;
738
647
  },
739
648
  setup(props) {
740
- let annotator = inject('$annotator')
649
+ let annotator = inject('$annotator');
741
650
  if (!annotator) {
742
651
  annotator = markRaw(new AnnotationService(`${props.flatmapAPI}annotator`));
743
- provide('$annotator', annotator)
652
+ provide('$annotator', annotator);
744
653
  }
745
- return { annotator }
654
+ return { annotator };
746
655
  },
747
656
  methods: {
748
657
  enableFeatureResetOnClick: function (enable) {
749
658
  if (this.mapImp) {
750
- this.mapImp.enableFeatureResetOnClick(enable)
659
+ this.mapImp.enableFeatureResetOnClick(enable);
751
660
  }
752
661
  },
753
662
  /**
@@ -783,20 +692,20 @@ export default {
783
692
  * Function to manually send aborted signal when annotation tooltip popup or sidebar tab closed.
784
693
  */
785
694
  manualAbortedOnClose: function () {
786
- if (this.annotationSidebar) this.$emit("annotation-close")
787
- this.closeTooltip()
788
- this.annotationEventCallback({}, { type: 'aborted' })
789
- this.initialiseDrawing()
695
+ if (this.annotationSidebar) this.$emit('annotation-close');
696
+ this.closeTooltip();
697
+ this.annotationEventCallback({}, { type: 'aborted' });
698
+ this.initialiseDrawing();
790
699
  },
791
700
  /**
792
701
  * @public
793
702
  * Function to initialise drawing.
794
703
  */
795
704
  initialiseDrawing: function () {
796
- this.connectionEntry = {}
797
- this.activeDrawTool = undefined
798
- this.activeDrawMode = undefined
799
- this.drawnCreatedEvent = {}
705
+ this.connectionEntry = {};
706
+ this.activeDrawTool = undefined;
707
+ this.activeDrawMode = undefined;
708
+ this.drawnCreatedEvent = {};
800
709
  },
801
710
  /**
802
711
  * @public
@@ -804,14 +713,16 @@ export default {
804
713
  */
805
714
  cancelDrawnFeature: function () {
806
715
  if (this.isValidDrawnCreated) {
807
- if (this.annotationSidebar) this.$emit("annotation-close")
808
- this.closeTooltip()
809
- this.annotationEntry = [{
810
- ...this.drawnCreatedEvent.feature,
811
- resourceId: this.serverURL,
812
- }]
813
- this.rollbackAnnotationEvent()
814
- this.initialiseDrawing()
716
+ if (this.annotationSidebar) this.$emit('annotation-close');
717
+ this.closeTooltip();
718
+ this.annotationEntry = [
719
+ {
720
+ ...this.drawnCreatedEvent.feature,
721
+ resourceId: this.serverURL,
722
+ },
723
+ ];
724
+ this.rollbackAnnotationEvent();
725
+ this.initialiseDrawing();
815
726
  }
816
727
  },
817
728
  /**
@@ -822,14 +733,14 @@ export default {
822
733
  connectedFeatureTooltip: function (value) {
823
734
  if (this.mapImp) {
824
735
  if (value) {
825
- const numericId = Number(value)
736
+ const numericId = Number(value);
826
737
  const featureObject = numericId
827
738
  ? this.mapImp.featureProperties(numericId)
828
- : { feature: this.existDrawnFeatures.find(feature => feature.id === value.trim()) };
829
- let payload = { feature: featureObject }
830
- this.checkAndCreatePopups([payload], false)
739
+ : { feature: this.existDrawnFeatures.find((feature) => feature.id === value.trim()) };
740
+ let payload = { feature: featureObject };
741
+ this.checkAndCreatePopups([payload], false);
831
742
  } else {
832
- this.closeTooltip()
743
+ this.closeTooltip();
833
744
  }
834
745
  }
835
746
  },
@@ -839,14 +750,14 @@ export default {
839
750
  */
840
751
  confirmDrawnFeature: function () {
841
752
  if (this.isValidDrawnCreated) {
842
- this.checkAndCreatePopups([this.drawnCreatedEvent], false)
753
+ this.checkAndCreatePopups([this.drawnCreatedEvent], false);
843
754
  // Add connection if exist to annotationEntry
844
755
  // Connection will only be added in creating new drawn feature annotation
845
756
  // And will not be updated if move drawn features
846
757
  if (Object.keys(this.connectionEntry).length > 0) {
847
- this.annotationEntry[0].feature.connection = this.connectionEntry
758
+ this.annotationEntry[0].feature.connection = this.connectionEntry;
848
759
  }
849
- this.initialiseDrawing()
760
+ this.initialiseDrawing();
850
761
  }
851
762
  },
852
763
  /**
@@ -857,20 +768,20 @@ export default {
857
768
  */
858
769
  toolbarEvent: function (type, name) {
859
770
  if (this.isValidDrawnCreated) return;
860
- this.manualAbortedOnClose()
861
- this.doubleClickedFeature = false
771
+ this.manualAbortedOnClose();
772
+ this.doubleClickedFeature = false;
862
773
  // Deselect any feature when draw mode/tool is changed
863
- this.changeAnnotationDrawMode({ mode: 'simple_select' })
774
+ this.changeAnnotationDrawMode({ mode: 'simple_select' });
864
775
  if (type === 'mode') {
865
- this.activeDrawMode = name
776
+ this.activeDrawMode = name;
866
777
  } else if (type === 'tool') {
867
778
  // Remove any unsubmitted drawn
868
- this.cancelDrawnFeature()
779
+ this.cancelDrawnFeature();
869
780
  if (name) {
870
- const tool = name.replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`)
871
- this.changeAnnotationDrawMode({ mode: `draw${tool}` })
781
+ const tool = name.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
782
+ this.changeAnnotationDrawMode({ mode: `draw${tool}` });
872
783
  }
873
- this.activeDrawTool = name
784
+ this.activeDrawTool = name;
874
785
  }
875
786
  },
876
787
  /**
@@ -885,18 +796,18 @@ export default {
885
796
  if (data.feature.feature.geometry.type !== 'Point') {
886
797
  this.changeAnnotationDrawMode({
887
798
  mode: 'direct_select',
888
- options: { featureId: data.feature.feature.id }
889
- })
890
- this.modifyAnnotationFeature()
799
+ options: { featureId: data.feature.feature.id },
800
+ });
801
+ this.modifyAnnotationFeature();
891
802
  }
892
- this.doubleClickedFeature = false
803
+ this.doubleClickedFeature = false;
893
804
  }
894
805
  } else if (this.activeDrawMode === 'Delete') {
895
806
  this.changeAnnotationDrawMode({
896
807
  mode: 'simple_select',
897
- options: { featureIds: [data.feature.feature.id] }
898
- })
899
- this.modifyAnnotationFeature()
808
+ options: { featureIds: [data.feature.feature.id] },
809
+ });
810
+ this.modifyAnnotationFeature();
900
811
  }
901
812
  },
902
813
  /**
@@ -904,14 +815,16 @@ export default {
904
815
  */
905
816
  createConnectivityBody: function () {
906
817
  if (Object.keys(this.connectionEntry).length > 0) {
907
- const features = Object.values(this.connectionEntry)
818
+ const features = Object.values(this.connectionEntry);
908
819
  const body = {
909
820
  type: 'connectivity',
910
821
  source: features[0],
911
822
  target: features[features.length - 1],
912
- intermediates: features.filter((f, index) => index !== 0 && index !== features.length - 1),
913
- }
914
- this.annotationEntry[0].body = body
823
+ intermediates: features.filter(
824
+ (f, index) => index !== 0 && index !== features.length - 1,
825
+ ),
826
+ };
827
+ this.annotationEntry[0].body = body;
915
828
  }
916
829
  },
917
830
  /**
@@ -921,7 +834,7 @@ export default {
921
834
  */
922
835
  changeAnnotationDrawMode: function (mode) {
923
836
  if (this.mapImp) {
924
- this.mapImp.changeAnnotationDrawMode(mode)
837
+ this.mapImp.changeAnnotationDrawMode(mode);
925
838
  }
926
839
  },
927
840
  /**
@@ -930,18 +843,18 @@ export default {
930
843
  */
931
844
  clearAnnotationFeature: function () {
932
845
  if (this.mapImp) {
933
- this.mapImp.clearAnnotationFeature()
846
+ this.mapImp.clearAnnotationFeature();
934
847
  }
935
848
  },
936
- forceContextLoss: function() {
849
+ forceContextLoss: function () {
937
850
  if (this.mapImp && !this.mapImp.contextLost && !this.loading) {
938
- this.mapImp.forceContextLoss()
851
+ this.mapImp.forceContextLoss();
939
852
  }
940
853
  },
941
- forceContextRestore: function() {
854
+ forceContextRestore: function () {
942
855
  if (this.mapImp) {
943
- this.flatmapError = null
944
- this.mapImp.forceContextRestore()
856
+ this.flatmapError = null;
857
+ this.mapImp.forceContextRestore();
945
858
  }
946
859
  },
947
860
  /**
@@ -954,7 +867,7 @@ export default {
954
867
  // Fire the 'trash' button
955
868
  // Not only use to remove features
956
869
  // 'simple_select' for DELETE and 'direct_select' for EDIT
957
- this.mapImp.removeAnnotationFeature()
870
+ this.mapImp.removeAnnotationFeature();
958
871
  }
959
872
  },
960
873
  /**
@@ -968,8 +881,8 @@ export default {
968
881
  this.annotationEntry.length > 0 &&
969
882
  ['created', 'updated', 'deleted'].includes(this.annotationEntry[0].type)
970
883
  ) {
971
- this.mapImp.rollbackAnnotationEvent(this.annotationEntry[0])
972
- this.annotationEntry = []
884
+ this.mapImp.rollbackAnnotationEvent(this.annotationEntry[0]);
885
+ this.annotationEntry = [];
973
886
  }
974
887
  },
975
888
  /**
@@ -980,27 +893,28 @@ export default {
980
893
  commitAnnotationEvent: function (annotation) {
981
894
  if (this.mapImp) {
982
895
  if (this.offlineAnnotationEnabled) {
983
- this.offlineAnnotations = JSON.parse(sessionStorage.getItem('anonymous-annotation')) || []
984
- this.offlineAnnotations.push(annotation)
896
+ this.offlineAnnotations =
897
+ JSON.parse(sessionStorage.getItem('anonymous-annotation')) || [];
898
+ this.offlineAnnotations.push(annotation);
985
899
  if (this.annotationEntry[0].type === 'deleted') {
986
900
  this.offlineAnnotations = this.offlineAnnotations.filter((offline) => {
987
- return offline.resource !== this.serverURL || offline.item.id !== annotation.item.id
988
- })
901
+ return offline.resource !== this.serverURL || offline.item.id !== annotation.item.id;
902
+ });
989
903
  }
990
- sessionStorage.setItem('anonymous-annotation', JSON.stringify(this.offlineAnnotations))
904
+ sessionStorage.setItem('anonymous-annotation', JSON.stringify(this.offlineAnnotations));
991
905
  }
992
906
  if (['created', 'updated', 'deleted'].includes(this.annotationEntry[0].type)) {
993
- this.featureAnnotationSubmitted = true
994
- this.mapImp.commitAnnotationEvent(this.annotationEntry[0])
995
- if (annotation.body.comment === "Position Updated") {
996
- this.annotationEntry[0].positionUpdated = false
907
+ this.featureAnnotationSubmitted = true;
908
+ this.mapImp.commitAnnotationEvent(this.annotationEntry[0]);
909
+ if (annotation.body.comment === 'Position Updated') {
910
+ this.annotationEntry[0].positionUpdated = false;
997
911
  } else if (this.annotationEntry[0].type === 'deleted') {
998
- if (this.annotationSidebar) this.$emit("annotation-close")
999
- this.closeTooltip()
912
+ if (this.annotationSidebar) this.$emit('annotation-close');
913
+ this.closeTooltip();
1000
914
  // Only delete need, keep the annotation tooltip/sidebar open if created/updated
1001
- this.annotationEntry = []
915
+ this.annotationEntry = [];
1002
916
  }
1003
- this.addAnnotationFeature()
917
+ this.addAnnotationFeature();
1004
918
  }
1005
919
  }
1006
920
  },
@@ -1011,18 +925,25 @@ export default {
1011
925
  * @arg {String} `participated`
1012
926
  */
1013
927
  fetchAnnotatedItemIds: async function (userId = undefined, participated = undefined) {
1014
- let annotatedItemIds
928
+ let annotatedItemIds;
1015
929
  if (this.offlineAnnotationEnabled) {
1016
- this.offlineAnnotations = JSON.parse(sessionStorage.getItem('anonymous-annotation')) || []
1017
- annotatedItemIds = this.offlineAnnotations.filter((offline) => {
1018
- return offline.resource === this.serverURL
1019
- }).map(offline => offline.item.id)
930
+ this.offlineAnnotations = JSON.parse(sessionStorage.getItem('anonymous-annotation')) || [];
931
+ annotatedItemIds = this.offlineAnnotations
932
+ .filter((offline) => {
933
+ return offline.resource === this.serverURL;
934
+ })
935
+ .map((offline) => offline.item.id);
1020
936
  } else {
1021
- annotatedItemIds = await this.annotator.annotatedItemIds(this.userToken, this.serverURL, userId, participated)
937
+ annotatedItemIds = await this.annotator.annotatedItemIds(
938
+ this.userToken,
939
+ this.serverURL,
940
+ userId,
941
+ participated,
942
+ );
1022
943
  // The annotator has `resource` and `items` fields
1023
- if ('resource' in annotatedItemIds) annotatedItemIds = annotatedItemIds.itemIds
944
+ if ('resource' in annotatedItemIds) annotatedItemIds = annotatedItemIds.itemIds;
1024
945
  }
1025
- return annotatedItemIds
946
+ return annotatedItemIds;
1026
947
  },
1027
948
  /**
1028
949
  * @public
@@ -1030,9 +951,9 @@ export default {
1030
951
  */
1031
952
  setFeatureAnnotated: async function () {
1032
953
  if (this.mapImp) {
1033
- const annotatedItemIds = await this.fetchAnnotatedItemIds()
954
+ const annotatedItemIds = await this.fetchAnnotatedItemIds();
1034
955
  for (const id of annotatedItemIds) {
1035
- this.mapImp.setFeatureAnnotated(id)
956
+ this.mapImp.setFeatureAnnotated(id);
1036
957
  }
1037
958
  }
1038
959
  },
@@ -1043,19 +964,25 @@ export default {
1043
964
  * @arg {String} `participated`
1044
965
  */
1045
966
  fetchDrawnFeatures: async function (userId, participated) {
1046
- let drawnFeatures
967
+ let drawnFeatures;
1047
968
  if (this.offlineAnnotationEnabled) {
1048
- this.offlineAnnotations = JSON.parse(sessionStorage.getItem('anonymous-annotation')) || []
1049
- drawnFeatures = this.offlineAnnotations.filter((offline) => {
1050
- return offline.feature && offline.resource === this.serverURL
1051
- }).map(offline => offline.feature)
969
+ this.offlineAnnotations = JSON.parse(sessionStorage.getItem('anonymous-annotation')) || [];
970
+ drawnFeatures = this.offlineAnnotations
971
+ .filter((offline) => {
972
+ return offline.feature && offline.resource === this.serverURL;
973
+ })
974
+ .map((offline) => offline.feature);
1052
975
  } else {
1053
- const annotatedItemIds = await this.fetchAnnotatedItemIds(userId, participated)
1054
- drawnFeatures = await this.annotator.drawnFeatures(this.userToken, this.serverURL, annotatedItemIds)
976
+ const annotatedItemIds = await this.fetchAnnotatedItemIds(userId, participated);
977
+ drawnFeatures = await this.annotator.drawnFeatures(
978
+ this.userToken,
979
+ this.serverURL,
980
+ annotatedItemIds,
981
+ );
1055
982
  // The annotator has `resource` and `features` fields
1056
- if ('resource' in drawnFeatures) drawnFeatures = drawnFeatures.features
983
+ if ('resource' in drawnFeatures) drawnFeatures = drawnFeatures.features;
1057
984
  }
1058
- return drawnFeatures
985
+ return drawnFeatures;
1059
986
  },
1060
987
  /**
1061
988
  * @public
@@ -1064,21 +991,27 @@ export default {
1064
991
  addAnnotationFeature: async function () {
1065
992
  if (this.mapImp) {
1066
993
  if (!this.featureAnnotationSubmitted) {
1067
- this.clearAnnotationFeature()
1068
- this.loading = true
994
+ this.clearAnnotationFeature();
995
+ this.loading = true;
1069
996
  }
1070
- const userId = this.annotationFrom === 'Anyone' ?
1071
- undefined : this.authorisedUser.orcid ?
1072
- this.authorisedUser.orcid : '0000-0000-0000-0000'
1073
- const participated = this.annotationFrom === 'Anyone' ?
1074
- undefined : this.annotationFrom === 'Me' ?
1075
- true : false
1076
- const drawnFeatures = await this.fetchDrawnFeatures(userId, participated)
1077
- this.existDrawnFeatures = drawnFeatures
1078
- this.loading = false
997
+ const userId =
998
+ this.annotationFrom === 'Anyone'
999
+ ? undefined
1000
+ : this.authorisedUser.orcid
1001
+ ? this.authorisedUser.orcid
1002
+ : '0000-0000-0000-0000';
1003
+ const participated =
1004
+ this.annotationFrom === 'Anyone'
1005
+ ? undefined
1006
+ : this.annotationFrom === 'Me'
1007
+ ? true
1008
+ : false;
1009
+ const drawnFeatures = await this.fetchDrawnFeatures(userId, participated);
1010
+ this.existDrawnFeatures = drawnFeatures;
1011
+ this.loading = false;
1079
1012
  if (!this.featureAnnotationSubmitted) {
1080
1013
  for (const feature of drawnFeatures) {
1081
- this.mapImp.addAnnotationFeature(feature)
1014
+ this.mapImp.addAnnotationFeature(feature);
1082
1015
  }
1083
1016
  }
1084
1017
  }
@@ -1091,9 +1024,9 @@ export default {
1091
1024
  showAnnotator: function (flag) {
1092
1025
  if (this.mapImp) {
1093
1026
  // Control the show/hide of the drawn annotations
1094
- this.mapImp.showAnnotator(flag)
1027
+ this.mapImp.showAnnotator(flag);
1095
1028
  // Hide default toolbar, we will use customised SVG icons instead
1096
- this.$el.querySelector('.maplibregl-ctrl-group').style.display = 'none'
1029
+ this.$el.querySelector('.maplibregl-ctrl-group').style.display = 'none';
1097
1030
  }
1098
1031
  },
1099
1032
  /**
@@ -1102,10 +1035,10 @@ export default {
1102
1035
  * @arg {Boolean} `flag`
1103
1036
  */
1104
1037
  setAnnotationFrom: function (flag) {
1105
- this.annotationFrom = flag
1038
+ this.annotationFrom = flag;
1106
1039
  if (this.mapImp) {
1107
- this.manualAbortedOnClose()
1108
- this.addAnnotationFeature()
1040
+ this.manualAbortedOnClose();
1041
+ this.addAnnotationFeature();
1109
1042
  }
1110
1043
  },
1111
1044
  /**
@@ -1120,9 +1053,9 @@ export default {
1120
1053
  * @arg {Boolean} `flag`
1121
1054
  */
1122
1055
  setFlightPath3D: function (flag) {
1123
- this.flightPath3DRadio = flag
1056
+ this.flightPath3DRadio = flag;
1124
1057
  if (this.mapImp) {
1125
- this.mapImp.enableFlightPaths(flag)
1058
+ this.mapImp.enableFlightPaths(flag);
1126
1059
  }
1127
1060
  },
1128
1061
  /**
@@ -1130,20 +1063,20 @@ export default {
1130
1063
  * Function to view the latest map (example when you are on legacy map).
1131
1064
  */
1132
1065
  viewLatestMap: function () {
1133
- let biologicalSex = this.biologicalSex ? this.biologicalSex : undefined
1066
+ let biologicalSex = this.biologicalSex ? this.biologicalSex : undefined;
1134
1067
  //Human requires special handling
1135
1068
  if (this.entry === 'NCBITaxon:9606') {
1136
- biologicalSex = 'PATO:0000384'
1069
+ biologicalSex = 'PATO:0000384';
1137
1070
  }
1138
1071
  const state = {
1139
1072
  entry: this.entry,
1140
1073
  biologicalSex,
1141
1074
  viewport: this.mapImp.getState(),
1142
- }
1075
+ };
1143
1076
  /**
1144
1077
  * The event emitted by ``viewLatestMap`` method.
1145
1078
  */
1146
- this.$emit('view-latest-map', state)
1079
+ this.$emit('view-latest-map', state);
1147
1080
  },
1148
1081
  /**
1149
1082
  * @public
@@ -1152,9 +1085,9 @@ export default {
1152
1085
  * @arg {String} `colour`
1153
1086
  */
1154
1087
  backgroundChangeCallback: function (colour) {
1155
- this.currentBackground = colour
1088
+ this.currentBackground = colour;
1156
1089
  if (this.mapImp) {
1157
- this.mapImp.setBackgroundColour(this.currentBackground, 1)
1090
+ this.mapImp.setBackgroundColour(this.currentBackground, 1);
1158
1091
  }
1159
1092
  },
1160
1093
  /**
@@ -1163,21 +1096,21 @@ export default {
1163
1096
  * @arg {Array} `systems`
1164
1097
  */
1165
1098
  processSystems: function (systems) {
1166
- this.systems.length = 0
1099
+ this.systems.length = 0;
1167
1100
  if (systems && systems.length > 0) {
1168
- const data = { label: 'All', key: 'All', children: [] }
1101
+ const data = { label: 'All', key: 'All', children: [] };
1169
1102
  systems.forEach((system) => {
1170
1103
  const child = {
1171
1104
  colour: system.colour,
1172
1105
  enabled: system.enabled,
1173
1106
  label: system.id,
1174
1107
  key: system.id,
1175
- }
1176
- const children = processFTUs(system, child.key)
1177
- if (children.length > 0) child.children = children
1178
- data.children.push(child)
1179
- })
1180
- this.systems.push(data)
1108
+ };
1109
+ const children = processFTUs(system, child.key);
1110
+ if (children.length > 0) child.children = children;
1111
+ data.children.push(child);
1112
+ });
1113
+ this.systems.push(data);
1181
1114
  }
1182
1115
  },
1183
1116
  /**
@@ -1188,17 +1121,17 @@ export default {
1188
1121
  * @arg {Array} `taxonIdentifiers`
1189
1122
  */
1190
1123
  processTaxon: function (taxonIdentifiers, state) {
1191
- this.taxonConnectivity.length = 0
1124
+ this.taxonConnectivity.length = 0;
1192
1125
  findTaxonomyLabels(this.mapImp, taxonIdentifiers).then((entityLabels) => {
1193
1126
  if (entityLabels.length) {
1194
1127
  entityLabels.forEach((entityLabel) => {
1195
- let enabled = true
1128
+ let enabled = true;
1196
1129
  if (state) {
1197
- enabled = state.checkAll ? true : state.checked.includes(entityLabel.taxon)
1130
+ enabled = state.checkAll ? true : state.checked.includes(entityLabel.taxon);
1198
1131
  }
1199
- this.taxonConnectivity.push({...entityLabel, enabled});
1132
+ this.taxonConnectivity.push({ ...entityLabel, enabled });
1200
1133
  if (this.mapImp) {
1201
- this.mapImp.enableConnectivityByTaxonIds(entityLabel.taxon, enabled)
1134
+ this.mapImp.enableConnectivityByTaxonIds(entityLabel.taxon, enabled);
1202
1135
  }
1203
1136
  });
1204
1137
  }
@@ -1209,7 +1142,7 @@ export default {
1209
1142
  * Function to show or hide the display of the bottom-left drawer container.
1210
1143
  */
1211
1144
  toggleDrawer: function () {
1212
- this.drawerOpen = !this.drawerOpen
1145
+ this.drawerOpen = !this.drawerOpen;
1213
1146
  },
1214
1147
  /**
1215
1148
  * @public
@@ -1218,9 +1151,9 @@ export default {
1218
1151
  * @arg {Boolean} `flag`
1219
1152
  */
1220
1153
  setColour: function (flag) {
1221
- this.colourRadio = flag
1154
+ this.colourRadio = flag;
1222
1155
  if (this.mapImp) {
1223
- this.mapImp.setPaint({ coloured: flag, outlined: this.outlinesRadio })
1156
+ this.mapImp.setPaint({ coloured: flag, outlined: this.outlinesRadio });
1224
1157
  }
1225
1158
  },
1226
1159
  /**
@@ -1230,9 +1163,9 @@ export default {
1230
1163
  * @arg {Boolean} `flag`
1231
1164
  */
1232
1165
  setOutlines: function (flag) {
1233
- this.outlinesRadio = flag
1166
+ this.outlinesRadio = flag;
1234
1167
  if (this.mapImp) {
1235
- this.mapImp.setPaint({ coloured: this.colourRadio, outlined: flag })
1168
+ this.mapImp.setPaint({ coloured: this.colourRadio, outlined: flag });
1236
1169
  }
1237
1170
  },
1238
1171
  setInitMapState: function () {
@@ -1241,7 +1174,7 @@ export default {
1241
1174
  const bounds = this.mapImp.options.bounds;
1242
1175
  const initBounds = [
1243
1176
  [bounds[0], bounds[1]],
1244
- [bounds[2], bounds[3]]
1177
+ [bounds[2], bounds[3]],
1245
1178
  ];
1246
1179
 
1247
1180
  map.setMaxBounds(null); // override default
@@ -1269,20 +1202,20 @@ export default {
1269
1202
  if (initBounds) {
1270
1203
  // reset zoom and position
1271
1204
  map.fitBounds(initBounds, {
1272
- animate: false
1205
+ animate: false,
1273
1206
  });
1274
1207
  }
1275
1208
  if (this.$refs.skcanSelection) {
1276
- this.$refs.skcanSelection.reset()
1209
+ this.$refs.skcanSelection.reset();
1277
1210
  }
1278
1211
  if (this.$refs.layersSelection) {
1279
- this.$refs.layersSelection.reset()
1212
+ this.$refs.layersSelection.reset();
1280
1213
  }
1281
1214
  if (this.$refs.systemsSelection) {
1282
- this.$refs.pathwaysSelection.reset()
1215
+ this.$refs.pathwaysSelection.reset();
1283
1216
  }
1284
1217
  if (this.$refs.pathwaysSelection) {
1285
- this.$refs.pathwaysSelection.reset()
1218
+ this.$refs.pathwaysSelection.reset();
1286
1219
  }
1287
1220
  }
1288
1221
  },
@@ -1293,7 +1226,7 @@ export default {
1293
1226
  */
1294
1227
  zoomIn: function () {
1295
1228
  if (this.mapImp) {
1296
- this.mapImp.zoomIn()
1229
+ this.mapImp.zoomIn();
1297
1230
  }
1298
1231
  },
1299
1232
  /**
@@ -1303,7 +1236,7 @@ export default {
1303
1236
  */
1304
1237
  zoomOut: function () {
1305
1238
  if (this.mapImp) {
1306
- this.mapImp.zoomOut()
1239
+ this.mapImp.zoomOut();
1307
1240
  }
1308
1241
  },
1309
1242
  onSelectionsDataChanged: function (data) {
@@ -1317,7 +1250,7 @@ export default {
1317
1250
  */
1318
1251
  sckanSelected: function (payload) {
1319
1252
  if (this.mapImp) {
1320
- this.mapImp.enableSckanPath(payload.key, payload.value)
1253
+ this.mapImp.enableSckanPath(payload.key, payload.value);
1321
1254
  }
1322
1255
  },
1323
1256
  /**
@@ -1327,9 +1260,7 @@ export default {
1327
1260
  */
1328
1261
  checkAllSCKAN: function (payload) {
1329
1262
  if (this.mapImp) {
1330
- payload.keys.forEach((key) =>
1331
- this.mapImp.enableSckanPath(key, payload.value)
1332
- )
1263
+ payload.keys.forEach((key) => this.mapImp.enableSckanPath(key, payload.value));
1333
1264
  }
1334
1265
  },
1335
1266
  /**
@@ -1338,7 +1269,7 @@ export default {
1338
1269
  */
1339
1270
  zoomToFeatures: function (data) {
1340
1271
  if (this.mapImp) {
1341
- this.mapImp.zoomToFeatures(data)
1272
+ this.mapImp.zoomToFeatures(data);
1342
1273
  }
1343
1274
  },
1344
1275
  /**
@@ -1357,16 +1288,20 @@ export default {
1357
1288
  const pathsOfEntities = await this.mapImp.queryPathsForFeatures(payload);
1358
1289
  if (nodeFeatureIds.length) {
1359
1290
  if (!connectedTarget.length) {
1360
- const connectedType = options.type?.length ? options.type : ["all"];
1361
- const connectivity = await this.flatmapQueries.queryForConnectivityNew(this.mapImp, payload[0]);
1291
+ const connectedType = options.type?.length ? options.type : ['all'];
1292
+ const connectivity = await this.flatmapQueries.queryForConnectivityNew(
1293
+ this.mapImp,
1294
+ payload[0],
1295
+ );
1362
1296
  const originsFlat = connectivity?.ids?.dendrites.flat(Infinity);
1363
1297
  const componentsFlat = connectivity?.ids?.components.flat(Infinity);
1364
1298
  const destinationsFlat = connectivity?.ids?.axons.flat(Infinity);
1365
1299
  let connected = [];
1366
- if (connectedType.includes("origins")) connected.push(...originsFlat);
1367
- if (connectedType.includes("components")) connected.push(...componentsFlat);
1368
- if (connectedType.includes("destinations")) connected.push(...destinationsFlat);
1369
- if (connectedType.includes("all")) connected.push(...originsFlat, ...componentsFlat, ...destinationsFlat);
1300
+ if (connectedType.includes('origins')) connected.push(...originsFlat);
1301
+ if (connectedType.includes('components')) connected.push(...componentsFlat);
1302
+ if (connectedType.includes('destinations')) connected.push(...destinationsFlat);
1303
+ if (connectedType.includes('all'))
1304
+ connected.push(...originsFlat, ...componentsFlat, ...destinationsFlat);
1370
1305
  connectedTarget = [...new Set(connected)];
1371
1306
  }
1372
1307
  // Loop through the node features and check if we have certain nodes
@@ -1379,7 +1314,9 @@ export default {
1379
1314
  const nodeModelsL2 = nodeFeatureIdsL2.map((featureIdL2) => {
1380
1315
  return this.mapImp.featureProperties(featureIdL2).models;
1381
1316
  });
1382
- const intersection = connectedTarget.filter(element => nodeModelsL2.includes(element));
1317
+ const intersection = connectedTarget.filter((element) =>
1318
+ nodeModelsL2.includes(element),
1319
+ );
1383
1320
  if (intersection.length && !connectedPaths.includes(path)) connectedPaths.push(path);
1384
1321
  });
1385
1322
  });
@@ -1390,7 +1327,9 @@ export default {
1390
1327
  const nodeModels = nodeFeatureIds.map((featureId) => {
1391
1328
  return this.mapImp.featureProperties(featureId).models;
1392
1329
  });
1393
- const intersection = connectedTarget.filter(element => nodeModels.includes(element));
1330
+ const intersection = connectedTarget.filter((element) =>
1331
+ nodeModels.includes(element),
1332
+ );
1394
1333
  if (intersection.length && !connectedPaths.includes(path)) connectedPaths.push(path);
1395
1334
  });
1396
1335
  } else {
@@ -1401,7 +1340,7 @@ export default {
1401
1340
  return connectedPaths;
1402
1341
  }
1403
1342
  },
1404
- resetMapFilter: function() {
1343
+ resetMapFilter: function () {
1405
1344
  const alert = this.mapFilters.alert;
1406
1345
  let filter;
1407
1346
  const isPathways = { 'tile-layer': 'pathways' };
@@ -1410,18 +1349,18 @@ export default {
1410
1349
  if (alert.with && !alert.without) {
1411
1350
  // Show pathways with alert
1412
1351
  filter = {
1413
- OR: [notPathways, { AND: [isPathways, { HAS: 'alert' }] }]
1352
+ OR: [notPathways, { AND: [isPathways, { HAS: 'alert' }] }],
1414
1353
  };
1415
1354
  } else if (!alert.with && alert.without) {
1416
1355
  // Show pathways without alert
1417
1356
  filter = {
1418
- OR: [notPathways, { AND: [isPathways, { NOT: { HAS: 'alert' } }] }]
1357
+ OR: [notPathways, { AND: [isPathways, { NOT: { HAS: 'alert' } }] }],
1419
1358
  };
1420
1359
  } else if (!alert.with && !alert.without) {
1421
1360
  // Hide all pathways
1422
1361
  filter = notPathways;
1423
1362
  }
1424
- this.setVisibilityFilter(filter)
1363
+ this.setVisibilityFilter(filter);
1425
1364
  },
1426
1365
  /**
1427
1366
  * @public
@@ -1436,16 +1375,14 @@ export default {
1436
1375
  const isPathways = { 'tile-layer': 'pathways' };
1437
1376
  const notPathways = { NOT: isPathways };
1438
1377
 
1439
- if (payload.key === "alert" || payload.key === "withoutAlert") {
1440
- const hasAlert = payload.key === "alert" ?
1441
- { HAS: 'alert' } :
1442
- { NOT: { HAS: 'alert' } };
1378
+ if (payload.key === 'alert' || payload.key === 'withoutAlert') {
1379
+ const hasAlert = payload.key === 'alert' ? { HAS: 'alert' } : { NOT: { HAS: 'alert' } };
1443
1380
 
1444
1381
  filter = { OR: [notPathways, { AND: [isPathways, hasAlert] }] };
1445
1382
  }
1446
- this.setVisibilityFilter(filter)
1383
+ this.setVisibilityFilter(filter);
1447
1384
  } else {
1448
- this.resetMapFilter()
1385
+ this.resetMapFilter();
1449
1386
  }
1450
1387
  }
1451
1388
  },
@@ -1457,20 +1394,20 @@ export default {
1457
1394
  */
1458
1395
  alertSelected: function (payload) {
1459
1396
  if (this.mapImp) {
1460
- if (payload.key === "alert") {
1397
+ if (payload.key === 'alert') {
1461
1398
  if (payload.value) {
1462
- this.mapFilters.alert.with = true
1399
+ this.mapFilters.alert.with = true;
1463
1400
  } else {
1464
- this.mapFilters.alert.with = false
1401
+ this.mapFilters.alert.with = false;
1465
1402
  }
1466
- } else if (payload.key === "withoutAlert") {
1403
+ } else if (payload.key === 'withoutAlert') {
1467
1404
  if (payload.value) {
1468
- this.mapFilters.alert.without = true
1405
+ this.mapFilters.alert.without = true;
1469
1406
  } else {
1470
- this.mapFilters.alert.without = false
1407
+ this.mapFilters.alert.without = false;
1471
1408
  }
1472
1409
  }
1473
- this.resetMapFilter()
1410
+ this.resetMapFilter();
1474
1411
  }
1475
1412
  },
1476
1413
  /**
@@ -1482,13 +1419,13 @@ export default {
1482
1419
  checkAllAlerts: function (payload) {
1483
1420
  if (this.mapImp) {
1484
1421
  if (payload.value) {
1485
- this.mapFilters.alert.without = true
1486
- this.mapFilters.alert.with = true
1422
+ this.mapFilters.alert.without = true;
1423
+ this.mapFilters.alert.with = true;
1487
1424
  } else {
1488
- this.mapFilters.alert.without = false
1489
- this.mapFilters.alert.with = false
1425
+ this.mapFilters.alert.without = false;
1426
+ this.mapFilters.alert.with = false;
1490
1427
  }
1491
- this.resetMapFilter()
1428
+ this.resetMapFilter();
1492
1429
  }
1493
1430
  },
1494
1431
  /**
@@ -1499,7 +1436,7 @@ export default {
1499
1436
  */
1500
1437
  systemSelected: function (payload) {
1501
1438
  if (this.mapImp) {
1502
- this.mapImp.enableSystem(payload.key, payload.value)
1439
+ this.mapImp.enableSystem(payload.key, payload.value);
1503
1440
  }
1504
1441
  },
1505
1442
  /**
@@ -1510,9 +1447,7 @@ export default {
1510
1447
  */
1511
1448
  checkAllSystems: function (flag) {
1512
1449
  if (this.mapImp) {
1513
- this.systems[0].children.forEach((key) =>
1514
- this.mapImp.enableSystem(key.label, flag)
1515
- )
1450
+ this.systems[0].children.forEach((key) => this.mapImp.enableSystem(key.label, flag));
1516
1451
  }
1517
1452
  },
1518
1453
  /**
@@ -1521,7 +1456,7 @@ export default {
1521
1456
  * @arg {String} `models`
1522
1457
  */
1523
1458
  ftuSelected: function (models) {
1524
- this.searchAndShowResult(models, true, true)
1459
+ this.searchAndShowResult(models, true, true);
1525
1460
  },
1526
1461
  /**
1527
1462
  * @public
@@ -1531,7 +1466,7 @@ export default {
1531
1466
  */
1532
1467
  layersSelected: function (payload) {
1533
1468
  if (this.mapImp) {
1534
- this.mapImp.enableLayer(payload.key, payload.value)
1469
+ this.mapImp.enableLayer(payload.key, payload.value);
1535
1470
  }
1536
1471
  },
1537
1472
  /**
@@ -1542,9 +1477,7 @@ export default {
1542
1477
  */
1543
1478
  checkAllLayers: function (payload) {
1544
1479
  if (this.mapImp) {
1545
- payload.keys.forEach((key) =>
1546
- this.mapImp.enableLayer(key, payload.value)
1547
- )
1480
+ payload.keys.forEach((key) => this.mapImp.enableLayer(key, payload.value));
1548
1481
  }
1549
1482
  },
1550
1483
  /**
@@ -1555,24 +1488,24 @@ export default {
1555
1488
  */
1556
1489
  taxonsSelected: function (payload) {
1557
1490
  if (this.mapImp) {
1558
- this.mapImp.enableConnectivityByTaxonIds(payload.key, payload.value)
1491
+ this.mapImp.enableConnectivityByTaxonIds(payload.key, payload.value);
1559
1492
  }
1560
1493
  },
1561
1494
  taxonMouseEnterEmitted: function (payload) {
1562
1495
  if (this.mapImp) {
1563
1496
  if (payload.value) {
1564
- clearTimeout(this.taxonLeaveDelay)
1565
- let gid = this.mapImp.taxonFeatureIds(payload.key)
1566
- this.mapImp.enableConnectivityByTaxonIds(payload.key, payload.value) // make sure path is visible
1567
- this.mapImp.zoomToGeoJSONFeatures(gid, {noZoomIn: true})
1497
+ clearTimeout(this.taxonLeaveDelay);
1498
+ let gid = this.mapImp.taxonFeatureIds(payload.key);
1499
+ this.mapImp.enableConnectivityByTaxonIds(payload.key, payload.value); // make sure path is visible
1500
+ this.mapImp.zoomToGeoJSONFeatures(gid, { noZoomIn: true });
1568
1501
  } else {
1569
1502
  this.taxonLeaveDelay = setTimeout(() => {
1570
1503
  // reset visibility of paths
1571
- this.mapImp.unselectGeoJSONFeatures()
1504
+ this.mapImp.unselectGeoJSONFeatures();
1572
1505
  payload.selections.forEach((item) => {
1573
- let show = payload.checked.includes(item.taxon)
1574
- this.mapImp.enableConnectivityByTaxonIds(item.taxon, show)
1575
- })
1506
+ let show = payload.checked.includes(item.taxon);
1507
+ this.mapImp.enableConnectivityByTaxonIds(item.taxon, show);
1508
+ });
1576
1509
  }, 1000);
1577
1510
  }
1578
1511
  }
@@ -1585,7 +1518,7 @@ export default {
1585
1518
  */
1586
1519
  checkAllTaxons: function (payload) {
1587
1520
  if (this.mapImp) {
1588
- this.mapImp.enableConnectivityByTaxonIds(payload.keys, payload.value)
1521
+ this.mapImp.enableConnectivityByTaxonIds(payload.keys, payload.value);
1589
1522
  }
1590
1523
  },
1591
1524
  /**
@@ -1596,7 +1529,7 @@ export default {
1596
1529
  */
1597
1530
  pathwaysSelected: function (payload) {
1598
1531
  if (this.mapImp) {
1599
- this.mapImp.enablePath(payload.key, payload.value)
1532
+ this.mapImp.enablePath(payload.key, payload.value);
1600
1533
  }
1601
1534
  },
1602
1535
  /**
@@ -1607,9 +1540,7 @@ export default {
1607
1540
  */
1608
1541
  checkAllPathways: function (payload) {
1609
1542
  if (this.mapImp) {
1610
- payload.keys.forEach((key) =>
1611
- this.mapImp.enablePath(key, payload.value)
1612
- )
1543
+ payload.keys.forEach((key) => this.mapImp.enablePath(key, payload.value));
1613
1544
  }
1614
1545
  },
1615
1546
  /**
@@ -1619,7 +1550,7 @@ export default {
1619
1550
  * @arg {Boolean} `flag`
1620
1551
  */
1621
1552
  enablePanZoomEvents: function (flag) {
1622
- this.mapImp.enablePanZoomEvents(flag)
1553
+ this.mapImp.enablePanZoomEvents(flag);
1623
1554
  },
1624
1555
  /**
1625
1556
  * @public
@@ -1631,72 +1562,79 @@ export default {
1631
1562
  // Popup closed will trigger aborted event this is used to control the tooltip
1632
1563
  if (data.type === 'aborted') {
1633
1564
  // Rollback drawing when no new annotation submitted
1634
- if (!this.featureAnnotationSubmitted) this.rollbackAnnotationEvent()
1635
- else this.featureAnnotationSubmitted = false
1636
- this.annotationEntry = []
1565
+ if (!this.featureAnnotationSubmitted) this.rollbackAnnotationEvent();
1566
+ else this.featureAnnotationSubmitted = false;
1567
+ this.annotationEntry = [];
1637
1568
  } else if (data.type === 'modeChanged') {
1638
- if (data.feature.mode === 'direct_select') this.doubleClickedFeature = true
1639
- if (this.annotationSidebar && data.feature.mode === 'simple_select' && this.activeDrawMode === 'Deleted') {
1640
- this.annotationEventCallback({}, { type: 'aborted' })
1569
+ if (data.feature.mode === 'direct_select') this.doubleClickedFeature = true;
1570
+ if (
1571
+ this.annotationSidebar &&
1572
+ data.feature.mode === 'simple_select' &&
1573
+ this.activeDrawMode === 'Deleted'
1574
+ ) {
1575
+ this.annotationEventCallback({}, { type: 'aborted' });
1641
1576
  }
1642
1577
  } else if (data.type === 'selectionChanged') {
1643
- this.selectedDrawnFeature = data.feature.features.length === 0 ?
1644
- undefined : data.feature.features[0]
1645
- payload.feature.feature = this.selectedDrawnFeature
1646
- if (!this.activeDrawTool) { // Make sure dialog content doesn't change
1647
- this.connectionEntry = {}
1578
+ this.selectedDrawnFeature =
1579
+ data.feature.features.length === 0 ? undefined : data.feature.features[0];
1580
+ payload.feature.feature = this.selectedDrawnFeature;
1581
+ if (!this.activeDrawTool) {
1582
+ // Make sure dialog content doesn't change
1583
+ this.connectionEntry = {};
1648
1584
  // For exist drawn annotation features
1649
1585
  if (this.selectedDrawnFeature) {
1650
1586
  // The `id` here is GeoJSONId from AnnotatedFeature
1651
1587
  // Ref: flatmap-viewer/src/flatmap-types.ts
1652
1588
  const drawnFeature = this.existDrawnFeatures.find(
1653
- (feature) => feature.id === this.selectedDrawnFeature.id
1654
- )
1589
+ (feature) => feature.id === this.selectedDrawnFeature.id,
1590
+ );
1655
1591
  if (drawnFeature && drawnFeature.connection) {
1656
- this.connectionEntry = drawnFeature.connection
1592
+ this.connectionEntry = drawnFeature.connection;
1657
1593
  }
1658
- this.annotationDrawModeEvent(payload)
1594
+ this.annotationDrawModeEvent(payload);
1659
1595
  } else {
1660
1596
  if (this.annotationSidebar && this.previousEditEvent.type === 'updated') {
1661
- this.annotationEntry = [{
1662
- ...this.previousEditEvent,
1663
- resourceId: this.serverURL
1664
- }]
1665
- this.annotationEventCallback({}, { type: 'aborted' })
1597
+ this.annotationEntry = [
1598
+ {
1599
+ ...this.previousEditEvent,
1600
+ resourceId: this.serverURL,
1601
+ },
1602
+ ];
1603
+ this.annotationEventCallback({}, { type: 'aborted' });
1666
1604
  }
1667
- this.previousEditEvent = {}
1605
+ this.previousEditEvent = {};
1668
1606
  }
1669
1607
  }
1670
1608
  } else {
1671
1609
  if (data.type === 'created' || data.type === 'updated') {
1672
1610
  if (data.type === 'updated' && data.feature.action) {
1673
- data.positionUpdated = data.feature.action === 'move'
1611
+ data.positionUpdated = data.feature.action === 'move';
1674
1612
  }
1675
- const feature = this.mapImp.refreshAnnotationFeatureGeometry(data.feature)
1676
- payload.feature.feature = feature
1613
+ const feature = this.mapImp.refreshAnnotationFeatureGeometry(data.feature);
1614
+ payload.feature.feature = feature;
1677
1615
  // NB. this might now be `null` if user has deleted it (before OK/Submit)
1678
1616
  // so maybe then no `service.addAnnotation` ??
1679
1617
  }
1680
1618
  // Once double click mouse to confirm drawing, 'aborted' event will be triggered.
1681
1619
  // Hence disable direct popup when 'created' event, dialog will be used instead.
1682
- if (data.type === 'created') this.drawnCreatedEvent = payload
1683
- else this.checkAndCreatePopups([payload])
1620
+ if (data.type === 'created') this.drawnCreatedEvent = payload;
1621
+ else this.checkAndCreatePopups([payload]);
1684
1622
  }
1685
- if (data.type === 'updated') this.previousEditEvent = data
1686
- if (data.type === 'deleted') this.previousDeletedEvent = data
1687
- else this.previousDeletedEvent = {}
1623
+ if (data.type === 'updated') this.previousEditEvent = data;
1624
+ if (data.type === 'deleted') this.previousDeletedEvent = data;
1625
+ else this.previousDeletedEvent = {};
1688
1626
  },
1689
1627
  getTaxons: function (data) {
1690
- let taxons = undefined
1628
+ let taxons = undefined;
1691
1629
  if (data.taxons) {
1692
1630
  // check if data.taxons is string or array
1693
1631
  if (typeof data.taxons !== 'object') {
1694
- taxons = JSON.parse(data.taxons)
1632
+ taxons = JSON.parse(data.taxons);
1695
1633
  } else {
1696
- taxons = data.taxons
1634
+ taxons = data.taxons;
1697
1635
  }
1698
1636
  }
1699
- return taxons
1637
+ return taxons;
1700
1638
  },
1701
1639
  /**
1702
1640
  * @public
@@ -1711,33 +1649,35 @@ export default {
1711
1649
  feature: data,
1712
1650
  userData: args,
1713
1651
  eventType: eventType,
1714
- }
1715
- this.annotationEventCallback(payload, data)
1652
+ };
1653
+ this.annotationEventCallback(payload, data);
1716
1654
  } else if (eventType === 'context-lost') {
1717
- this.onContextLost()
1655
+ this.onContextLost();
1718
1656
  } else if (eventType === 'context-restored') {
1719
- this.onContextRestored()
1657
+ this.onContextRestored();
1720
1658
  } else if (eventType === 'pan-zoom') {
1721
- this.$emit('pan-zoom-callback', data)
1659
+ this.$emit('pan-zoom-callback', data);
1722
1660
  } else {
1723
- const label = data.label
1724
- const resource = [data.models]
1725
- const taxonomy = this.entry
1726
- const biologicalSex = this.biologicalSex
1727
- const featuresAlert = normaliseAlertToStringArray(data.alert)
1728
- const taxons = this.getTaxons(data)
1729
- let payload = [{
1730
- dataset: data.dataset,
1731
- biologicalSex: biologicalSex,
1732
- taxonomy: taxonomy,
1733
- resource: resource,
1734
- label: label,
1735
- feature: data,
1736
- userData: args,
1737
- eventType: eventType,
1738
- provenanceTaxonomy: taxons,
1739
- alert: featuresAlert
1740
- }]
1661
+ const label = data.label;
1662
+ const resource = [data.models];
1663
+ const taxonomy = this.entry;
1664
+ const biologicalSex = this.biologicalSex;
1665
+ const featuresAlert = normaliseAlertToStringArray(data.alert);
1666
+ const taxons = this.getTaxons(data);
1667
+ let payload = [
1668
+ {
1669
+ dataset: data.dataset,
1670
+ biologicalSex: biologicalSex,
1671
+ taxonomy: taxonomy,
1672
+ resource: resource,
1673
+ label: label,
1674
+ feature: data,
1675
+ userData: args,
1676
+ eventType: eventType,
1677
+ provenanceTaxonomy: taxons,
1678
+ alert: featuresAlert,
1679
+ },
1680
+ ];
1741
1681
  if (eventType === 'mouseenter') {
1742
1682
  this.lastHoveredFeature = data;
1743
1683
  }
@@ -1748,15 +1688,15 @@ export default {
1748
1688
  // `data` is a single object (e.g., {featureId: '...', mapUUID: '...'}).
1749
1689
  const singleSelection = !data[0];
1750
1690
  if (!singleSelection) {
1751
- payload = []
1752
- const mapuuid = data.mapUUID
1691
+ payload = [];
1692
+ const mapuuid = data.mapUUID;
1753
1693
  const seenIds = new Set();
1754
1694
  for (let [key, value] of Object.entries(data)) {
1755
1695
  if (key !== 'mapUUID') {
1756
- const id = value.featureId
1757
- const label = value.label
1758
- const resource = [value.models]
1759
- const taxons = this.getTaxons(value)
1696
+ const id = value.featureId;
1697
+ const label = value.label;
1698
+ const resource = [value.models];
1699
+ const taxons = this.getTaxons(value);
1760
1700
  if (seenIds.has(id)) continue;
1761
1701
  seenIds.add(id);
1762
1702
  payload.push({
@@ -1770,50 +1710,54 @@ export default {
1770
1710
  eventType: eventType,
1771
1711
  provenanceTaxonomy: taxons,
1772
1712
  alert: normaliseAlertToStringArray(value.alert),
1773
- mapUUID: mapuuid
1774
- })
1713
+ mapUUID: mapuuid,
1714
+ });
1775
1715
  }
1776
1716
  }
1777
1717
  }
1778
- const clickedItem = singleSelection ? data : data[0]
1718
+ const clickedItem = singleSelection ? data : data[0];
1779
1719
  this.setConnectivityDataSource(this.viewingMode, clickedItem);
1780
1720
  if (this.viewingMode === 'Neuron Connection') {
1781
1721
  // do nothing here
1782
1722
  // the method to highlight paths is moved to checkAndCreatePopups function
1783
1723
  } else {
1784
- this.currentActive = clickedItem.models ? clickedItem.models : '' // This is for FC map
1724
+ this.currentActive = clickedItem.models ? clickedItem.models : ''; // This is for FC map
1785
1725
  // This is for annotation mode - draw connectivity between features/paths
1786
1726
  if (this.activeDrawTool && !this.isValidDrawnCreated) {
1787
1727
  // Check if flatmap features or existing drawn features
1788
- const validDrawnFeature = clickedItem.featureId || this.existDrawnFeatures.find(
1789
- (feature) => feature.id === clickedItem.id
1790
- )
1728
+ const validDrawnFeature =
1729
+ clickedItem.featureId ||
1730
+ this.existDrawnFeatures.find((feature) => feature.id === clickedItem.id);
1791
1731
  // Only the linestring will have connection
1792
1732
  if (this.activeDrawTool === 'LineString' && validDrawnFeature) {
1793
- const key = clickedItem.featureId ? clickedItem.featureId : clickedItem.id
1794
- const nodeLabel = clickedItem.label ? clickedItem.label : `Feature ${clickedItem.id}`
1733
+ const key = clickedItem.featureId ? clickedItem.featureId : clickedItem.id;
1734
+ const nodeLabel = clickedItem.label
1735
+ ? clickedItem.label
1736
+ : `Feature ${clickedItem.id}`;
1795
1737
  // Add space before key to make sure properties follows adding order
1796
1738
  this.connectionEntry[` ${key}`] = Object.assign(
1797
1739
  { label: nodeLabel },
1798
1740
  Object.fromEntries(
1799
1741
  Object.entries(clickedItem)
1800
1742
  .filter(([key]) => ['featureId', 'models'].includes(key))
1801
- .map(([key, value]) => [(key === 'featureId') ? 'id' : key, value])))
1743
+ .map(([key, value]) => [key === 'featureId' ? 'id' : key, value]),
1744
+ ),
1745
+ );
1802
1746
  }
1803
1747
  }
1804
1748
  }
1805
1749
 
1806
1750
  // Disable popup when drawing
1807
1751
  if (data && data.type !== 'marker' && !this.activeDrawTool) {
1808
- this.checkAndCreatePopups(payload)
1752
+ this.checkAndCreatePopups(payload);
1809
1753
  }
1810
1754
  } else if (eventType === 'mouseenter' && this.viewingMode !== 'Neuron Connection') {
1811
- this.currentHover = data.models ? data.models : ''
1755
+ this.currentHover = data.models ? data.models : '';
1812
1756
  }
1813
1757
 
1814
- this.$emit('resource-selected', payload)
1758
+ this.$emit('resource-selected', payload);
1815
1759
  }
1816
- }
1760
+ };
1817
1761
  },
1818
1762
  /**
1819
1763
  * The data for connectivity data source is just a placeholder data
@@ -1843,9 +1787,9 @@ export default {
1843
1787
  */
1844
1788
  changeViewingMode: function (modeName) {
1845
1789
  if (modeName) {
1846
- this.viewingMode = modeName
1790
+ this.viewingMode = modeName;
1847
1791
  }
1848
- this.manualAbortedOnClose()
1792
+ this.manualAbortedOnClose();
1849
1793
  },
1850
1794
  /**
1851
1795
  * @public
@@ -1876,21 +1820,17 @@ export default {
1876
1820
  const { label } = connectivity;
1877
1821
  labelsContainer.append(capitalise(label));
1878
1822
 
1879
- if ((i + 1) < connectivityData.length) {
1823
+ if (i + 1 < connectivityData.length) {
1880
1824
  const hr = document.createElement('hr');
1881
1825
  labelsContainer.appendChild(hr);
1882
1826
  }
1883
1827
  });
1884
1828
 
1885
- this.mapImp.showPopup(
1886
- geojsonId,
1887
- labelsContainer,
1888
- {
1889
- className: 'custom-popup flatmap-tooltip-popup',
1890
- positionAtLastClick: false,
1891
- preserveSelection: true,
1892
- }
1893
- );
1829
+ this.mapImp.showPopup(geojsonId, labelsContainer, {
1830
+ className: 'custom-popup flatmap-tooltip-popup',
1831
+ positionAtLastClick: false,
1832
+ preserveSelection: true,
1833
+ });
1894
1834
  },
1895
1835
  /**
1896
1836
  * Function to show connectivity tooltips on the map
@@ -1933,8 +1873,8 @@ export default {
1933
1873
 
1934
1874
  if (anatomicalNodes) {
1935
1875
  const anatomicalNodesString = anatomicalNodes.join('');
1936
- const foundItem = connectivityData.every((item) =>
1937
- anatomicalNodesString.indexOf(item.id) !== -1
1876
+ const foundItem = connectivityData.every(
1877
+ (item) => anatomicalNodesString.indexOf(item.id) !== -1,
1938
1878
  );
1939
1879
 
1940
1880
  if (foundItem) {
@@ -1968,10 +1908,7 @@ export default {
1968
1908
  const uniqueConnectivityFeatures = [...new Set(connectivityFeatures)];
1969
1909
  const combinedFeatures = [...featuresToHighlight, ...uniqueConnectivityFeatures];
1970
1910
  const featureIdsToHighlight = this.mapImp.modelFeatureIdList(combinedFeatures);
1971
- const allFeaturesToHighlight = [
1972
- ...featureIdsToHighlight,
1973
- ...geojsonHighlights
1974
- ];
1911
+ const allFeaturesToHighlight = [...featureIdsToHighlight, ...geojsonHighlights];
1975
1912
 
1976
1913
  this.mapImp.selectGeoJSONFeatures(allFeaturesToHighlight);
1977
1914
  }
@@ -1983,12 +1920,16 @@ export default {
1983
1920
  },
1984
1921
  searchConnectivitiesByReference: async function (resource) {
1985
1922
  const flatmapKnowledge = sessionStorage.getItem('flatmap-knowledge');
1986
- let featureIds = [];
1923
+ let featureIds;
1987
1924
 
1988
1925
  if (flatmapKnowledge) {
1989
1926
  featureIds = await getReferenceConnectivitiesFromStorage(resource);
1990
1927
  } else {
1991
- featureIds = await getReferenceConnectivitiesByAPI(this.mapImp, resource, this.flatmapQueries);
1928
+ featureIds = await getReferenceConnectivitiesByAPI(
1929
+ this.mapImp,
1930
+ resource,
1931
+ this.flatmapQueries,
1932
+ );
1992
1933
  }
1993
1934
  return featureIds;
1994
1935
  },
@@ -2005,25 +1946,32 @@ export default {
2005
1946
  data: {
2006
1947
  errorData: errorData,
2007
1948
  errorMessage: ERROR_MESSAGE,
2008
- }
1949
+ },
2009
1950
  });
2010
1951
  },
2011
- checkConnectivityTooltipEntry: function(tooltipEntry) {
1952
+ checkConnectivityTooltipEntry: function (tooltipEntry) {
2012
1953
  if (tooltipEntry?.length) {
2013
- return undefined !== (tooltipEntry.find(entry => entry?.destinations?.length || entry?.components?.length))
1954
+ return (
1955
+ undefined !==
1956
+ tooltipEntry.find((entry) => entry?.destinations?.length || entry?.components?.length)
1957
+ );
2014
1958
  }
2015
- return false
1959
+ return false;
2016
1960
  },
2017
1961
  changeConnectivitySource: async function (payload) {
2018
1962
  const { entry, connectivitySource } = payload;
2019
1963
  if (entry.mapId === this.mapImp.id) {
2020
- await this.flatmapQueries.queryForConnectivityNew(this.mapImp, entry.featureId[0], connectivitySource);
1964
+ await this.flatmapQueries.queryForConnectivityNew(
1965
+ this.mapImp,
1966
+ entry.featureId[0],
1967
+ connectivitySource,
1968
+ );
2021
1969
  this.tooltipEntry = this.tooltipEntry.map((tooltip) => {
2022
1970
  if (tooltip.featureId[0] === entry.featureId[0]) {
2023
1971
  return this.flatmapQueries.updateTooltipData(tooltip);
2024
1972
  }
2025
1973
  return tooltip;
2026
- })
1974
+ });
2027
1975
  if (this.checkConnectivityTooltipEntry(this.tooltipEntry)) {
2028
1976
  this.$emit('connectivity-info-open', this.tooltipEntry);
2029
1977
  }
@@ -2038,58 +1986,57 @@ export default {
2038
1986
  checkAndCreatePopups: async function (data, mapclick = true) {
2039
1987
  // Call flatmap database to get the connection data
2040
1988
  if (this.viewingMode === 'Annotation') {
2041
- const features = data.filter(d => d.feature).map(d => d.feature)
1989
+ const features = data.filter((d) => d.feature).map((d) => d.feature);
2042
1990
  if (features.length > 0) {
2043
1991
  if (this.annotationSidebar && this.previousDeletedEvent.type === 'deleted') {
2044
- this.annotationEntry = [{
2045
- ...this.previousDeletedEvent,
2046
- resourceId: this.serverURL
2047
- }]
2048
- this.annotationEventCallback({}, { type: 'aborted' })
1992
+ this.annotationEntry = [
1993
+ {
1994
+ ...this.previousDeletedEvent,
1995
+ resourceId: this.serverURL,
1996
+ },
1997
+ ];
1998
+ this.annotationEventCallback({}, { type: 'aborted' });
2049
1999
  }
2050
- this.annotationEntry = []
2051
- features.forEach(feature => {
2000
+ this.annotationEntry = [];
2001
+ features.forEach((feature) => {
2052
2002
  this.annotationEntry.push({
2053
2003
  ...feature,
2054
2004
  resourceId: this.serverURL,
2055
2005
  featureId: feature.featureId ? feature.featureId : feature.feature?.id,
2056
- offline: this.offlineAnnotationEnabled
2057
- })
2006
+ offline: this.offlineAnnotationEnabled,
2007
+ });
2058
2008
  });
2059
2009
  // Drawn feature annotationEntry will always have length of 1
2060
2010
  if (features[0].feature) {
2061
2011
  // in drawing or edit/delete mode is on or valid drawn
2062
2012
  if (this.activeDrawTool || this.activeDrawMode || this.isValidDrawnCreated) {
2063
- this.featureAnnotationSubmitted = false
2013
+ this.featureAnnotationSubmitted = false;
2064
2014
  if (this.activeDrawTool) {
2065
- this.createConnectivityBody()
2015
+ this.createConnectivityBody();
2066
2016
  }
2067
- this.displayTooltip(
2068
- features[0].feature.id,
2069
- centroid(features[0].feature.geometry)
2070
- )
2017
+ this.displayTooltip(features[0].feature.id, centroid(features[0].feature.geometry));
2071
2018
  } else {
2072
- this.rollbackAnnotationEvent()
2019
+ this.rollbackAnnotationEvent();
2073
2020
  }
2074
2021
  } else {
2075
2022
  const featureIds = this.annotationEntry
2076
- .filter(annotation => annotation.featureId && annotation.models)
2077
- .map(annotation => annotation.models)
2023
+ .filter((annotation) => annotation.featureId && annotation.models)
2024
+ .map((annotation) => annotation.models);
2078
2025
  if (featureIds.length > 0) {
2079
- this.displayTooltip(featureIds)
2026
+ this.displayTooltip(featureIds);
2080
2027
  }
2081
2028
  }
2082
2029
  } else {
2083
- this.annotation = {}
2030
+ this.annotation = {};
2084
2031
  }
2085
2032
  }
2086
2033
  // clicking on a connectivity explorer card will be the same as exploration mode
2087
2034
  // the card should be opened without doing other functions
2088
2035
  else if (this.viewingMode === 'Neuron Connection' && mapclick) {
2089
- const resources = data.map(tooltip => tooltip.resource[0]);
2036
+ const resources = data.map((tooltip) => tooltip.resource[0]);
2090
2037
 
2091
2038
  // filter out paths
2092
- const featureId = resources.find(resource => !resource.startsWith('ilxtr:'));
2039
+ const featureId = resources.find((resource) => !resource.startsWith('ilxtr:'));
2093
2040
  if (featureId) {
2094
2041
  // fallback if it cannot find in anatomical nodes
2095
2042
  const transformResources = Array.isArray(resources) ? [...resources] : [resources];
@@ -2107,8 +2054,8 @@ export default {
2107
2054
  if (anatomicalNodes?.length) {
2108
2055
  // get the node which match the feature in a location
2109
2056
  // [feature, location]
2110
- anatomicalNode = anatomicalNodes.find((node) =>
2111
- JSON.parse(node)[0] === annotationModels
2057
+ anatomicalNode = anatomicalNodes.find(
2058
+ (node) => JSON.parse(node)[0] === annotationModels,
2112
2059
  );
2113
2060
  }
2114
2061
  if (anatomicalNode) {
@@ -2140,7 +2087,7 @@ export default {
2140
2087
 
2141
2088
  const labels = [];
2142
2089
  for (let i = 0; i < uniqueTerms.length; i++) {
2143
- const foundObj = objectResults.find((obj) => obj.id === uniqueTerms[i])
2090
+ const foundObj = objectResults.find((obj) => obj.id === uniqueTerms[i]);
2144
2091
  if (foundObj) {
2145
2092
  labels.push(foundObj.label);
2146
2093
  }
@@ -2150,13 +2097,14 @@ export default {
2150
2097
  facet: JSON.stringify(uniqueResource),
2151
2098
  facetPropPath: `flatmap.connectivity.source.${this.connectionType.toLowerCase()}`,
2152
2099
  tagLabel: filterItemLabel, // used tagLabel here instead of label since the label and value are different
2153
- term: this.connectionType
2100
+ term: this.connectionType,
2154
2101
  };
2155
2102
  // check for existing item
2156
- const isNewFilterItemExist = this.connectivityFilters.some((connectivityfilter) => (
2157
- connectivityfilter.facet === newConnectivityfilter.facet &&
2158
- connectivityfilter.facetPropPath === newConnectivityfilter.facetPropPath
2159
- ));
2103
+ const isNewFilterItemExist = this.connectivityFilters.some(
2104
+ (connectivityfilter) =>
2105
+ connectivityfilter.facet === newConnectivityfilter.facet &&
2106
+ connectivityfilter.facetPropPath === newConnectivityfilter.facetPropPath,
2107
+ );
2160
2108
 
2161
2109
  if (!isNewFilterItemExist) {
2162
2110
  this.connectivityFilters.push(newConnectivityfilter);
@@ -2177,26 +2125,26 @@ export default {
2177
2125
  openConnectivityInfo: async function (data) {
2178
2126
  // load and store knowledge
2179
2127
  loadAndStoreKnowledge(this.mapImp, this.flatmapQueries);
2180
- let prom1 = []
2128
+ let prom1 = [];
2181
2129
  // Emit placeholders first.
2182
2130
  // This may contain invalid connectivity.
2183
2131
  this.tooltipEntry = data
2184
- .filter(tooltip => tooltip.resource[0] in this.mapImp.pathways.paths)
2132
+ .filter((tooltip) => tooltip.resource[0] in this.mapImp.pathways.paths)
2185
2133
  .map((tooltip) => {
2186
- return { title: tooltip.label, featureId: tooltip.resource, ready: false }
2187
- })
2134
+ return { title: tooltip.label, featureId: tooltip.resource, ready: false };
2135
+ });
2188
2136
  // this should only for flatmap paths not all features
2189
2137
  if (this.tooltipEntry.length) {
2190
2138
  this.$emit('connectivity-info-open', this.tooltipEntry);
2191
2139
 
2192
2140
  // While having placeholders displayed, get details for all paths and then replace.
2193
2141
  for (let index = 0; index < data.length; index++) {
2194
- prom1.push(await this.getKnowledgeTooltip(data[index]))
2142
+ prom1.push(await this.getKnowledgeTooltip(data[index]));
2195
2143
  }
2196
- this.tooltipEntry = await Promise.all(prom1)
2197
- const featureIds = this.tooltipEntry.map(tooltip => tooltip.featureId[0])
2144
+ this.tooltipEntry = await Promise.all(prom1);
2145
+ const featureIds = this.tooltipEntry.map((tooltip) => tooltip.featureId[0]);
2198
2146
  if (featureIds.length > 0) {
2199
- this.displayTooltip(featureIds)
2147
+ this.displayTooltip(featureIds);
2200
2148
  }
2201
2149
  }
2202
2150
  },
@@ -2207,19 +2155,20 @@ export default {
2207
2155
  */
2208
2156
  updateConnectivityFilters: function (payload) {
2209
2157
  if (!payload.length) return;
2210
- this.connectivityFilters = payload.filter((filterItem) => (
2211
- filterItem.facet.toLowerCase() !== 'show all'
2212
- ));
2158
+ this.connectivityFilters = payload.filter(
2159
+ (filterItem) => filterItem.facet.toLowerCase() !== 'show all',
2160
+ );
2213
2161
  },
2214
2162
  resetConnectivityfilters: function (payload) {
2215
2163
  if (payload.length) {
2216
2164
  // remove not found items
2217
2165
  this.connectivityFilters = this.connectivityFilters.filter((connectivityfilter) =>
2218
- payload.some((notFoundItem) => (
2219
- notFoundItem.facetPropPath === connectivityfilter.facetPropPath &&
2220
- notFoundItem.facet !== connectivityfilter.facet
2221
- ))
2222
- )
2166
+ payload.some(
2167
+ (notFoundItem) =>
2168
+ notFoundItem.facetPropPath === connectivityfilter.facetPropPath &&
2169
+ notFoundItem.facet !== connectivityfilter.facet,
2170
+ ),
2171
+ );
2223
2172
  } else {
2224
2173
  // full reset
2225
2174
  this.connectivityFilters = [];
@@ -2227,55 +2176,58 @@ export default {
2227
2176
  },
2228
2177
  getKnowledgeTooltip: async function (data) {
2229
2178
  //require data.resource && data.feature.source
2230
- const results = await this.flatmapQueries.retrieveFlatmapKnowledgeForEvent(this.mapImp, data)
2231
- let tooltip = await this.flatmapQueries.createTooltipData(this.mapImp, data)
2179
+ const results = await this.flatmapQueries.retrieveFlatmapKnowledgeForEvent(this.mapImp, data);
2180
+ let tooltip = await this.flatmapQueries.createTooltipData(this.mapImp, data);
2232
2181
  // The line below only creates the tooltip if some data was found on the path
2233
2182
  // the pubmed URLs are in knowledge response.references
2234
- if ((results && results[0]) || (data.feature.hyperlinks && data.feature.hyperlinks.length > 0)) {
2183
+ if (
2184
+ (results && results[0]) ||
2185
+ (data.feature.hyperlinks && data.feature.hyperlinks.length > 0)
2186
+ ) {
2235
2187
  tooltip['featuresAlert'] = normaliseAlertToStringArray(data.alert);
2236
2188
  tooltip['knowledgeSource'] = getKnowledgeSource(this.mapImp);
2237
2189
  // Map id and uuid to load connectivity information from the map
2238
2190
  tooltip['mapId'] = this.mapImp.mapMetadata.id;
2239
2191
  tooltip['mapuuid'] = this.mapImp.mapMetadata.uuid;
2240
- // } else {
2241
- // tooltip = {
2242
- // ...tooltip,
2243
- // origins: [data.label],
2244
- // originsWithDatasets: [{ id: data.resource[0], name: data.label }],
2245
- // components: [],
2246
- // componentsWithDatasets: [],
2247
- // destinations: [],
2248
- // destinationsWithDatasets: [],
2249
- // }
2250
- // let featureIds = []
2251
- // const pathsOfEntities = await this.mapImp.queryPathsForFeatures(data.resource)
2252
- // if (pathsOfEntities.length) {
2253
- // pathsOfEntities.forEach((path) => {
2254
- // featureIds.push(...this.mapImp.pathModelNodes(path))
2255
- // const searchResults = this.mapImp.search(path)
2256
- // let featureId = undefined;
2257
- // for (let i = 0; i < searchResults.results.length; i++) {
2258
- // featureId = searchResults.results[i].featureId
2259
- // const annotation = this.mapImp.annotation(featureId)
2260
- // if (featureId && annotation?.label) break;
2261
- // }
2262
- // if (featureId) {
2263
- // const feature = this.mapImp.featureProperties(featureId)
2264
- // if (feature.label && !tooltip.components.includes(feature.label)) {
2265
- // tooltip.components.push(feature.label)
2266
- // tooltip.componentsWithDatasets.push({ id: feature.models, name: feature.label })
2267
- // }
2268
- // }
2269
- // })
2270
- // featureIds = [...new Set(featureIds)].filter(id => id !== data.feature.featureId)
2271
- // featureIds.forEach((id) => {
2272
- // const feature = this.mapImp.featureProperties(id)
2273
- // if (feature.label && !tooltip.destinations.includes(feature.label)) {
2274
- // tooltip.destinations.push(feature.label)
2275
- // tooltip.destinationsWithDatasets.push({ id: feature.models, name: feature.label })
2276
- // }
2277
- // })
2278
- // }
2192
+ // } else {
2193
+ // tooltip = {
2194
+ // ...tooltip,
2195
+ // origins: [data.label],
2196
+ // originsWithDatasets: [{ id: data.resource[0], name: data.label }],
2197
+ // components: [],
2198
+ // componentsWithDatasets: [],
2199
+ // destinations: [],
2200
+ // destinationsWithDatasets: [],
2201
+ // }
2202
+ // let featureIds = []
2203
+ // const pathsOfEntities = await this.mapImp.queryPathsForFeatures(data.resource)
2204
+ // if (pathsOfEntities.length) {
2205
+ // pathsOfEntities.forEach((path) => {
2206
+ // featureIds.push(...this.mapImp.pathModelNodes(path))
2207
+ // const searchResults = this.mapImp.search(path)
2208
+ // let featureId = undefined;
2209
+ // for (let i = 0; i < searchResults.results.length; i++) {
2210
+ // featureId = searchResults.results[i].featureId
2211
+ // const annotation = this.mapImp.annotation(featureId)
2212
+ // if (featureId && annotation?.label) break;
2213
+ // }
2214
+ // if (featureId) {
2215
+ // const feature = this.mapImp.featureProperties(featureId)
2216
+ // if (feature.label && !tooltip.components.includes(feature.label)) {
2217
+ // tooltip.components.push(feature.label)
2218
+ // tooltip.componentsWithDatasets.push({ id: feature.models, name: feature.label })
2219
+ // }
2220
+ // }
2221
+ // })
2222
+ // featureIds = [...new Set(featureIds)].filter(id => id !== data.feature.featureId)
2223
+ // featureIds.forEach((id) => {
2224
+ // const feature = this.mapImp.featureProperties(id)
2225
+ // if (feature.label && !tooltip.destinations.includes(feature.label)) {
2226
+ // tooltip.destinations.push(feature.label)
2227
+ // tooltip.destinationsWithDatasets.push({ id: feature.models, name: feature.label })
2228
+ // }
2229
+ // })
2230
+ // }
2279
2231
  }
2280
2232
  tooltip['ready'] = true;
2281
2233
  return tooltip;
@@ -2285,19 +2237,19 @@ export default {
2285
2237
  */
2286
2238
  popUpCssHacks: function () {
2287
2239
  // Below is a hack to remove flatmap tooltips while popup is open
2288
- const ftooltip = document.querySelector('.flatmap-tooltip-popup')
2289
- const popupCloseButton = document.querySelector('.maplibregl-popup-close-button')
2290
- if (ftooltip) ftooltip.style.display = 'none'
2291
- popupCloseButton.style.display = 'block'
2292
- this.$refs.tooltip.$el.style.display = 'flex'
2240
+ const ftooltip = document.querySelector('.flatmap-tooltip-popup');
2241
+ const popupCloseButton = document.querySelector('.maplibregl-popup-close-button');
2242
+ if (ftooltip) ftooltip.style.display = 'none';
2243
+ popupCloseButton.style.display = 'block';
2244
+ this.$refs.tooltip.$el.style.display = 'flex';
2293
2245
  popupCloseButton.onclick = () => {
2294
2246
  /**
2295
2247
  * This event is emitted
2296
2248
  * when a connectivity info (provenance popup) is closed.
2297
2249
  */
2298
2250
  this.$emit('connectivity-info-close');
2299
- if (ftooltip) ftooltip.style.display = 'block'
2300
- }
2251
+ if (ftooltip) ftooltip.style.display = 'block';
2252
+ };
2301
2253
  },
2302
2254
  /**
2303
2255
  * @public
@@ -2305,11 +2257,11 @@ export default {
2305
2257
  */
2306
2258
  closeTooltip: function () {
2307
2259
  if (this.$refs.tooltip) {
2308
- this.$refs.tooltip.$el.style.display = 'none'
2260
+ this.$refs.tooltip.$el.style.display = 'none';
2309
2261
  }
2310
2262
  document.querySelectorAll('.maplibregl-popup').forEach((item) => {
2311
- item.style.display = 'none'
2312
- })
2263
+ item.style.display = 'none';
2264
+ });
2313
2265
  this.lastHoveredFeature = null;
2314
2266
  },
2315
2267
  /**
@@ -2321,14 +2273,14 @@ export default {
2321
2273
  */
2322
2274
  showPopup: function (featureId, node, options) {
2323
2275
  // Keeping this as an API
2324
- let myOptions = options
2276
+ let myOptions = options;
2325
2277
  if (this.mapImp) {
2326
2278
  if (myOptions) {
2327
- if (!myOptions.className) myOptions.className = 'custom-popup'
2279
+ if (!myOptions.className) myOptions.className = 'custom-popup';
2328
2280
  } else {
2329
- myOptions = { className: 'custom-popup', positionAtLastClick: true }
2281
+ myOptions = { className: 'custom-popup', positionAtLastClick: true };
2330
2282
  }
2331
- this.mapImp.showPopup(featureId, node, myOptions)
2283
+ this.mapImp.showPopup(featureId, node, myOptions);
2332
2284
  }
2333
2285
  },
2334
2286
  /**
@@ -2340,7 +2292,7 @@ export default {
2340
2292
  */
2341
2293
  showMarkerPopup: function (featureId, node, options) {
2342
2294
  if (this.mapImp) {
2343
- this.mapImp.showMarkerPopup(featureId, node, options)
2295
+ this.mapImp.showMarkerPopup(featureId, node, options);
2344
2296
  }
2345
2297
  },
2346
2298
  /**
@@ -2348,34 +2300,28 @@ export default {
2348
2300
  * Function to close minimap.
2349
2301
  */
2350
2302
  closeMinimap: function () {
2351
- let minimapEl = this.$refs.flatmapContainer.querySelector(
2352
- '.maplibregl-ctrl-minimap'
2353
- ) // find minimap
2303
+ let minimapEl = this.$refs.flatmapContainer.querySelector('.maplibregl-ctrl-minimap'); // find minimap
2354
2304
  if (this.minimapSmall) {
2355
2305
  //switch the classes on the minimap
2356
- minimapEl.classList.add('enlarge')
2357
- minimapEl.classList.remove('shrink')
2306
+ minimapEl.classList.add('enlarge');
2307
+ minimapEl.classList.remove('shrink');
2358
2308
  } else {
2359
- minimapEl.classList.add('shrink')
2360
- minimapEl.classList.remove('enlarge')
2309
+ minimapEl.classList.add('shrink');
2310
+ minimapEl.classList.remove('enlarge');
2361
2311
  }
2362
- this.minimapSmall = !this.minimapSmall
2312
+ this.minimapSmall = !this.minimapSmall;
2363
2313
  },
2364
2314
  /**
2365
2315
  * Function to add resize button to minimap.
2366
2316
  */
2367
2317
  addResizeButtonToMinimap: function () {
2368
- let minimapEl = this.$refs.flatmapContainer.querySelector(
2369
- '.maplibregl-ctrl-minimap'
2370
- )
2318
+ let minimapEl = this.$refs.flatmapContainer.querySelector('.maplibregl-ctrl-minimap');
2371
2319
  if (minimapEl) {
2372
- if (this.$refs.minimapResize &&
2373
- this.$refs.minimapResize.$el.parentNode) {
2374
- this.$refs.minimapResize.$el.parentNode.removeChild(
2375
- this.$refs.minimapResize.$el)
2320
+ if (this.$refs.minimapResize && this.$refs.minimapResize.$el.parentNode) {
2321
+ this.$refs.minimapResize.$el.parentNode.removeChild(this.$refs.minimapResize.$el);
2376
2322
  }
2377
- minimapEl.appendChild(this.$refs.minimapResize.$el)
2378
- this.minimapResizeShow = true
2323
+ minimapEl.appendChild(this.$refs.minimapResize.$el);
2324
+ this.minimapResizeShow = true;
2379
2325
  }
2380
2326
  },
2381
2327
  /**
@@ -2398,16 +2344,14 @@ export default {
2398
2344
  // Open pathway drawer if the tooltip is inside or beside
2399
2345
  const { parentElement, nextElementSibling } = popoverRef.$el;
2400
2346
  const isPathwayContainer = (element) => {
2401
- return element && (
2402
- element.classList.contains('pathway-container') ||
2403
- element.classList.contains('pathway-location')
2347
+ return (
2348
+ element &&
2349
+ (element.classList.contains('pathway-container') ||
2350
+ element.classList.contains('pathway-location'))
2404
2351
  );
2405
2352
  };
2406
2353
 
2407
- if (
2408
- isPathwayContainer(parentElement) ||
2409
- isPathwayContainer(nextElementSibling)
2410
- ) {
2354
+ if (isPathwayContainer(parentElement) || isPathwayContainer(nextElementSibling)) {
2411
2355
  if (this.requiresDrawer) {
2412
2356
  this.drawerOpen = true;
2413
2357
  } else {
@@ -2434,7 +2378,7 @@ export default {
2434
2378
  }
2435
2379
 
2436
2380
  if (this.viewingMode !== 'Annotation' && this.helpModeActiveIndex > 9) {
2437
- this.helpModeActiveIndex = lastIndex
2381
+ this.helpModeActiveIndex = lastIndex;
2438
2382
  }
2439
2383
 
2440
2384
  if (helpMode && this.helpModeActiveIndex >= lastIndex) {
@@ -2450,7 +2394,6 @@ export default {
2450
2394
  item.value = true;
2451
2395
  });
2452
2396
  } else if (helpMode && this.helpModeDialog && toolTipsLength > this.helpModeActiveIndex) {
2453
-
2454
2397
  // Show the map tooltip as first item
2455
2398
  if (this.helpModeActiveIndex > -1) {
2456
2399
  this.closeFlatmapHelpPopup();
@@ -2468,11 +2411,11 @@ export default {
2468
2411
  this.openFlatmapHelpPopup();
2469
2412
  }
2470
2413
  } else {
2471
- this.inHelp = false
2414
+ this.inHelp = false;
2472
2415
  this.hoverVisibilities.forEach((item) => {
2473
- item.value = false
2474
- })
2475
- this.closeFlatmapHelpPopup()
2416
+ item.value = false;
2417
+ });
2418
+ this.closeFlatmapHelpPopup();
2476
2419
  }
2477
2420
  },
2478
2421
  /**
@@ -2484,14 +2427,14 @@ export default {
2484
2427
  */
2485
2428
  showTooltip: function (tooltipNumber, timeout = 500) {
2486
2429
  if (!this.inHelp) {
2487
- clearTimeout(this.tooltipWait[tooltipNumber])
2430
+ clearTimeout(this.tooltipWait[tooltipNumber]);
2488
2431
  this.tooltipWait[tooltipNumber] = setTimeout(() => {
2489
- this.hoverVisibilities[tooltipNumber].value = true
2432
+ this.hoverVisibilities[tooltipNumber].value = true;
2490
2433
  /**
2491
2434
  * This event is emitted after a tooltip in Flatmap is shown.
2492
2435
  */
2493
2436
  this.$emit('shown-tooltip');
2494
- }, timeout)
2437
+ }, timeout);
2495
2438
  }
2496
2439
  },
2497
2440
 
@@ -2504,10 +2447,10 @@ export default {
2504
2447
  */
2505
2448
  hideTooltip: function (tooltipNumber, timeout = 500) {
2506
2449
  if (!this.inHelp) {
2507
- clearTimeout(this.tooltipWait[tooltipNumber])
2450
+ clearTimeout(this.tooltipWait[tooltipNumber]);
2508
2451
  this.tooltipWait[tooltipNumber] = setTimeout(() => {
2509
- this.hoverVisibilities[tooltipNumber].value = false
2510
- }, timeout)
2452
+ this.hoverVisibilities[tooltipNumber].value = false;
2453
+ }, timeout);
2511
2454
  }
2512
2455
  },
2513
2456
  /**
@@ -2518,30 +2461,31 @@ export default {
2518
2461
  * @arg {String} `geometry` _(default: `undefined`)_
2519
2462
  */
2520
2463
  displayTooltip: function (feature, geometry = undefined) {
2521
- let featureId = undefined
2522
- let options = { className: 'flatmapvuer-popover' }
2464
+ let featureId = undefined;
2465
+ let options = { className: 'flatmapvuer-popover' };
2523
2466
  if (geometry) {
2524
- featureId = feature
2525
- options.annotationFeatureGeometry = geometry
2467
+ featureId = feature;
2468
+ options.annotationFeatureGeometry = geometry;
2526
2469
  if (this.annotationEntry.length) {
2527
2470
  options['annotationEvent'] = {
2528
2471
  type: this.annotationEntry[0].type,
2529
- feature: this.annotationEntry[0].feature
2530
- }
2472
+ feature: this.annotationEntry[0].feature,
2473
+ };
2531
2474
  }
2532
2475
  } else {
2533
- const entry = Array.isArray(feature) ? feature[0] : feature
2476
+ const entry = Array.isArray(feature) ? feature[0] : feature;
2534
2477
  if (entry) {
2535
- featureId = this.mapImp.modelFeatureIds(entry)[0]
2478
+ featureId = this.mapImp.modelFeatureIds(entry)[0];
2536
2479
  }
2537
2480
  if (!this.activeDrawTool) {
2538
- options.positionAtLastClick = true
2481
+ options.positionAtLastClick = true;
2539
2482
  }
2540
2483
  }
2541
2484
  // If connectivityInfoSidebar is set to `true`
2542
2485
  // Connectivity info will show in sidebar
2543
2486
  if (
2544
- (this.connectivityInfoSidebar && this.tooltipEntry.length) &&
2487
+ this.connectivityInfoSidebar &&
2488
+ this.tooltipEntry.length &&
2545
2489
  this.viewingMode !== 'Annotation'
2546
2490
  ) {
2547
2491
  if (this.checkConnectivityTooltipEntry(this.tooltipEntry)) {
@@ -2549,7 +2493,10 @@ export default {
2549
2493
  }
2550
2494
  }
2551
2495
  if (this.annotationSidebar && this.viewingMode === 'Annotation') {
2552
- this.$emit('annotation-open', {annotationEntry: this.annotationEntry, commitCallback: this.commitAnnotationEvent});
2496
+ this.$emit('annotation-open', {
2497
+ annotationEntry: this.annotationEntry,
2498
+ commitCallback: this.commitAnnotationEvent,
2499
+ });
2553
2500
  }
2554
2501
  // If UI is not disabled,
2555
2502
  // And connectivityInfoSidebar is not set (default) or set to `false`
@@ -2558,10 +2505,8 @@ export default {
2558
2505
  if (
2559
2506
  featureId &&
2560
2507
  !this.disableUI &&
2561
- (
2562
- (this.viewingMode === 'Annotation' && !this.annotationSidebar) ||
2563
- (this.viewingMode === 'Exploration' && !this.connectivityInfoSidebar)
2564
- )
2508
+ ((this.viewingMode === 'Annotation' && !this.annotationSidebar) ||
2509
+ (this.viewingMode === 'Exploration' && !this.connectivityInfoSidebar))
2565
2510
  ) {
2566
2511
  this.tooltipDisplay = true;
2567
2512
  this.$nextTick(() => {
@@ -2576,7 +2521,7 @@ export default {
2576
2521
  * because the sidebar is opened
2577
2522
  * @arg featureIds
2578
2523
  */
2579
- moveMap: function (featureIds, options = {}) {
2524
+ moveMap: function (featureIds, options = {}) {
2580
2525
  if (this.mapImp) {
2581
2526
  const { offsetX = 0, offsetY = 0, zoom = 4 } = options;
2582
2527
  const Map = this.mapImp.map;
@@ -2596,7 +2541,7 @@ export default {
2596
2541
  Map.fitBounds(bbox, {
2597
2542
  offset: [offsetX, offsetY],
2598
2543
  zoom: zoom,
2599
- animate: true
2544
+ animate: true,
2600
2545
  });
2601
2546
  });
2602
2547
  }
@@ -2608,13 +2553,13 @@ export default {
2608
2553
  */
2609
2554
  openFlatmapHelpPopup: function () {
2610
2555
  if (this.mapImp) {
2611
- let heartId = this.mapImp.modelFeatureIds('UBERON:0000948')
2556
+ let heartId = this.mapImp.modelFeatureIds('UBERON:0000948');
2612
2557
  if (heartId && heartId.length > 0) {
2613
- const elm = 'Click for more information'
2558
+ const elm = 'Click for more information';
2614
2559
  this.mapImp.showPopup(heartId[0], elm, {
2615
2560
  anchor: 'top',
2616
2561
  className: 'flatmap-popup-popper',
2617
- })
2562
+ });
2618
2563
  /**
2619
2564
  * This event is emitted after a tooltip on Flatmap's map is shown.
2620
2565
  */
@@ -2627,24 +2572,22 @@ export default {
2627
2572
  * Function to close Flatmap Help Popup.
2628
2573
  */
2629
2574
  closeFlatmapHelpPopup: function () {
2630
- this.$el
2631
- .querySelectorAll('.maplibregl-popup-close-button')
2632
- .forEach((item) => {
2633
- item.click()
2634
- })
2575
+ this.$el.querySelectorAll('.maplibregl-popup-close-button').forEach((item) => {
2576
+ item.click();
2577
+ });
2635
2578
  },
2636
2579
  /**
2637
2580
  * @public
2638
2581
  * Function to get annotation labels.
2639
2582
  */
2640
2583
  getLabels: function () {
2641
- let labels = []
2584
+ let labels = [];
2642
2585
  if (this.mapImp) {
2643
- let annotations = this.mapImp.annotations
2586
+ let annotations = this.mapImp.annotations;
2644
2587
  for (let value of annotations.values()) {
2645
- if (value.label) labels.push(value.label)
2588
+ if (value.label) labels.push(value.label);
2646
2589
  }
2647
- return Array.from(new Set(labels))
2590
+ return Array.from(new Set(labels));
2648
2591
  }
2649
2592
  },
2650
2593
  /**
@@ -2652,17 +2595,17 @@ export default {
2652
2595
  * the provided argument
2653
2596
  */
2654
2597
  getVisibilityState: function (state) {
2655
- const refs = ['alertSelection', 'pathwaysSelection', 'taxonSelection']
2656
- refs.forEach(ref => {
2657
- let comp = this.$refs[ref]
2598
+ const refs = ['alertSelection', 'pathwaysSelection', 'taxonSelection'];
2599
+ refs.forEach((ref) => {
2600
+ let comp = this.$refs[ref];
2658
2601
  if (comp) {
2659
- state[ref] = comp.getState()
2602
+ state[ref] = comp.getState();
2660
2603
  }
2661
- })
2604
+ });
2662
2605
  if (this.$refs.treeControls) {
2663
2606
  const checkedKeys = this.$refs.treeControls.$refs.regionTree.getCheckedKeys();
2664
2607
  //Only store first level systems (terms without .)
2665
- state['systemsSelection'] = checkedKeys.filter(term => !term.includes('.'))
2608
+ state['systemsSelection'] = checkedKeys.filter((term) => !term.includes('.'));
2666
2609
  }
2667
2610
  },
2668
2611
  /**
@@ -2670,22 +2613,22 @@ export default {
2670
2613
  * the map with the provided argument
2671
2614
  */
2672
2615
  setVisibilityState: function (state) {
2673
- const refs = ['alertSelection', 'pathwaysSelection', 'taxonSelection']
2674
- refs.forEach(ref => {
2675
- const settings = state[ref]
2616
+ const refs = ['alertSelection', 'pathwaysSelection', 'taxonSelection'];
2617
+ refs.forEach((ref) => {
2618
+ const settings = state[ref];
2676
2619
  if (settings) {
2677
- const comp = this.$refs[ref]
2620
+ const comp = this.$refs[ref];
2678
2621
  if (comp) {
2679
- comp.setState(settings)
2622
+ comp.setState(settings);
2680
2623
  }
2681
2624
  }
2682
- })
2625
+ });
2683
2626
  if ('systemsSelection' in state) {
2684
2627
  if (this.$refs.treeControls) {
2685
2628
  this.$refs.treeControls.$refs.regionTree.setCheckedKeys(state['systemsSelection']);
2686
2629
  this.systems[0].children.forEach((item) => {
2687
- this.mapImp.enableSystem(item.key, state['systemsSelection'].includes(item.key))
2688
- })
2630
+ this.mapImp.enableSystem(item.key, state['systemsSelection'].includes(item.key));
2631
+ });
2689
2632
  }
2690
2633
  }
2691
2634
  },
@@ -2698,25 +2641,25 @@ export default {
2698
2641
  let state = {
2699
2642
  entry: this.entry,
2700
2643
  viewport: this.mapImp.getState(),
2701
- }
2702
- const identifier = this.mapImp.getIdentifier()
2703
- if (this.biologicalSex) state['biologicalSex'] = this.biologicalSex
2644
+ };
2645
+ const identifier = this.mapImp.getIdentifier();
2646
+ if (this.biologicalSex) state['biologicalSex'] = this.biologicalSex;
2704
2647
  else if (identifier && identifier.biologicalSex)
2705
- state['biologicalSex'] = identifier.biologicalSex
2706
- if (identifier && identifier.uuid) state['uuid'] = identifier.uuid
2707
- state['viewingMode'] = this.viewingMode
2708
- state['searchTerm'] = this.searchTerm
2709
- state['flightPath3D'] = this.flightPath3DRadio
2710
- state['colour'] = this.colourRadio
2711
- state['outlines'] = this.outlinesRadio
2712
- state['background'] = this.currentBackground
2648
+ state['biologicalSex'] = identifier.biologicalSex;
2649
+ if (identifier && identifier.uuid) state['uuid'] = identifier.uuid;
2650
+ state['viewingMode'] = this.viewingMode;
2651
+ state['searchTerm'] = this.searchTerm;
2652
+ state['flightPath3D'] = this.flightPath3DRadio;
2653
+ state['colour'] = this.colourRadio;
2654
+ state['outlines'] = this.outlinesRadio;
2655
+ state['background'] = this.currentBackground;
2713
2656
  if (this.offlineAnnotationEnabled) {
2714
- state['offlineAnnotations'] = sessionStorage.getItem('anonymous-annotation')
2657
+ state['offlineAnnotations'] = sessionStorage.getItem('anonymous-annotation');
2715
2658
  }
2716
- this.getVisibilityState(state)
2717
- return state
2659
+ this.getVisibilityState(state);
2660
+ return state;
2718
2661
  }
2719
- return undefined
2662
+ return undefined;
2720
2663
  },
2721
2664
  /**
2722
2665
  * @public
@@ -2731,11 +2674,11 @@ export default {
2731
2674
  this.entry == state.entry &&
2732
2675
  (!state.biologicalSex || state.biologicalSex === this.biologicalSex)
2733
2676
  ) {
2734
- this.restoreMapState(state)
2677
+ this.restoreMapState(state);
2735
2678
  } else {
2736
- this.createFlatmap(state)
2679
+ this.createFlatmap(state);
2737
2680
  }
2738
- this.setStateRequired = false
2681
+ this.setStateRequired = false;
2739
2682
  }
2740
2683
  },
2741
2684
  /**
@@ -2746,21 +2689,21 @@ export default {
2746
2689
  */
2747
2690
  restoreMapState: function (state) {
2748
2691
  if (state) {
2749
- if (state.viewport) this.mapImp.setState(state.viewport)
2692
+ if (state.viewport) this.mapImp.setState(state.viewport);
2750
2693
  if (state.offlineAnnotations) {
2751
- sessionStorage.setItem('anonymous-annotation', state.offlineAnnotations)
2694
+ sessionStorage.setItem('anonymous-annotation', state.offlineAnnotations);
2752
2695
  }
2753
- if (state.viewingMode) this.changeViewingMode(state.viewingMode)
2696
+ if (state.viewingMode) this.changeViewingMode(state.viewingMode);
2754
2697
  //The following three are boolean
2755
- if ('flightPath3D' in state) this.setFlightPath3D(state.flightPath3D)
2756
- if ('colour' in state) this.setColour(state.colour)
2757
- if ('outlines' in state) this.setOutlines(state.outlines)
2758
- if (state.background) this.backgroundChangeCallback(state.background)
2698
+ if ('flightPath3D' in state) this.setFlightPath3D(state.flightPath3D);
2699
+ if ('colour' in state) this.setColour(state.colour);
2700
+ if ('outlines' in state) this.setOutlines(state.outlines);
2701
+ if (state.background) this.backgroundChangeCallback(state.background);
2759
2702
  if (state.searchTerm) {
2760
- const searchTerm = state.searchTerm
2761
- this.searchAndShowResult(searchTerm, true, true)
2703
+ const searchTerm = state.searchTerm;
2704
+ this.searchAndShowResult(searchTerm, true, true);
2762
2705
  }
2763
- this.setVisibilityState(state)
2706
+ this.setVisibilityState(state);
2764
2707
  }
2765
2708
  },
2766
2709
  /**
@@ -2771,12 +2714,12 @@ export default {
2771
2714
  * @arg {String} `mapVersion`
2772
2715
  */
2773
2716
  setFlightPathInfo: function (mapVersion) {
2774
- const mapVersionForFlightPath = 1.6
2717
+ const mapVersionForFlightPath = 1.6;
2775
2718
  if (mapVersion === mapVersionForFlightPath || mapVersion > mapVersionForFlightPath) {
2776
2719
  // Show flight path option UI
2777
- this.displayFlightPathOption = true
2720
+ this.displayFlightPathOption = true;
2778
2721
  // Show 2D as default on FC type
2779
- this.setFlightPath3D(false)
2722
+ this.setFlightPath3D(false);
2780
2723
  }
2781
2724
  },
2782
2725
  /**
@@ -2787,8 +2730,8 @@ export default {
2787
2730
  */
2788
2731
  createFlatmap: function (state) {
2789
2732
  if (!this.mapImp && !this.loading) {
2790
- this.loading = true
2791
- this.flatmapError = null
2733
+ this.loading = true;
2734
+ this.flatmapError = null;
2792
2735
 
2793
2736
  //As for flatmap-viewer@2.2.7, see below for the documentation
2794
2737
  //for the identifier:
@@ -2806,19 +2749,19 @@ export default {
2806
2749
  // @arg identifier.uuid {string} The unique uuid the flatmap. If given then this exact map will
2807
2750
  // be loaded, overriding ``taxon`` and ``biologicalSex``.
2808
2751
 
2809
- let identifier = { taxon: this.entry }
2752
+ let identifier = { taxon: this.entry };
2810
2753
  if (this.uuid) {
2811
- identifier.uuid = this.uuid
2754
+ identifier.uuid = this.uuid;
2812
2755
  }
2813
2756
  //This now handle the uses of uuid when resuming states
2814
2757
  if (state) {
2815
2758
  if (state.uuid) {
2816
- identifier = { uuid: state.uuid }
2759
+ identifier = { uuid: state.uuid };
2817
2760
  } else if (state.entry) {
2818
- identifier.taxon = state.entry
2761
+ identifier.taxon = state.entry;
2819
2762
  }
2820
2763
  if (state.biologicalSex) {
2821
- identifier['biologicalSex'] = state.biologicalSex;
2764
+ identifier['biologicalSex'] = state.biologicalSex;
2822
2765
  } else if (identifier.taxon === 'NCBITaxon:9606') {
2823
2766
  //For backward compatibility
2824
2767
  identifier['biologicalSex'] = 'PATO:0000384';
@@ -2827,69 +2770,67 @@ export default {
2827
2770
  // Set the bioloicalSex now if map is not resumed from
2828
2771
  // a saved state
2829
2772
  if (this.biologicalSex) {
2830
- identifier['biologicalSex'] = this.biologicalSex
2773
+ identifier['biologicalSex'] = this.biologicalSex;
2831
2774
  }
2832
2775
  }
2833
2776
 
2834
- let promise1 = this.mapManagerRef.loadMap(
2835
- identifier,
2836
- this.eventCallback(),
2837
- {
2838
- //fullscreenControl: false,
2839
- //annotatable: false,
2840
- //debug: true,
2841
- minZoom: this.minZoom,
2842
- tooltips: this.tooltips,
2843
- minimap: false,
2844
- container: this.$refs.display,
2845
- tooltipDelay: 15, // new feature to delay tooltips showing
2846
- }
2847
- )
2848
- promise1.then((returnedObject) => {
2849
- this.mapImp = attachSomaLocationMarkerMethods(returnedObject)
2850
- this.serverURL = this.mapImp.makeServerUrl('').slice(0, -1)
2851
- let mapVersion = this.mapImp.details.version
2852
- this.setFlightPathInfo(mapVersion)
2853
- const stateToSet = this._stateToBeSet ? this._stateToBeSet : state
2854
- this.onFlatmapReady(stateToSet)
2855
- this.$nextTick(() => this.restoreMapState(stateToSet))
2856
- }).catch((error) => {
2857
- console.error('Flatmap loading error:', error)
2858
- // prepare error object
2859
- this.flatmapError = {};
2860
- if (error.message && error.message.indexOf('Unknown map') !== -1) {
2861
- this.flatmapError['title'] = 'Unknown Map!';
2862
- this.flatmapError['messages'] = Object.keys(identifier).map(key => {
2863
- const keyName = key === 'uuid' ? 'UUID' : capitalise(key);
2864
- return `${keyName}: ${identifier[key]}`
2865
- });
2866
- } else {
2867
- this.flatmapError['title'] = 'Error Loading Map!';
2868
- this.flatmapError['messages'] = [
2869
- error.message ? error.message : error.toString(),
2870
- 'Please try again later or contact support if the problem persists.'
2871
- ];
2872
- }
2873
- if (this.$parent?.$refs?.multiContainer) {
2874
- // if the flatmap is in a multiflatmapvuer
2875
- // show a button to load default map
2876
- const multiFlatmapVuer = this.$parent;
2877
- this.flatmapError['button'] = {
2878
- text: 'Load Default Map',
2879
- callback: () => {
2880
- const defaultSpecies = multiFlatmapVuer.initial;
2881
- multiFlatmapVuer.setSpecies(defaultSpecies, undefined, 3);
2882
- }
2883
- };
2884
- }
2885
- this.loading = false;
2886
- })
2777
+ let promise1 = this.mapManagerRef.loadMap(identifier, this.eventCallback(), {
2778
+ //fullscreenControl: false,
2779
+ //annotatable: false,
2780
+ //debug: true,
2781
+ minZoom: this.minZoom,
2782
+ tooltips: this.tooltips,
2783
+ minimap: false,
2784
+ container: this.$refs.display,
2785
+ tooltipDelay: 15, // new feature to delay tooltips showing
2786
+ });
2787
+ promise1
2788
+ .then((returnedObject) => {
2789
+ this.mapImp = returnedObject;
2790
+ this.serverURL = this.mapImp.makeServerUrl('').slice(0, -1);
2791
+ let mapVersion = this.mapImp.details.version;
2792
+ this.setFlightPathInfo(mapVersion);
2793
+ const stateToSet = this._stateToBeSet ? this._stateToBeSet : state;
2794
+ this.onFlatmapReady(stateToSet);
2795
+ this.$nextTick(() => this.restoreMapState(stateToSet));
2796
+ })
2797
+ .catch((error) => {
2798
+ console.error('Flatmap loading error:', error);
2799
+ // prepare error object
2800
+ this.flatmapError = {};
2801
+ if (error.message && error.message.indexOf('Unknown map') !== -1) {
2802
+ this.flatmapError['title'] = 'Unknown Map!';
2803
+ this.flatmapError['messages'] = Object.keys(identifier).map((key) => {
2804
+ const keyName = key === 'uuid' ? 'UUID' : capitalise(key);
2805
+ return `${keyName}: ${identifier[key]}`;
2806
+ });
2807
+ } else {
2808
+ this.flatmapError['title'] = 'Error Loading Map!';
2809
+ this.flatmapError['messages'] = [
2810
+ error.message ? error.message : error.toString(),
2811
+ 'Please try again later or contact support if the problem persists.',
2812
+ ];
2813
+ }
2814
+ if (this.$parent?.$refs?.multiContainer) {
2815
+ // if the flatmap is in a multiflatmapvuer
2816
+ // show a button to load default map
2817
+ const multiFlatmapVuer = this.$parent;
2818
+ this.flatmapError['button'] = {
2819
+ text: 'Load Default Map',
2820
+ callback: () => {
2821
+ const defaultSpecies = multiFlatmapVuer.initial;
2822
+ multiFlatmapVuer.setSpecies(defaultSpecies, undefined, 3);
2823
+ },
2824
+ };
2825
+ }
2826
+ this.loading = false;
2827
+ });
2887
2828
  } else if (state) {
2888
2829
  this._stateToBeSet = {
2889
- ...state
2890
- }
2830
+ ...state,
2831
+ };
2891
2832
  if (this.mapImp && !this.loading) {
2892
- this.restoreMapState(this._stateToBeSet)
2833
+ this.restoreMapState(this._stateToBeSet);
2893
2834
  }
2894
2835
  }
2895
2836
  },
@@ -2898,13 +2839,12 @@ export default {
2898
2839
  * Function to compute path controls maximum height.
2899
2840
  */
2900
2841
  computePathControlsMaximumHeight() {
2901
- const elem = this.$refs.display
2842
+ const elem = this.$refs.display;
2902
2843
  if (elem) {
2903
- const computed = getComputedStyle(elem)
2904
- const padding =
2905
- parseInt(computed.paddingTop) + parseInt(computed.paddingBottom)
2906
- const height = elem.clientHeight - padding
2907
- this.pathwaysMaxHeight = height - 170
2844
+ const computed = getComputedStyle(elem);
2845
+ const padding = parseInt(computed.paddingTop) + parseInt(computed.paddingBottom);
2846
+ const height = elem.clientHeight - padding;
2847
+ this.pathwaysMaxHeight = height - 170;
2908
2848
  }
2909
2849
  },
2910
2850
  /**
@@ -2913,66 +2853,71 @@ export default {
2913
2853
  */
2914
2854
  mapResize: function () {
2915
2855
  try {
2916
- this.computePathControlsMaximumHeight()
2856
+ this.computePathControlsMaximumHeight();
2917
2857
  if (this.mapImp) {
2918
- this.mapImp.resize()
2858
+ this.mapImp.resize();
2919
2859
  }
2920
2860
  } catch {
2921
- console.error('Map resize error')
2861
+ console.error('Map resize error');
2922
2862
  }
2923
2863
  },
2924
2864
  getFilterSources: function () {
2925
- const FILTER_PROPERTIES = ['kind', 'taxons']
2926
- let withAlert = new Set()
2927
- let withoutAlert = new Set()
2928
- let filterSourcesMap = new Map()
2865
+ const FILTER_PROPERTIES = ['kind', 'taxons'];
2866
+ let withAlert = new Set();
2867
+ let withoutAlert = new Set();
2868
+ let filterSourcesMap = new Map();
2929
2869
  for (const annotation of this.mapImp.annotations.values()) {
2930
2870
  if (annotation.source) {
2931
- if ("alert" in annotation) {
2932
- withAlert.add(annotation.source)
2871
+ if ('alert' in annotation) {
2872
+ withAlert.add(annotation.source);
2933
2873
  } else {
2934
- withoutAlert.add(annotation.source)
2874
+ withoutAlert.add(annotation.source);
2935
2875
  }
2936
2876
  for (const [key, value] of Object.entries(annotation)) {
2937
2877
  if (FILTER_PROPERTIES.includes(key)) {
2938
2878
  if (!filterSourcesMap.has(key)) {
2939
- filterSourcesMap.set(key, new Map())
2879
+ filterSourcesMap.set(key, new Map());
2940
2880
  }
2941
- const sourceMap = filterSourcesMap.get(key)
2881
+ const sourceMap = filterSourcesMap.get(key);
2942
2882
  const addToSourceMap = (val) => {
2943
- const setKey = val
2883
+ const setKey = val;
2944
2884
  if (!sourceMap.has(setKey)) {
2945
- sourceMap.set(setKey, new Set())
2885
+ sourceMap.set(setKey, new Set());
2946
2886
  }
2947
- sourceMap.get(setKey).add(`${annotation.source}`)
2887
+ sourceMap.get(setKey).add(`${annotation.source}`);
2948
2888
  };
2949
2889
  if (Array.isArray(value)) {
2950
- value.forEach(addToSourceMap)
2890
+ value.forEach(addToSourceMap);
2951
2891
  } else {
2952
- addToSourceMap(value)
2892
+ addToSourceMap(value);
2953
2893
  }
2954
2894
  }
2955
2895
  }
2956
2896
  }
2957
2897
  }
2958
2898
  let filterSources = {
2959
- 'alert': {
2960
- 'with': [...withAlert],
2961
- 'without': [...withoutAlert]
2962
- }
2963
- }
2899
+ alert: {
2900
+ with: [...withAlert],
2901
+ without: [...withoutAlert],
2902
+ },
2903
+ };
2964
2904
  for (const [key, value] of filterSourcesMap.entries()) {
2965
- filterSources[key] = {}
2905
+ filterSources[key] = {};
2966
2906
  for (const [key1, value1] of value.entries()) {
2967
- filterSources[key][key1] = [...value1.values()]
2907
+ filterSources[key][key1] = [...value1.values()];
2968
2908
  }
2969
2909
  }
2970
- return filterSources
2910
+ return filterSources;
2971
2911
  },
2972
2912
  getFilterOptions: async function (mapImp, _providedKnowledge) {
2973
2913
  const providedKnowledge = _providedKnowledge || this.getFlatmapKnowledge();
2974
2914
  const providedPathways = this.pathways;
2975
- const flatmapFilterOptions = await getFlatmapFilterOptions(this.flatmapAPI, mapImp, providedKnowledge, providedPathways);
2915
+ const flatmapFilterOptions = await getFlatmapFilterOptions(
2916
+ this.flatmapAPI,
2917
+ mapImp,
2918
+ providedKnowledge,
2919
+ providedPathways,
2920
+ );
2976
2921
  return flatmapFilterOptions;
2977
2922
  },
2978
2923
  /**
@@ -2981,38 +2926,38 @@ export default {
2981
2926
  */
2982
2927
  onFlatmapReady: function (state) {
2983
2928
  // onFlatmapReady is used for functions that need to run immediately after the flatmap is loaded
2984
- this.sensor = markRaw(new ResizeSensor(this.$refs.display, this.mapResize))
2929
+ this.sensor = markRaw(new ResizeSensor(this.$refs.display, this.mapResize));
2985
2930
  if (this.mapImp.options?.style === 'functional') {
2986
- this.isFC = true
2987
- }
2988
- this.mapImp.setBackgroundOpacity(1)
2989
- this.backgroundChangeCallback(this.currentBackground)
2990
- this.pathways = this.mapImp.pathTypes()
2991
- this.pathways = this.pathways.filter(path => {
2992
- return path.enabled && path.type !== 'other'
2993
- })
2931
+ this.isFC = true;
2932
+ }
2933
+ this.mapImp.setBackgroundOpacity(1);
2934
+ this.backgroundChangeCallback(this.currentBackground);
2935
+ this.pathways = this.mapImp.pathTypes();
2936
+ this.pathways = this.pathways.filter((path) => {
2937
+ return path.enabled && path.type !== 'other';
2938
+ });
2994
2939
  //Disable layers for now
2995
2940
  //this.layers = this.mapImp.getLayers();
2996
- this.processSystems(this.mapImp.getSystems())
2941
+ this.processSystems(this.mapImp.getSystems());
2997
2942
  //Async, pass the state for checking
2998
- this.processTaxon(this.mapImp.taxonIdentifiers, state ? state['taxonSelection'] : undefined)
2999
- this.containsAlert = "alert" in this.mapImp.featureFilterRanges()
3000
- this.flatmapLegends = this.mapImp.flatmapLegend
3001
- this.loading = false
3002
- this.computePathControlsMaximumHeight()
3003
- this.mapResize()
2943
+ this.processTaxon(this.mapImp.taxonIdentifiers, state ? state['taxonSelection'] : undefined);
2944
+ this.containsAlert = 'alert' in this.mapImp.featureFilterRanges();
2945
+ this.flatmapLegends = this.mapImp.flatmapLegend;
2946
+ this.loading = false;
2947
+ this.computePathControlsMaximumHeight();
2948
+ this.mapResize();
3004
2949
  this.handleMapClick();
3005
2950
  this.setInitMapState();
3006
2951
  if (this.displayMinimap) {
3007
2952
  const minimapOptions = { position: 'top-right' };
3008
2953
  this.mapImp.createMinimap(minimapOptions);
3009
- this.addResizeButtonToMinimap()
2954
+ this.addResizeButtonToMinimap();
3010
2955
  }
3011
2956
  /**
3012
2957
  * This is ``onFlatmapReady`` event.
3013
2958
  * @arg ``this`` (Component Vue Instance)
3014
2959
  */
3015
- this.$emit('ready', this)
2960
+ this.$emit('ready', this);
3016
2961
  },
3017
2962
  /**
3018
2963
  * @public
@@ -3022,7 +2967,7 @@ export default {
3022
2967
  handleMapClick: function () {
3023
2968
  const _map = this.mapImp.map;
3024
2969
  if (_map) {
3025
- _map.on('click', (e) => {
2970
+ _map.on('click', () => {
3026
2971
  if (!this.connectivityDataSource) {
3027
2972
  this.$emit('connectivity-info-close');
3028
2973
  }
@@ -3030,41 +2975,43 @@ export default {
3030
2975
  });
3031
2976
  }
3032
2977
  },
3033
- onContextLost: function() {
3034
- this.lastViewport = markRaw(this.mapImp.getState())
2978
+ onContextLost: function () {
2979
+ this.lastViewport = markRaw(this.mapImp.getState());
3035
2980
  this.flatmapError = {};
3036
- this.flatmapError['title'] = 'GL context lost!'
3037
- this.flatmapError['messages'] = [`A display issue has occurred due
2981
+ this.flatmapError['title'] = 'GL context lost!';
2982
+ this.flatmapError['messages'] = [
2983
+ `A display issue has occurred due
3038
2984
  to a limit on available WebGL contexts. You can restore the display
3039
2985
  using the Restore Context button. Please see the
3040
2986
  <a href="https://docs.sparc.science/docs/integrated-maps-viewer-overview#limit-on-available-webgl-contexts" target='_blank'>documentation</a>
3041
- for more details.`]
2987
+ for more details.`,
2988
+ ];
3042
2989
  this.flatmapError['button'] = {
3043
2990
  text: 'Restore Context',
3044
2991
  callback: () => {
3045
- this.forceContextRestore()
3046
- }
2992
+ this.forceContextRestore();
2993
+ },
3047
2994
  };
3048
2995
  },
3049
- onContextRestored: function() {
2996
+ onContextRestored: function () {
3050
2997
  if (this.mapImp) {
3051
- this.handleMapClick()
3052
- this.setInitMapState()
3053
- const lostState = this.getState()
2998
+ this.handleMapClick();
2999
+ this.setInitMapState();
3000
+ const lostState = this.getState();
3054
3001
  if (lostState) {
3055
- lostState.viewport = this.lastViewport
3002
+ lostState.viewport = this.lastViewport;
3056
3003
  }
3057
- this.restoreMapState(lostState)
3004
+ this.restoreMapState(lostState);
3058
3005
  if (this.displayMinimap) {
3059
3006
  const minimapOptions = { position: 'top-right' };
3060
3007
  this.mapImp.createMinimap(minimapOptions);
3061
- this.addResizeButtonToMinimap()
3008
+ this.addResizeButtonToMinimap();
3062
3009
  }
3063
3010
  if (this.filterToRestore) {
3064
- this.mapImp.setVisibilityFilter(this.filterToRestore)
3065
- this.filterToRestore = undefined
3011
+ this.mapImp.setVisibilityFilter(this.filterToRestore);
3012
+ this.filterToRestore = undefined;
3066
3013
  }
3067
- this.$emit('context-restored', this)
3014
+ this.$emit('context-restored', this);
3068
3015
  }
3069
3016
  },
3070
3017
  /**
@@ -3074,7 +3021,7 @@ export default {
3074
3021
  * @arg {Boolean} `flag`
3075
3022
  */
3076
3023
  showPathwaysDrawer: function (flag) {
3077
- this.drawerOpen = flag
3024
+ this.drawerOpen = flag;
3078
3025
  },
3079
3026
  /**
3080
3027
  * @public
@@ -3087,40 +3034,41 @@ export default {
3087
3034
  searchAndShowResult: function (term, displayInfo, mapclick = true) {
3088
3035
  if (this.mapImp) {
3089
3036
  if (term === undefined || term === '') {
3090
- this.mapImp.clearSearchResults()
3091
- if (this.viewingMode === "Exploration") {
3037
+ this.mapImp.clearSearchResults();
3038
+ if (this.viewingMode === 'Exploration') {
3092
3039
  this.$emit('connectivity-info-close');
3093
- } else if (this.viewingMode === "Annotation") {
3094
- this.manualAbortedOnClose()
3040
+ } else if (this.viewingMode === 'Annotation') {
3041
+ this.manualAbortedOnClose();
3095
3042
  }
3096
- this.searchTerm = ""
3097
- return true
3043
+ this.searchTerm = '';
3044
+ return true;
3098
3045
  } else {
3099
- const searchResults = this.mapImp.search(term)
3046
+ const searchResults = this.mapImp.search(term);
3100
3047
  if (searchResults?.results?.length) {
3101
- this.mapImp.showSearchResults(searchResults)
3048
+ this.mapImp.showSearchResults(searchResults);
3102
3049
  if (displayInfo) {
3103
3050
  let featureId = undefined;
3104
3051
  for (let i = 0; i < searchResults.results.length; i++) {
3105
- featureId = searchResults.results[i].featureId
3106
- const annotation = this.mapImp.annotation(featureId)
3052
+ featureId = searchResults.results[i].featureId;
3053
+ const annotation = this.mapImp.annotation(featureId);
3107
3054
  if (featureId && annotation?.label) break;
3108
3055
  }
3109
3056
  if (featureId) {
3110
- const feature = this.mapImp.featureProperties(featureId)
3057
+ const feature = this.mapImp.featureProperties(featureId);
3111
3058
  const data = {
3112
3059
  resource: [feature.models],
3113
3060
  feature: feature,
3114
3061
  label: feature.label,
3115
3062
  provenanceTaxonomy: feature.taxons,
3116
3063
  alert: normaliseAlertToStringArray(feature.alert),
3117
- }
3064
+ };
3118
3065
 
3119
3066
  // Show popup for all modes
3120
- this.checkAndCreatePopups([data], mapclick)
3067
+ this.checkAndCreatePopups([data], mapclick);
3121
3068
 
3122
3069
  // Check pathway fetures and set lastHoveredFeature for tooltip content replacement.
3123
- const isPathwayFeature = (feature.id.startsWith('ilxtr:') || feature.id.startsWith('ilx:'));
3070
+ const isPathwayFeature =
3071
+ feature.id.startsWith('ilxtr:') || feature.id.startsWith('ilx:');
3124
3072
  if (isPathwayFeature) {
3125
3073
  this.lastHoveredFeature = feature;
3126
3074
  this.lastHoveredFeature.mapUUID = this.mapImp.uuid;
@@ -3133,15 +3081,15 @@ export default {
3133
3081
  className: isPathwayFeature ? 'flatmap-tooltip-popup' : 'custom-popup',
3134
3082
  positionAtLastClick: false,
3135
3083
  preserveSelection: true,
3136
- })
3084
+ });
3137
3085
  }
3138
3086
  }
3139
- this.searchTerm = term
3140
- return true
3141
- } else this.mapImp.clearSearchResults()
3087
+ this.searchTerm = term;
3088
+ return true;
3089
+ } else this.mapImp.clearSearchResults();
3142
3090
  }
3143
3091
  }
3144
- return false
3092
+ return false;
3145
3093
  },
3146
3094
  /**
3147
3095
  * @public
@@ -3152,7 +3100,7 @@ export default {
3152
3100
  highlightConnectedPaths: function (paths) {
3153
3101
  if (paths.length) {
3154
3102
  // filter paths for this map
3155
- const filteredPaths = paths.filter(path => (path in this.mapImp.pathways.paths))
3103
+ const filteredPaths = paths.filter((path) => path in this.mapImp.pathways.paths);
3156
3104
  // this.zoomToFeatures is replaced with selectGeoJSONFeatures to highlight paths
3157
3105
  const featureIdsToHighlight = this.mapImp.modelFeatureIdList(filteredPaths);
3158
3106
  this.mapImp.selectGeoJSONFeatures(featureIdsToHighlight);
@@ -3165,11 +3113,11 @@ export default {
3165
3113
  * @arg {String} `term`
3166
3114
  */
3167
3115
  searchSuggestions: function (term) {
3168
- if (this.mapImp) return this.mapImp.search(term)
3169
- return []
3116
+ if (this.mapImp) return this.mapImp.search(term);
3117
+ return [];
3170
3118
  },
3171
3119
  onActionClick: function (data) {
3172
- EventBus.emit('onActionClick', data)
3120
+ EventBus.emit('onActionClick', data);
3173
3121
  },
3174
3122
  setConnectionType: function (type) {
3175
3123
  this.connectionType = type;
@@ -3287,7 +3235,7 @@ export default {
3287
3235
  * On default, `false`, clicking help will show all tooltips.
3288
3236
  * If `true`, clicking help will show the help-mode-dialog.
3289
3237
  */
3290
- helpModeDialog: {
3238
+ helpModeDialog: {
3291
3239
  type: Boolean,
3292
3240
  default: false,
3293
3241
  },
@@ -3364,7 +3312,7 @@ export default {
3364
3312
  display: 'Open 3D Human Map',
3365
3313
  key: '3D',
3366
3314
  },
3367
- ]
3315
+ ];
3368
3316
  },
3369
3317
  },
3370
3318
  /**
@@ -3421,7 +3369,7 @@ export default {
3421
3369
  /**
3422
3370
  * Flag to disable UIs on Map
3423
3371
  */
3424
- disableUI: {
3372
+ disableUI: {
3425
3373
  type: Boolean,
3426
3374
  default: false,
3427
3375
  },
@@ -3467,7 +3415,7 @@ export default {
3467
3415
  externalLegends: {
3468
3416
  type: Array,
3469
3417
  default: function () {
3470
- return []
3418
+ return [];
3471
3419
  },
3472
3420
  },
3473
3421
  /**
@@ -3487,7 +3435,7 @@ export default {
3487
3435
  flatmapAPI: this.flatmapAPI,
3488
3436
  sparcAPI: this.sparcAPI,
3489
3437
  userApiKey: this.userToken,
3490
- }
3438
+ };
3491
3439
  },
3492
3440
  data: function () {
3493
3441
  return {
@@ -3526,12 +3474,12 @@ export default {
3526
3474
  { value: false, ref: 'warningPopover' }, // 7
3527
3475
  { value: false, ref: 'whatsNewPopover' }, // 8
3528
3476
  { value: false, ref: 'featuredMarkerPopover' }, // 9
3529
- { value: false, refs: "toolbarPopover", ref: "editPopover" }, // 10
3530
- { value: false, refs: "toolbarPopover", ref: "deletePopover" }, // 11
3531
- { value: false, refs: "toolbarPopover", ref: "pointPopover" }, // 12
3532
- { value: false, refs: "toolbarPopover", ref: "lineStringPopover" }, // 13
3533
- { value: false, refs: "toolbarPopover", ref: "polygonPopover" }, // 14
3534
- { value: false, refs: "toolbarPopover", ref: "connectionPopover" }, // 15
3477
+ { value: false, refs: 'toolbarPopover', ref: 'editPopover' }, // 10
3478
+ { value: false, refs: 'toolbarPopover', ref: 'deletePopover' }, // 11
3479
+ { value: false, refs: 'toolbarPopover', ref: 'pointPopover' }, // 12
3480
+ { value: false, refs: 'toolbarPopover', ref: 'lineStringPopover' }, // 13
3481
+ { value: false, refs: 'toolbarPopover', ref: 'polygonPopover' }, // 14
3482
+ { value: false, refs: 'toolbarPopover', ref: 'connectionPopover' }, // 15
3535
3483
  ],
3536
3484
  helpModeActiveIndex: this.helpModeInitialIndex,
3537
3485
  yellowstar: yellowstar,
@@ -3556,9 +3504,11 @@ export default {
3556
3504
  currentHover: '',
3557
3505
  viewingMode: 'Exploration',
3558
3506
  viewingModes: {
3559
- 'Exploration': 'Find relevant research and view detail of neural pathways by selecting a pathway to view its connections and data sources',
3560
- 'Neuron Connection': 'Discover Neuron connections by selecting a neuron and viewing its associated network connections',
3561
- 'Annotation': ['View feature annotations', 'Add, comment on and view feature annotations']
3507
+ Exploration:
3508
+ 'Find relevant research and view detail of neural pathways by selecting a pathway to view its connections and data sources',
3509
+ 'Neuron Connection':
3510
+ 'Discover Neuron connections by selecting a neuron and viewing its associated network connections',
3511
+ Annotation: ['View feature annotations', 'Add, comment on and view feature annotations'],
3562
3512
  },
3563
3513
  connectionType: 'All',
3564
3514
  offlineAnnotationEnabled: false,
@@ -3567,15 +3517,7 @@ export default {
3567
3517
  annotatedSource: ['Anyone', 'Me', 'Others'],
3568
3518
  openMapRef: undefined,
3569
3519
  backgroundIconRef: undefined,
3570
- toolbarOptions: [
3571
- "Edit",
3572
- "Delete",
3573
- "Point",
3574
- "LineString",
3575
- "Polygon",
3576
- "Connection",
3577
- ],
3578
- annotator: undefined,
3520
+ toolbarOptions: ['Edit', 'Delete', 'Point', 'LineString', 'Polygon', 'Connection'],
3579
3521
  authorisedUser: undefined,
3580
3522
  activeDrawMode: undefined,
3581
3523
  activeDrawTool: undefined,
@@ -3605,49 +3547,44 @@ export default {
3605
3547
  alert: {
3606
3548
  with: true,
3607
3549
  without: true,
3608
- }
3550
+ },
3609
3551
  }),
3610
- searchTerm: "",
3552
+ searchTerm: '',
3611
3553
  taxonLeaveDelay: undefined,
3612
3554
  connectivityFilters: [],
3613
3555
  flatmapLegends: [],
3614
3556
  lastViewport: undefined,
3615
- }
3557
+ };
3616
3558
  },
3617
3559
  computed: {
3618
3560
  ...mapState(useMainStore, ['userToken']),
3619
3561
  isValidDrawnCreated: function () {
3620
- return Object.keys(this.drawnCreatedEvent).length > 0
3562
+ return Object.keys(this.drawnCreatedEvent).length > 0;
3621
3563
  },
3622
- requiresDrawer: function() {
3564
+ requiresDrawer: function () {
3623
3565
  if (this.loading) {
3624
- this.drawerOpen = false
3625
- return false
3566
+ return false;
3626
3567
  }
3627
- if ((this.systems?.length > 0) ||
3568
+ return (
3569
+ this.systems?.length > 0 ||
3628
3570
  (this.containsAlert && this.alertOptions) ||
3629
- (this.pathways?.length > 0) ||
3630
- (this.taxonConnectivity?.length > 0) ||
3631
- (this.legendEntry?.length > 0)
3632
- ) {
3633
- this.drawerOpen = true
3634
- return true
3635
- }
3636
- this.drawerOpen = false
3637
- return false
3571
+ this.pathways?.length > 0 ||
3572
+ this.taxonConnectivity?.length > 0 ||
3573
+ this.legendEntry?.length > 0
3574
+ );
3638
3575
  },
3639
3576
  modeDescription: function () {
3640
- let description = this.viewingModes[this.viewingMode]
3577
+ let description = this.viewingModes[this.viewingMode];
3641
3578
  if (this.viewingMode === 'Annotation') {
3642
3579
  if (this.authorisedUser) {
3643
- return description[1]
3580
+ return description[1];
3644
3581
  }
3645
- return description[0]
3582
+ return description[0];
3646
3583
  }
3647
- return description
3584
+ return description;
3648
3585
  },
3649
3586
  legendEntry: function () {
3650
- return [...this.flatmapLegends, ...this.externalLegends]
3587
+ return [...this.flatmapLegends, ...this.externalLegends];
3651
3588
  },
3652
3589
  showDatasetMarkerTooltip: function () {
3653
3590
  return this.hoverVisibilities[9].value;
@@ -3655,11 +3592,17 @@ export default {
3655
3592
  },
3656
3593
  watch: {
3657
3594
  entry: function () {
3658
- if (!this.state) this.createFlatmap()
3595
+ if (!this.state) this.createFlatmap();
3596
+ },
3597
+ requiresDrawer: {
3598
+ handler: function (value) {
3599
+ this.drawerOpen = value;
3600
+ },
3601
+ immediate: true,
3659
3602
  },
3660
3603
  helpMode: function (newVal, oldVal) {
3661
3604
  if (newVal !== oldVal) {
3662
- this.setHelpMode(newVal)
3605
+ this.setHelpMode(newVal);
3663
3606
  }
3664
3607
  },
3665
3608
  helpModeActiveItem: function () {
@@ -3670,12 +3613,12 @@ export default {
3670
3613
  this.setHelpMode(this.helpMode);
3671
3614
  }
3672
3615
  },
3673
- render: function(val) {
3616
+ render: function (val) {
3674
3617
  if (val) {
3675
3618
  if (this.mapImp && this.mapImp.contextLost && !this.loading) {
3676
3619
  this.$nextTick(() => {
3677
- this.forceContextRestore()
3678
- })
3620
+ this.forceContextRestore();
3621
+ });
3679
3622
  }
3680
3623
  }
3681
3624
  },
@@ -3683,10 +3626,10 @@ export default {
3683
3626
  handler: function (state, oldVal) {
3684
3627
  if (state !== oldVal) {
3685
3628
  if (this.mapManagerRef) {
3686
- this.setState(state)
3629
+ this.setState(state);
3687
3630
  } else {
3688
3631
  //this component has not been mounted yet
3689
- this.setStateRequired = true
3632
+ this.setStateRequired = true;
3690
3633
  }
3691
3634
  }
3692
3635
  },
@@ -3694,27 +3637,27 @@ export default {
3694
3637
  deep: true,
3695
3638
  },
3696
3639
  viewingMode: function (mode) {
3697
- this.clearAnnotationFeature()
3640
+ this.clearAnnotationFeature();
3698
3641
  if (mode === 'Annotation') {
3699
- this.loading = true
3642
+ this.loading = true;
3700
3643
  this.annotator.authenticate(this.userToken).then((userData) => {
3701
3644
  if (userData.name && userData.email && userData.canUpdate) {
3702
- this.authorisedUser = userData
3703
- this.offlineAnnotationEnabled = false
3645
+ this.authorisedUser = userData;
3646
+ this.offlineAnnotationEnabled = false;
3704
3647
  } else {
3705
- this.authorisedUser = undefined
3706
- this.offlineAnnotationEnabled = true
3648
+ this.authorisedUser = undefined;
3649
+ this.offlineAnnotationEnabled = true;
3707
3650
  }
3708
3651
  this.emitOfflineAnnotationUpdate();
3709
- this.setFeatureAnnotated()
3710
- this.addAnnotationFeature()
3711
- this.loading = false
3712
- })
3652
+ this.setFeatureAnnotated();
3653
+ this.addAnnotationFeature();
3654
+ this.loading = false;
3655
+ });
3713
3656
  }
3714
3657
  },
3715
3658
  disableUI: function (isUIDisabled) {
3716
3659
  if (isUIDisabled) {
3717
- this.closeTooltip()
3660
+ this.closeTooltip();
3718
3661
  }
3719
3662
  },
3720
3663
  activeDrawTool: function (tool) {
@@ -3754,13 +3697,15 @@ export default {
3754
3697
  canvas.addEventListener('keydown', handleKeyboardEvent);
3755
3698
  canvas.addEventListener('click', handleMouseEvent);
3756
3699
  }
3757
- }
3700
+ },
3758
3701
  },
3759
3702
  created: function () {
3760
3703
  if (this.mapManager) {
3761
3704
  this.mapManagerRef = this.mapManager;
3762
3705
  } else {
3763
- this.mapManagerRef = markRaw(new flatmap.MapViewer(this.flatmapAPI, { container: undefined }));
3706
+ this.mapManagerRef = markRaw(
3707
+ new flatmap.MapViewer(this.flatmapAPI, { container: undefined }),
3708
+ );
3764
3709
  /**
3765
3710
  * The event emitted after a new mapManager is loaded.
3766
3711
  * This mapManager can be used to create new flatmaps.
@@ -3769,18 +3714,18 @@ export default {
3769
3714
  }
3770
3715
  },
3771
3716
  mounted: function () {
3772
- this.openMapRef = shallowRef(this.$refs.openMapRef)
3773
- this.backgroundIconRef = shallowRef(this.$refs.backgroundIconRef)
3774
- this.tooltipWait.length = this.hoverVisibilities.length
3775
- this.flatmapQueries = markRaw(new FlatmapQueries())
3776
- this.flatmapQueries.initialise(this.flatmapAPI)
3717
+ this.openMapRef = shallowRef(this.$refs.openMapRef);
3718
+ this.backgroundIconRef = shallowRef(this.$refs.backgroundIconRef);
3719
+ this.tooltipWait.length = this.hoverVisibilities.length;
3720
+ this.flatmapQueries = markRaw(new FlatmapQueries());
3721
+ this.flatmapQueries.initialise(this.flatmapAPI);
3777
3722
  if (this.state) {
3778
3723
  //State is set and require to set the state
3779
3724
  if (this.setStateRequired) {
3780
- this.setState(this.state)
3725
+ this.setState(this.state);
3781
3726
  }
3782
3727
  } else if (this.renderAtMounted) {
3783
- this.createFlatmap()
3728
+ this.createFlatmap();
3784
3729
  }
3785
3730
  refreshFlatmapKnowledgeCache();
3786
3731
 
@@ -3805,11 +3750,10 @@ export default {
3805
3750
  this.tooltipObserver = null;
3806
3751
  }
3807
3752
  },
3808
- }
3753
+ };
3809
3754
  </script>
3810
3755
 
3811
3756
  <style lang="scss" scoped>
3812
-
3813
3757
  .beta-popovers {
3814
3758
  position: absolute;
3815
3759
  top: 90px;
@@ -4118,7 +4062,7 @@ export default {
4118
4062
  }
4119
4063
  }
4120
4064
 
4121
- :deep(.flatmap-marker-popup){
4065
+ :deep(.flatmap-marker-popup) {
4122
4066
  .maplibregl-popup-content {
4123
4067
  padding: 0px;
4124
4068
  }
@@ -4143,7 +4087,9 @@ export default {
4143
4087
  }
4144
4088
  }
4145
4089
 
4146
- .zoomIn, .zoomOut, .fitWindow {
4090
+ .zoomIn,
4091
+ .zoomOut,
4092
+ .fitWindow {
4147
4093
  padding: 4px;
4148
4094
  }
4149
4095
 
@@ -4258,7 +4204,7 @@ export default {
4258
4204
  color: $app-primary-color;
4259
4205
 
4260
4206
  &.open-map-button {
4261
- margin-bottom:4px;
4207
+ margin-bottom: 4px;
4262
4208
  }
4263
4209
 
4264
4210
  &:hover {
@@ -4382,7 +4328,7 @@ export default {
4382
4328
  position: relative;
4383
4329
 
4384
4330
  &::before {
4385
- content: "";
4331
+ content: '';
4386
4332
  display: block;
4387
4333
  width: 0;
4388
4334
  height: 0;
@@ -4511,7 +4457,7 @@ export default {
4511
4457
  background-color: var(--white);
4512
4458
  font-weight: 500;
4513
4459
  color: rgb(48, 49, 51);
4514
- width: 150px!important;
4460
+ width: 150px !important;
4515
4461
  }
4516
4462
 
4517
4463
  :deep(.flatmap_dropdown) {
@@ -4535,11 +4481,10 @@ export default {
4535
4481
  </style>
4536
4482
 
4537
4483
  <style lang="scss">
4538
-
4539
4484
  .flatmap-container {
4540
- --el-color-primary: #8300BF;
4541
- --el-color-primary-light-5: #CD99E5;
4542
- --el-color-primary-light-9: #F3E6F9;
4485
+ --el-color-primary: #8300bf;
4486
+ --el-color-primary-light-5: #cd99e5;
4487
+ --el-color-primary-light-9: #f3e6f9;
4543
4488
  --el-color-primary-dark-2: var(--el-color-primary);
4544
4489
  }
4545
4490
 
@@ -4579,7 +4524,7 @@ export default {
4579
4524
  background: #e0e0e0;
4580
4525
  padding: 2px 4px;
4581
4526
  border-radius: 4px;
4582
- font-size: .75rem !important;
4527
+ font-size: 0.75rem !important;
4583
4528
  letter-spacing: 1.05px;
4584
4529
  }
4585
4530
  </style>