@abi-software/flatmapvuer 1.6.2 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/flatmapvuer",
3
- "version": "1.6.2",
3
+ "version": "1.7.0",
4
4
  "license": "Apache-2.0",
5
5
  "files": [
6
6
  "dist/*",
@@ -43,8 +43,8 @@
43
43
  "./src/*": "./src/*"
44
44
  },
45
45
  "dependencies": {
46
- "@abi-software/flatmap-viewer": "^3.2.10",
47
- "@abi-software/map-utilities": "^1.2.1",
46
+ "@abi-software/flatmap-viewer": "3.2.10",
47
+ "@abi-software/map-utilities": "^1.3.0",
48
48
  "@abi-software/sparc-annotation": "0.3.2",
49
49
  "@abi-software/svg-sprite": "^1.0.1",
50
50
  "@element-plus/icons-vue": "^2.3.1",
@@ -152,7 +152,6 @@ Please use `const` to assign meaningful names to them...
152
152
  class: '.maplibregl-canvas',
153
153
  }"
154
154
  :toolbarOptions="toolbarOptions"
155
- :drawnType="drawnType"
156
155
  :activeDrawTool="activeDrawTool"
157
156
  :activeDrawMode="activeDrawMode"
158
157
  :newlyDrawnEntry="drawnCreatedEvent"
@@ -260,7 +259,7 @@ Please use `const` to assign meaningful names to them...
260
259
  <div
261
260
  class="pathway-location"
262
261
  :class="{ open: drawerOpen, close: !drawerOpen }"
263
- v-show="!disableUI"
262
+ v-show="!disableUI && requiresDrawer"
264
263
  >
265
264
  <div
266
265
  class="pathway-container"
@@ -270,27 +269,27 @@ Please use `const` to assign meaningful names to them...
270
269
  >
271
270
  <svg-legends v-if="!isFC" class="svg-legends-container" />
272
271
  <template v-if="showStarInLegend">
273
- <el-popover
274
- content="Location of the featured dataset"
275
- placement="right"
276
- :teleported="true"
277
- trigger="manual"
278
- width="max-content"
279
- :offset="-10"
280
- popper-class="flatmap-popper flatmap-teleport-popper"
281
- :visible="hoverVisibilities[9].value"
282
- ref="featuredMarkerPopover"
283
- >
284
- <template #reference>
285
- <div
286
- v-popover:featuredMarkerPopover
287
- class="yellow-star-legend"
288
- v-html="yellowstar"
289
- @mouseover="showTooltip(9)"
290
- @mouseout="hideTooltip(9)"
291
- ></div>
292
- </template>
293
- </el-popover>
272
+ <el-popover
273
+ content="Location of the featured dataset"
274
+ placement="right"
275
+ :teleported="true"
276
+ trigger="manual"
277
+ width="max-content"
278
+ :offset="-10"
279
+ popper-class="flatmap-popper flatmap-teleport-popper"
280
+ :visible="hoverVisibilities[9].value"
281
+ ref="featuredMarkerPopover"
282
+ >
283
+ <template #reference>
284
+ <div
285
+ v-popover:featuredMarkerPopover
286
+ class="yellow-star-legend"
287
+ v-html="yellowstar"
288
+ @mouseover="showTooltip(9)"
289
+ @mouseout="hideTooltip(9)"
290
+ ></div>
291
+ </template>
292
+ </el-popover>
294
293
  </template>
295
294
  <!-- The line below places the yellowstar svg on the left, and the text "Featured markers on the right" with css so they are both centered in the div -->
296
295
  <el-popover
@@ -454,44 +453,22 @@ Please use `const` to assign meaningful names to them...
454
453
  </template>
455
454
  </div>
456
455
  <el-row class="viewing-mode-description">
457
- {{ viewingModes[viewingMode] }}
456
+ {{ modeDescription }}
458
457
  </el-row>
459
458
  </el-row>
460
459
  <template v-if="viewingMode === 'Annotation' && userInformation">
461
- <el-row class="backgroundText">Drawn By*</el-row>
462
- <el-row class="backgroundControl">
463
- <el-select
464
- :teleported="false"
465
- v-model="drawnType"
466
- placeholder="Select"
467
- class="select-box"
468
- popper-class="flatmap_dropdown"
469
- @change="setDrawnType"
470
- >
471
- <el-option
472
- v-for="item in drawnTypes"
473
- :key="item"
474
- :label="item"
475
- :value="item"
476
- >
477
- <el-row>
478
- <el-col :span="12">{{ item }}</el-col>
479
- </el-row>
480
- </el-option>
481
- </el-select>
482
- </el-row>
483
- <el-row class="backgroundText">Annotated By*</el-row>
460
+ <el-row class="backgroundText">Annotations From</el-row>
484
461
  <el-row class="backgroundControl">
485
462
  <el-select
486
463
  :teleported="false"
487
- v-model="annotatedType"
464
+ v-model="annotationFrom"
488
465
  placeholder="Select"
489
466
  class="select-box"
490
467
  popper-class="flatmap_dropdown"
491
- @change="setAnnotatedType"
468
+ @change="setAnnotationFrom"
492
469
  >
493
470
  <el-option
494
- v-for="item in annotatedTypes"
471
+ v-for="item in annotatedSource"
495
472
  :key="item"
496
473
  :label="item"
497
474
  :value="item"
@@ -614,7 +591,7 @@ Please use `const` to assign meaningful names to them...
614
591
  <Tooltip
615
592
  ref="tooltip"
616
593
  class="tooltip"
617
- v-show="tooltipDisplay"
594
+ v-if="tooltipDisplay"
618
595
  :annotationEntry="annotationEntry"
619
596
  :tooltipEntry="tooltipEntry"
620
597
  :annotationDisplay="viewingMode === 'Annotation'"
@@ -668,20 +645,24 @@ const centroid = (geometry) => {
668
645
  let featureGeometry = { lng: 0, lat: 0, }
669
646
  let coordinates
670
647
  if (geometry.type === "Polygon") {
671
- coordinates = geometry.coordinates[0]
648
+ if (geometry.coordinates.length) {
649
+ coordinates = geometry.coordinates[0]
650
+ }
672
651
  } else {
673
652
  coordinates = geometry.coordinates
674
653
  }
675
- if (!(geometry.type === 'Point')) {
676
- coordinates.map((coor) => {
677
- featureGeometry.lng += parseFloat(coor[0])
678
- featureGeometry.lat += parseFloat(coor[1])
679
- })
680
- featureGeometry.lng = featureGeometry.lng / coordinates.length
681
- featureGeometry.lat = featureGeometry.lat / coordinates.length
682
- } else {
683
- featureGeometry.lng += parseFloat(coordinates[0])
684
- featureGeometry.lat += parseFloat(coordinates[1])
654
+ if (coordinates) {
655
+ if (!(geometry.type === 'Point')) {
656
+ coordinates.map((coor) => {
657
+ featureGeometry.lng += parseFloat(coor[0])
658
+ featureGeometry.lat += parseFloat(coor[1])
659
+ })
660
+ featureGeometry.lng = featureGeometry.lng / coordinates.length
661
+ featureGeometry.lat = featureGeometry.lat / coordinates.length
662
+ } else {
663
+ featureGeometry.lng += parseFloat(coordinates[0])
664
+ featureGeometry.lat += parseFloat(coordinates[1])
665
+ }
685
666
  }
686
667
  return featureGeometry
687
668
  }
@@ -773,6 +754,7 @@ export default {
773
754
  if (this.annotationSidebar) this.$emit("annotation-close")
774
755
  this.closeTooltip()
775
756
  this.annotationEventCallback({}, { type: 'aborted' })
757
+ this.initialiseDrawing()
776
758
  },
777
759
  /**
778
760
  * @public
@@ -848,21 +830,19 @@ export default {
848
830
  * @arg {String} `name`
849
831
  */
850
832
  toolbarEvent: function (type, name) {
833
+ if (this.isValidDrawnCreated) return;
851
834
  this.manualAbortedOnClose()
852
835
  this.doubleClickedFeature = false
853
- this.connectionEntry = {}
836
+ // Deselect any feature when draw mode/tool is changed
837
+ this.changeAnnotationDrawMode({ mode: 'simple_select' })
854
838
  if (type === 'mode') {
855
- // Deselect any feature when draw mode is changed
856
- this.changeAnnotationDrawMode({ mode: 'simple_select' })
857
839
  this.activeDrawMode = name
858
840
  } else if (type === 'tool') {
841
+ // Remove any unsubmitted drawn
842
+ this.cancelDrawnFeature()
859
843
  if (name) {
860
844
  const tool = name.replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`)
861
845
  this.changeAnnotationDrawMode({ mode: `draw${tool}` })
862
- this.initialiseDrawing()
863
- } else {
864
- this.changeAnnotationDrawMode({ mode: 'simple_select' })
865
- this.cancelDrawnFeature()
866
846
  }
867
847
  this.activeDrawTool = name
868
848
  }
@@ -885,8 +865,7 @@ export default {
885
865
  }
886
866
  this.doubleClickedFeature = false
887
867
  }
888
- }
889
- if (this.activeDrawMode === 'Delete') {
868
+ } else if (this.activeDrawMode === 'Delete') {
890
869
  this.changeAnnotationDrawMode({
891
870
  mode: 'simple_select',
892
871
  options: { featureIds: [data.feature.feature.id] }
@@ -972,9 +951,12 @@ export default {
972
951
  ) {
973
952
  this.featureAnnotationSubmitted = true
974
953
  this.mapImp.commitAnnotationEvent(this.annotationEntry)
975
- if (this.annotationEntry.type === 'deleted') {
954
+ if (annotation.body.comment === "Position Updated") {
955
+ this.annotationEntry.positionUpdated = false
956
+ } else if (this.annotationEntry.type === 'deleted') {
976
957
  if (this.annotationSidebar) this.$emit("annotation-close")
977
958
  this.closeTooltip()
959
+ // Only delete need, keep the annotation tooltip/sidebar open if created/updated
978
960
  this.annotationEntry = {}
979
961
  }
980
962
  this.addAnnotationFeature()
@@ -1015,12 +997,6 @@ export default {
1015
997
  let drawnFeatures = await this.annotator.drawnFeatures(this.userToken, this.serverURL, annotatedItemIds)
1016
998
  // The annotator has `resource` and `features` fields
1017
999
  if ('resource' in drawnFeatures) drawnFeatures = drawnFeatures.features
1018
- // Use to switch the displayed feature type
1019
- if (this.drawnType !== 'All tools') {
1020
- drawnFeatures = drawnFeatures.filter((feature) => {
1021
- return feature.geometry.type === this.drawnType
1022
- })
1023
- }
1024
1000
  return drawnFeatures
1025
1001
  },
1026
1002
  /**
@@ -1029,22 +1005,22 @@ export default {
1029
1005
  */
1030
1006
  addAnnotationFeature: async function () {
1031
1007
  if (this.mapImp) {
1032
- if (!this.featureAnnotationSubmitted) this.clearAnnotationFeature()
1033
- if (this.drawnType !== 'None') {
1034
- if (!this.featureAnnotationSubmitted) this.loading = true
1035
- const userId = this.annotatedType === 'Anyone' ?
1036
- undefined : this.userInformation.orcid ?
1037
- this.userInformation.orcid : '0000-0000-0000-0000'
1038
- const participated = this.annotatedType === 'Anyone' ?
1039
- undefined : this.annotatedType === 'Me' ?
1040
- true : false
1041
- const drawnFeatures = await this.fetchDrawnFeatures(userId, participated)
1042
- this.existDrawnFeatures = drawnFeatures
1043
- this.loading = false
1044
- if (!this.featureAnnotationSubmitted) {
1045
- for (const feature of drawnFeatures) {
1046
- this.mapImp.addAnnotationFeature(feature)
1047
- }
1008
+ if (!this.featureAnnotationSubmitted) {
1009
+ this.clearAnnotationFeature()
1010
+ this.loading = true
1011
+ }
1012
+ const userId = this.annotationFrom === 'Anyone' ?
1013
+ undefined : this.userInformation.orcid ?
1014
+ this.userInformation.orcid : '0000-0000-0000-0000'
1015
+ const participated = this.annotationFrom === 'Anyone' ?
1016
+ undefined : this.annotationFrom === 'Me' ?
1017
+ true : false
1018
+ const drawnFeatures = await this.fetchDrawnFeatures(userId, participated)
1019
+ this.existDrawnFeatures = drawnFeatures
1020
+ this.loading = false
1021
+ if (!this.featureAnnotationSubmitted) {
1022
+ for (const feature of drawnFeatures) {
1023
+ this.mapImp.addAnnotationFeature(feature)
1048
1024
  }
1049
1025
  }
1050
1026
  }
@@ -1062,26 +1038,13 @@ export default {
1062
1038
  this.$el.querySelector('.maplibregl-ctrl-group').style.display = 'none'
1063
1039
  }
1064
1040
  },
1065
- /**
1066
- * @public
1067
- * Function to switch the type of annotation.
1068
- * @arg {Boolean} `flag`
1069
- */
1070
- setDrawnType: function (flag) {
1071
- this.drawnType = flag
1072
- if (this.mapImp) {
1073
- this.manualAbortedOnClose()
1074
- this.addAnnotationFeature()
1075
- this.initialiseDrawing()
1076
- }
1077
- },
1078
1041
  /**
1079
1042
  * @public
1080
1043
  * Function to switch the type of person who annotated.
1081
1044
  * @arg {Boolean} `flag`
1082
1045
  */
1083
- setAnnotatedType: function (flag) {
1084
- this.annotatedType = flag
1046
+ setAnnotationFrom: function (flag) {
1047
+ this.annotationFrom = flag
1085
1048
  if (this.mapImp) {
1086
1049
  this.manualAbortedOnClose()
1087
1050
  this.addAnnotationFeature()
@@ -1589,7 +1552,7 @@ export default {
1589
1552
  this.annotationEntry = {}
1590
1553
  } else if (data.type === 'modeChanged') {
1591
1554
  if (data.feature.mode === 'direct_select') this.doubleClickedFeature = true
1592
- if (this.annotationSidebar && data.feature.mode === 'simple_select') {
1555
+ if (this.annotationSidebar && data.feature.mode === 'simple_select' && this.activeDrawMode === 'Deleted') {
1593
1556
  this.annotationEventCallback({}, { type: 'aborted' })
1594
1557
  }
1595
1558
  } else if (data.type === 'selectionChanged') {
@@ -1607,6 +1570,15 @@ export default {
1607
1570
  this.connectionEntry = drawnFeature.connection
1608
1571
  }
1609
1572
  this.annotationDrawModeEvent(payload)
1573
+ } else {
1574
+ if (this.annotationSidebar && this.previousEditEvent.type === 'updated') {
1575
+ this.annotationEntry = {
1576
+ ...this.previousEditEvent,
1577
+ resourceId: this.serverURL
1578
+ }
1579
+ this.annotationEventCallback({}, { type: 'aborted' })
1580
+ }
1581
+ this.previousEditEvent = {}
1610
1582
  }
1611
1583
  }
1612
1584
  } else {
@@ -1624,6 +1596,7 @@ export default {
1624
1596
  if (data.type === 'created') this.drawnCreatedEvent = payload
1625
1597
  else this.checkAndCreatePopups(payload)
1626
1598
  }
1599
+ if (data.type === 'updated') this.previousEditEvent = data
1627
1600
  if (data.type === 'deleted') this.previousDeletedEvent = data
1628
1601
  else this.previousDeletedEvent = {}
1629
1602
  },
@@ -1835,7 +1808,7 @@ export default {
1835
1808
  }
1836
1809
 
1837
1810
  // highlight all available features
1838
- this.mapImp.zoomToFeatures(featuresToHighlight, { noZoomIn: true });
1811
+ this.mapImp.selectFeatures(featuresToHighlight);
1839
1812
  }
1840
1813
  },
1841
1814
  emitConnectivityGraphError: function (errorData) {
@@ -1870,12 +1843,8 @@ export default {
1870
1843
  if (data.feature.featureId && data.feature.models) {
1871
1844
  this.displayTooltip(data.feature.models)
1872
1845
  } else if (data.feature.feature) {
1873
- // in drawing or edit/delete mode is on or has connectivity
1874
- if (
1875
- this.activeDrawTool ||
1876
- this.activeDrawMode ||
1877
- Object.keys(this.connectionEntry).length > 0
1878
- ) {
1846
+ // in drawing or edit/delete mode is on or valid drawn
1847
+ if (this.activeDrawTool || this.activeDrawMode || this.isValidDrawnCreated) {
1879
1848
  this.featureAnnotationSubmitted = false
1880
1849
  this.annotationEntry.featureId = data.feature.feature.id
1881
1850
  if (this.activeDrawTool) {
@@ -1932,7 +1901,9 @@ export default {
1932
1901
  * Function to close tooltip.
1933
1902
  */
1934
1903
  closeTooltip: function () {
1935
- this.$refs.tooltip.$el.style.display = 'none'
1904
+ if (this.$refs.tooltip) {
1905
+ this.$refs.tooltip.$el.style.display = 'none'
1906
+ }
1936
1907
  document.querySelectorAll('.maplibregl-popup').forEach((item) => {
1937
1908
  item.style.display = 'none'
1938
1909
  })
@@ -2042,7 +2013,11 @@ export default {
2042
2013
  isPathwayContainer(parentElement) ||
2043
2014
  isPathwayContainer(nextElementSibling)
2044
2015
  ) {
2045
- this.drawerOpen = true;
2016
+ if (this.requiresDrawer) {
2017
+ this.drawerOpen = true;
2018
+ } else {
2019
+ this.helpModeActiveIndex += 1;
2020
+ }
2046
2021
  }
2047
2022
  } else {
2048
2023
  // skip the unavailable tooltips
@@ -2174,8 +2149,7 @@ export default {
2174
2149
  !this.disableUI && (
2175
2150
  (
2176
2151
  this.viewingMode === 'Annotation' &&
2177
- !this.annotationSidebar &&
2178
- this.userInformation
2152
+ !this.annotationSidebar
2179
2153
  ) ||
2180
2154
  (
2181
2155
  this.viewingMode === 'Exploration' &&
@@ -2189,7 +2163,6 @@ export default {
2189
2163
  this.mapImp.showPopup(featureId, this.$refs.tooltip.$el, options);
2190
2164
  this.popUpCssHacks();
2191
2165
  });
2192
-
2193
2166
  }
2194
2167
  },
2195
2168
  hasTooltipEntry: function () {
@@ -2483,7 +2456,7 @@ export default {
2483
2456
  }
2484
2457
  }
2485
2458
 
2486
- let promise1 = this.mapManager.loadMap(
2459
+ let promise1 = this.mapManagerRef.loadMap(
2487
2460
  identifier,
2488
2461
  this.$refs.display,
2489
2462
  this.eventCallback(),
@@ -2510,8 +2483,9 @@ export default {
2510
2483
  this._stateToBeSet = {
2511
2484
  ...state
2512
2485
  }
2513
- if (this.mapImp && !this.loading)
2486
+ if (this.mapImp && !this.loading) {
2514
2487
  this.restoreMapState(this._stateToBeSet)
2488
+ }
2515
2489
  }
2516
2490
  },
2517
2491
  /**
@@ -2568,7 +2542,6 @@ export default {
2568
2542
  this.addResizeButtonToMinimap()
2569
2543
  this.loading = false
2570
2544
  this.computePathControlsMaximumHeight()
2571
- this.drawerOpen = true;
2572
2545
  this.mapResize()
2573
2546
  this.handleMapClick();
2574
2547
  this.setInitMapState();
@@ -2642,21 +2615,25 @@ export default {
2642
2615
  this.mapImp.showSearchResults(searchResults)
2643
2616
  if (
2644
2617
  displayLabel &&
2645
- searchResults.results[0].featureId &&
2646
- searchResults.results[0].text
2618
+ searchResults.results
2647
2619
  ) {
2648
- const annotation = this.mapImp.annotation(
2649
- searchResults.results[0].featureId
2650
- )
2651
- this.mapImp.showPopup(
2652
- searchResults.results[0].featureId,
2653
- annotation.label,
2654
- {
2655
- className: 'custom-popup',
2656
- positionAtLastClick: false,
2657
- preserveSelection: true,
2658
- }
2659
- )
2620
+ let annotation = undefined;
2621
+ let featureId = undefined;
2622
+ for (let i = 0; i < searchResults.results.length && !(annotation?.label); i++) {
2623
+ featureId = searchResults.results[i].featureId
2624
+ annotation = this.mapImp.annotation(featureId)
2625
+ }
2626
+ if (annotation?.label) {
2627
+ this.mapImp.showPopup(
2628
+ featureId,
2629
+ capitalise(annotation.label),
2630
+ {
2631
+ className: 'custom-popup',
2632
+ positionAtLastClick: false,
2633
+ preserveSelection: true,
2634
+ }
2635
+ )
2636
+ }
2660
2637
  }
2661
2638
  return true
2662
2639
  } else this.mapImp.clearSearchResults()
@@ -2831,6 +2808,14 @@ export default {
2831
2808
  type: Object,
2832
2809
  default: undefined,
2833
2810
  },
2811
+ /**
2812
+ * Flatmap's Map Manager to use as single Map Manager
2813
+ * if the FlatmapVuer is loaded from MultiFlatmapVuer.
2814
+ */
2815
+ mapManager: {
2816
+ type: Object,
2817
+ default: undefined,
2818
+ },
2834
2819
  /**
2835
2820
  * Specify the endpoint of the flatmap server.
2836
2821
  */
@@ -2878,7 +2863,7 @@ export default {
2878
2863
  data: function () {
2879
2864
  return {
2880
2865
  sensor: null,
2881
- mapManager: undefined,
2866
+ mapManagerRef: undefined,
2882
2867
  flatmapQueries: undefined,
2883
2868
  annotationEntry: {},
2884
2869
  //tooltip display has to be set to false until it is rendered
@@ -2942,12 +2927,10 @@ export default {
2942
2927
  viewingModes: {
2943
2928
  'Exploration': 'Find relevant research and view detail of neural pathways by selecting a pathway to view its connections and data sources',
2944
2929
  'Neuron Connection': 'Discover Neuron connections by selecting a neuron and viewing its associated network connections',
2945
- 'Annotation': 'View internal identifiers of features'
2930
+ 'Annotation': ['View feature annotations', 'Add, comment on and view feature annotations']
2946
2931
  },
2947
- drawnType: 'All tools',
2948
- drawnTypes: ['All tools', 'Point', 'LineString', 'Polygon', 'None'],
2949
- annotatedType: 'Anyone',
2950
- annotatedTypes: ['Anyone', 'Me', 'Others'],
2932
+ annotationFrom: 'Anyone',
2933
+ annotatedSource: ['Anyone', 'Me', 'Others'],
2951
2934
  openMapRef: undefined,
2952
2935
  backgroundIconRef: undefined,
2953
2936
  toolbarOptions: [
@@ -2964,6 +2947,7 @@ export default {
2964
2947
  activeDrawTool: undefined,
2965
2948
  featureAnnotationSubmitted: false,
2966
2949
  drawnCreatedEvent: {},
2950
+ previousEditEvent: {},
2967
2951
  previousDeletedEvent: {},
2968
2952
  connectionEntry: {},
2969
2953
  existDrawnFeatures: [], // Store all exist drawn features
@@ -2998,6 +2982,37 @@ export default {
2998
2982
  isValidDrawnCreated: function () {
2999
2983
  return Object.keys(this.drawnCreatedEvent).length > 0
3000
2984
  },
2985
+ requiresDrawer: function() {
2986
+ if (this.loading) {
2987
+ this.drawerOpen = false
2988
+ return false
2989
+ }
2990
+ if (!this.isFC) {
2991
+ this.drawerOpen = true
2992
+ return true
2993
+ } else {
2994
+ if ((this.systems?.length > 0) ||
2995
+ (this.containsAlert && this.alertOptions) ||
2996
+ (this.pathways?.length > 0) ||
2997
+ (this.taxonConnectivity?.length > 0)
2998
+ ) {
2999
+ this.drawerOpen = true
3000
+ return true
3001
+ }
3002
+ }
3003
+ this.drawerOpen = false
3004
+ return true
3005
+ },
3006
+ modeDescription: function () {
3007
+ let description = this.viewingModes[this.viewingMode]
3008
+ if (this.viewingMode === 'Annotation') {
3009
+ if (this.userInformation) {
3010
+ return description[1]
3011
+ }
3012
+ return description[0]
3013
+ }
3014
+ return description
3015
+ },
3001
3016
  },
3002
3017
  watch: {
3003
3018
  entry: function () {
@@ -3019,7 +3034,7 @@ export default {
3019
3034
  state: {
3020
3035
  handler: function (state, oldVal) {
3021
3036
  if (state !== oldVal) {
3022
- if (this.mapManager) {
3037
+ if (this.mapManagerRef) {
3023
3038
  this.setState(state)
3024
3039
  } else {
3025
3040
  //this component has not been mounted yet
@@ -3088,11 +3103,22 @@ export default {
3088
3103
  }
3089
3104
  }
3090
3105
  },
3106
+ created: function () {
3107
+ if (this.mapManager) {
3108
+ this.mapManagerRef = this.mapManager;
3109
+ } else {
3110
+ this.mapManagerRef = markRaw(new flatmap.MapManager(this.flatmapAPI));
3111
+ /**
3112
+ * The event emitted after a new mapManager is loaded.
3113
+ * This mapManager can be used to create new flatmaps.
3114
+ */
3115
+ this.$emit('mapmanager-loaded', this.mapManagerRef);
3116
+ }
3117
+ },
3091
3118
  mounted: function () {
3092
3119
  this.openMapRef = shallowRef(this.$refs.openMapRef)
3093
3120
  this.backgroundIconRef = shallowRef(this.$refs.backgroundIconRef)
3094
3121
  this.tooltipWait.length = this.hoverVisibilities.length
3095
- this.mapManager = markRaw(new flatmap.MapManager(this.flatmapAPI))
3096
3122
  this.flatmapQueries = markRaw(new FlatmapQueries())
3097
3123
  this.flatmapQueries.initialise(this.flatmapAPI)
3098
3124
  if (this.state) {
@@ -3189,6 +3215,7 @@ export default {
3189
3215
 
3190
3216
  .svg-legends-container {
3191
3217
  width: 70%;
3218
+ min-width:183px;
3192
3219
  height: auto;
3193
3220
  position: relative;
3194
3221
  max-height: 140px;