@abi-software/flatmapvuer 1.17.0 → 1.17.1-demo.1

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