@abi-software/flatmapvuer 1.20.1-demo.2 → 1.21.1-demo.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.
@@ -21,7 +21,7 @@
21
21
  order: 1,
22
22
  title: 'Explore the map',
23
23
  description:
24
- 'Hover over a feature on the map to see its name, click on it to see more information such as its connectivity.',
24
+ '<b>Hover</b> over a feature on the map to see its name, <b>click</b> on it to see more information such as its connectivity.',
25
25
  placement: 'bottom',
26
26
  target: () => $el.querySelector('.flatmap-popup-popper'),
27
27
  onEnter: openFlatmapHelpPopup,
@@ -266,6 +266,7 @@
266
266
  : 'The legends explain the symbols and colours used on this map.',
267
267
  placement: 'right',
268
268
  onEnter: openHelpModeDrawer,
269
+ onLeave: restoreHelpModeDrawer,
269
270
  }"
270
271
  :class="{ open: drawerOpen, close: !drawerOpen }"
271
272
  :style="{ 'max-height': pathwaysMaxHeight + 'px' }"
@@ -626,6 +627,9 @@ import EventBus from './EventBus.js';
626
627
  import FlatmapError from './FlatmapError.vue';
627
628
 
628
629
  const ERROR_MESSAGE = 'cannot be found on the map.';
630
+ // The drawer opened for the help is closed after this delay, so it stays open between
631
+ // the help of its items, e.g. the legends then the dataset markers
632
+ const HELP_MODE_DRAWER_RESTORE_DELAY = 500;
629
633
 
630
634
  const centroid = (geometry) => {
631
635
  let featureGeometry = { lng: 0, lat: 0 };
@@ -2394,13 +2398,31 @@ export default {
2394
2398
  * Open the pathway drawer to show the help of the items inside it.
2395
2399
  */
2396
2400
  openHelpModeDrawer: function () {
2397
- if (this.requiresDrawer) this.drawerOpen = true;
2401
+ clearTimeout(this.helpModeDrawerTimeout);
2402
+ if (!this.requiresDrawer) return;
2403
+ // Remember to close it again if the user had closed it
2404
+ if (!this.drawerOpen) this.helpModeDrawerOpened = true;
2405
+ this.drawerOpen = true;
2406
+ },
2407
+ /**
2408
+ * Close the drawer again if it was opened for the help, see `openHelpModeDrawer`.
2409
+ */
2410
+ restoreHelpModeDrawer: function () {
2411
+ clearTimeout(this.helpModeDrawerTimeout);
2412
+ this.helpModeDrawerTimeout = setTimeout(() => {
2413
+ if (this.helpModeDrawerOpened) this.drawerOpen = false;
2414
+ this.helpModeDrawerOpened = false;
2415
+ }, HELP_MODE_DRAWER_RESTORE_DELAY);
2398
2416
  },
2399
2417
  /**
2400
2418
  * Show the dataset marker in the drawer, which is otherwise only shown on hover.
2401
2419
  */
2402
2420
  setHelpModeMarker: function (visible) {
2403
- if (visible) this.openHelpModeDrawer();
2421
+ if (visible) {
2422
+ this.openHelpModeDrawer();
2423
+ } else {
2424
+ this.restoreHelpModeDrawer();
2425
+ }
2404
2426
  this.helpModeMarkerVisible = visible;
2405
2427
  },
2406
2428
 
@@ -2519,9 +2541,12 @@ export default {
2519
2541
  * Function to close Flatmap Help Popup.
2520
2542
  */
2521
2543
  closeFlatmapHelpPopup: function () {
2522
- this.$el.querySelectorAll('.maplibregl-popup-close-button').forEach((item) => {
2523
- item.click();
2524
- });
2544
+ // Only the help popup, not a popup the user opened
2545
+ this.$el
2546
+ .querySelectorAll('.flatmap-popup-popper .maplibregl-popup-close-button')
2547
+ .forEach((item) => {
2548
+ item.click();
2549
+ });
2525
2550
  },
2526
2551
  /**
2527
2552
  * @public
@@ -3346,6 +3371,7 @@ export default {
3346
3371
  userApiKey: this.userToken,
3347
3372
  // For the help of the items in the pathway drawer, e.g. in the legends
3348
3373
  openHelpModeDrawer: this.openHelpModeDrawer,
3374
+ restoreHelpModeDrawer: this.restoreHelpModeDrawer,
3349
3375
  };
3350
3376
  },
3351
3377
  data: function () {
@@ -28,6 +28,7 @@
28
28
  description: 'Shows the location of the featured dataset on the map.',
29
29
  placement: 'right',
30
30
  onEnter: openHelpModeDrawer,
31
+ onLeave: restoreHelpModeDrawer,
31
32
  }"
32
33
  @mouseover="onMouseOver"
33
34
  @mouseout="onMouseOut"
@@ -68,6 +69,7 @@ export default {
68
69
  },
69
70
  inject: {
70
71
  openHelpModeDrawer: { default: () => () => {} },
72
+ restoreHelpModeDrawer: { default: () => () => {} },
71
73
  },
72
74
  props: {
73
75
  identifierKey: {