@abi-software/flatmapvuer 1.20.1-demo.2 → 1.21.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.
@@ -2,7 +2,6 @@
2
2
  <div
3
3
  class="flatmap-container"
4
4
  ref="flatmapContainer"
5
- data-help-scope
6
5
  v-loading="loading"
7
6
  element-loading-text="Loading..."
8
7
  element-loading-background="rgba(0, 0, 0, 0.3)"
@@ -10,24 +9,7 @@
10
9
  <map-svg-sprite-color />
11
10
  <div style="height: 100%; width: 100%; position: relative; overflow-y: none">
12
11
  <!-- flatmap-display -->
13
- <div
14
- style="height: 100%; width: 100%"
15
- ref="display"
16
- class="flatmap-display"
17
- v-help-mode="{
18
- id: 'flatmap-map-popup',
19
- area: 'map-info',
20
- // After the controls at the top left, e.g. what's new, the map is below them
21
- order: 1,
22
- title: 'Explore the map',
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.',
25
- placement: 'bottom',
26
- target: () => $el.querySelector('.flatmap-popup-popper'),
27
- onEnter: openFlatmapHelpPopup,
28
- onLeave: closeFlatmapHelpPopup,
29
- }"
30
- ></div>
12
+ <div style="height: 100%; width: 100%" ref="display" class="flatmap-display"></div>
31
13
  <!-- flatmap-error -->
32
14
  <FlatmapError v-if="flatmapError" :flatmapError="flatmapError" />
33
15
 
@@ -38,13 +20,18 @@
38
20
  placement="right"
39
21
  popper-class="warning-popper flatmap-popper"
40
22
  :teleported="false"
41
- trigger="hover"
42
- :show-after="tooltipDelay"
43
- :hide-after="tooltipDelay"
23
+ :visible="hoverVisibilities[7].value"
44
24
  ref="warningPopover"
45
25
  >
46
- <p v-if="isLegacy">This is a legacy map, you may view the latest map instead.</p>
47
- <p v-else-if="isFC">
26
+ <!--
27
+ What magic meaning do the numbers 6, 7, etc have?
28
+
29
+ Please use `const` to assign meaningful names to them...
30
+ -->
31
+ <p v-if="isLegacy" @mouseover="showTooltip(7)" @mouseout="hideTooltip(7)">
32
+ This is a legacy map, you may view the latest map instead.
33
+ </p>
34
+ <p v-else-if="isFC" @mouseover="showTooltip(7)" @mouseout="hideTooltip(7)">
48
35
  This map displays the connectivity of individual neurons. Specifically, those which
49
36
  align with (parts of) the neuron populations from the
50
37
  <a href="https://sparc.science/resources/1ZUKXU2YmLcn2reCyXjlew" target="_blank">
@@ -56,7 +43,7 @@
56
43
  </a>
57
44
  .
58
45
  </p>
59
- <p v-else>
46
+ <p v-else @mouseover="showTooltip(7)" @mouseout="hideTooltip(7)">
60
47
  This map displays the connectivity of neuron populations. Specifically, those from the
61
48
  primarily rat-based
62
49
  <a href="https://sparc.science/resources/1ZUKXU2YmLcn2reCyXjlew" target="_blank">
@@ -70,16 +57,7 @@
70
57
  progresses.
71
58
  </p>
72
59
  <template #reference>
73
- <div
74
- class="warning-icon"
75
- v-help-mode="{
76
- id: 'flatmap-warning',
77
- area: 'map-info',
78
- title: 'About this map',
79
- description: warningHelpDescription,
80
- placement: 'right',
81
- }"
82
- >
60
+ <div class="warning-icon" @mouseover="showTooltip(7)" @mouseout="hideTooltip(7)">
83
61
  <el-icon v-if="displayWarning || isLegacy"><el-icon-warning-filled /></el-icon>
84
62
  <template v-if="isLegacy">
85
63
  <span class="warning-text">Legacy Map</span>
@@ -98,23 +76,17 @@
98
76
  placement="right"
99
77
  v-if="displayLatestChanges"
100
78
  :teleported="false"
101
- trigger="hover"
79
+ trigger="manual"
102
80
  popper-class="warning-popper flatmap-popper"
103
- :show-after="tooltipDelay"
104
- :hide-after="tooltipDelay"
81
+ :visible="hoverVisibilities[8].value"
105
82
  ref="whatsNewPopover"
106
83
  >
107
84
  <template #reference>
108
85
  <div
109
86
  class="latest-changesicon"
110
- v-help-mode="{
111
- id: 'flatmap-whats-new',
112
- area: 'map-info',
113
- title: 'What\'s new?',
114
- description: 'See the latest changes and improvements made to this map.',
115
- placement: 'right',
116
- }"
117
87
  v-if="displayLatestChanges"
88
+ @mouseover="showTooltip(8)"
89
+ @mouseout="hideTooltip(8)"
118
90
  >
119
91
  <el-icon><el-icon-warning-filled /></el-icon>
120
92
  <span class="warning-text">What's new?</span>
@@ -155,10 +127,13 @@
155
127
  :activeDrawMode="activeDrawMode"
156
128
  :newlyDrawnEntry="drawnCreatedEvent"
157
129
  :connectionEntry="connectionEntry"
130
+ :hoverVisibilities="hoverVisibilities"
158
131
  @clickToolbar="toolbarEvent"
159
132
  @featureTooltip="connectedFeatureTooltip"
160
133
  @confirmDrawn="confirmDrawnFeature"
161
134
  @cancelDrawn="cancelDrawnFeature"
135
+ @showTooltip="showTooltip"
136
+ @hideTooltip="hideTooltip"
162
137
  ref="toolbarPopover"
163
138
  />
164
139
 
@@ -167,24 +142,18 @@
167
142
  content="Zoom in"
168
143
  placement="left"
169
144
  :teleported="false"
170
- trigger="hover"
145
+ trigger="manual"
171
146
  width="70"
172
147
  popper-class="flatmap-popper"
173
- :show-after="tooltipDelay"
174
- :hide-after="tooltipDelay"
148
+ :visible="hoverVisibilities[1].value"
175
149
  ref="zoomInPopover"
176
150
  >
177
151
  <template #reference>
178
152
  <div
179
153
  class="icon-button-container"
180
- v-help-mode="{
181
- id: 'flatmap-zoom-in',
182
- area: 'zoom',
183
- title: 'Zoom in',
184
- description: 'Zoom in to see more detail. You can also scroll or pinch on the map.',
185
- placement: 'left',
186
- }"
187
154
  @click="zoomIn()"
155
+ @mouseover="showTooltip(1)"
156
+ @mouseout="hideTooltip(1)"
188
157
  >
189
158
  <map-svg-icon class="icon-button zoomIn" icon="zoomIn" />
190
159
  </div>
@@ -194,24 +163,18 @@
194
163
  content="Zoom out"
195
164
  placement="top-end"
196
165
  :teleported="false"
197
- trigger="hover"
166
+ trigger="manual"
198
167
  width="70"
199
168
  popper-class="flatmap-popper"
200
- :show-after="tooltipDelay"
201
- :hide-after="tooltipDelay"
169
+ :visible="hoverVisibilities[2].value"
202
170
  ref="zoomOutPopover"
203
171
  >
204
172
  <template #reference>
205
173
  <div
206
174
  class="icon-button-container"
207
- v-help-mode="{
208
- id: 'flatmap-zoom-out',
209
- area: 'zoom',
210
- title: 'Zoom out',
211
- description: 'Zoom out to see more of the map.',
212
- placement: 'top',
213
- }"
214
175
  @click="zoomOut()"
176
+ @mouseover="showTooltip(2)"
177
+ @mouseout="hideTooltip(2)"
215
178
  >
216
179
  <map-svg-icon class="icon-button zoomOut" icon="zoomOut" />
217
180
  </div>
@@ -221,11 +184,10 @@
221
184
  content="Reset"
222
185
  placement="top"
223
186
  :teleported="false"
224
- trigger="hover"
187
+ trigger="manual"
225
188
  width="70"
226
189
  popper-class="flatmap-popper"
227
- :show-after="tooltipDelay"
228
- :hide-after="tooltipDelay"
190
+ :visible="hoverVisibilities[3].value"
229
191
  ref="zoomFitPopover"
230
192
  >
231
193
  <div>
@@ -236,95 +198,95 @@
236
198
  <template #reference>
237
199
  <div
238
200
  class="icon-button-container"
239
- v-help-mode="{
240
- id: 'flatmap-zoom-fit',
241
- area: 'zoom',
242
- title: 'Fit to window',
243
- description: 'Reset the view so the whole map fits in the window.',
244
- placement: 'top',
245
- }"
246
201
  @click="resetView()"
202
+ @mouseover="showTooltip(3)"
203
+ @mouseout="hideTooltip(3)"
247
204
  >
248
205
  <map-svg-icon class="icon-button fitWindow" icon="fitWindow" />
249
206
  </div>
250
207
  </template>
251
208
  </el-popover>
252
209
  </div>
253
- <div
254
- class="pathway-location"
255
- :class="{ open: drawerOpen, close: !drawerOpen }"
256
- v-show="!disableUI && requiresDrawer"
210
+ <el-popover
211
+ content="Change pathway visibility"
212
+ placement="right"
213
+ :teleported="false"
214
+ trigger="manual"
215
+ :offset="-18"
216
+ popper-class="flatmap-popper"
217
+ :visible="hoverVisibilities[6].value"
218
+ ref="checkBoxPopover"
257
219
  >
258
- <div
259
- class="pathway-container"
260
- v-help-mode="{
261
- id: 'flatmap-pathways',
262
- area: 'legends',
263
- title: showPathwayFilter ? 'Pathways and legends' : 'Legends',
264
- description: showPathwayFilter
265
- ? 'Show or hide pathways, systems and other map layers using the checkboxes in this panel.'
266
- : 'The legends explain the symbols and colours used on this map.',
267
- placement: 'right',
268
- onEnter: openHelpModeDrawer,
269
- }"
270
- :class="{ open: drawerOpen, close: !drawerOpen }"
271
- :style="{ 'max-height': pathwaysMaxHeight + 'px' }"
272
- >
273
- <dynamic-legends
274
- v-if="legendEntry.length"
275
- identifierKey="prompt"
276
- colourKey="colour"
277
- styleKey="style"
278
- :legends="legendEntry"
279
- :showStarInLegend="true"
280
- ref="featuredMarkerPopover"
281
- class="svg-legends-container"
282
- />
283
- <!-- 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 -->
220
+ <template #reference>
284
221
  <div
285
- v-show="helpModeMarkerVisible"
286
- class="flatmap-marker-help"
287
- v-help-mode="{
288
- id: 'flatmap-marker',
289
- area: 'legends',
290
- title: 'Dataset markers',
291
- description:
292
- 'Find these markers on the map for data. The number inside a marker is the number of datasets available at that location.',
293
- placement: 'right',
294
- onEnter: () => setHelpModeMarker(true),
295
- onLeave: () => setHelpModeMarker(false),
296
- }"
222
+ class="pathway-location"
223
+ :class="{ open: drawerOpen, close: !drawerOpen }"
224
+ v-show="!disableUI && requiresDrawer"
297
225
  >
298
- <div class="flatmap-marker-help-icon" v-html="flatmapMarker"></div>
299
- <span class="flatmap-marker-help-label">Dataset markers</span>
300
- </div>
301
- <tree-controls
302
- v-if="isFC && systems && systems.length > 0"
303
- class="treeControls"
304
- mapType="flatmap"
305
- title="Systems"
306
- :treeData="systems"
307
- :active="currentActive"
308
- :hover="currentHover"
309
- @checkChanged="systemSelected"
310
- @checkAll="checkAllSystems"
311
- @changeActive="ftuSelected"
312
- ref="treeControls"
313
- />
314
- <selections-group
315
- v-if="containsAlert && alertOptions && showPathwayFilter"
316
- title="Notes"
317
- labelKey="label"
318
- identifierKey="key"
319
- :selections="alertOptions"
320
- @changed="alertSelected"
321
- @checkboxMouseEnter="alertMouseEnterEmitted"
322
- @selections-data-changed="onSelectionsDataChanged"
323
- @checkAll="checkAllAlerts"
324
- ref="alertSelection"
325
- key="alertSelection"
326
- />
327
- <!--
226
+ <div
227
+ class="pathway-container"
228
+ :class="{ open: drawerOpen, close: !drawerOpen }"
229
+ :style="{ 'max-height': pathwaysMaxHeight + 'px' }"
230
+ v-popover:checkBoxPopover
231
+ >
232
+ <dynamic-legends
233
+ v-if="legendEntry.length"
234
+ identifierKey="prompt"
235
+ colourKey="colour"
236
+ styleKey="style"
237
+ :legends="legendEntry"
238
+ :showStarInLegend="true"
239
+ :showDatasetMarkerTooltip="showDatasetMarkerTooltip"
240
+ ref="featuredMarkerPopover"
241
+ class="svg-legends-container"
242
+ />
243
+ <!-- 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 -->
244
+ <el-popover
245
+ content="Find these markers for data. The number inside the markers is the number of datasets available for each marker."
246
+ placement="right"
247
+ :teleported="false"
248
+ width="200"
249
+ trigger="manual"
250
+ popper-class="flatmap-popper flatmap-marker-popper"
251
+ :visible="hoverVisibilities[0].value"
252
+ ref="markerPopover"
253
+ >
254
+ <template #reference>
255
+ <div
256
+ v-show="hoverVisibilities[0].value"
257
+ class="flatmap-marker-help"
258
+ v-html="flatmapMarker"
259
+ v-popover:markerPopover
260
+ ></div>
261
+ </template>
262
+ </el-popover>
263
+ <tree-controls
264
+ v-if="isFC && systems && systems.length > 0"
265
+ class="treeControls"
266
+ mapType="flatmap"
267
+ title="Systems"
268
+ :treeData="systems"
269
+ :active="currentActive"
270
+ :hover="currentHover"
271
+ @checkChanged="systemSelected"
272
+ @checkAll="checkAllSystems"
273
+ @changeActive="ftuSelected"
274
+ ref="treeControls"
275
+ />
276
+ <selections-group
277
+ v-if="containsAlert && alertOptions && showPathwayFilter"
278
+ title="Notes"
279
+ labelKey="label"
280
+ identifierKey="key"
281
+ :selections="alertOptions"
282
+ @changed="alertSelected"
283
+ @checkboxMouseEnter="alertMouseEnterEmitted"
284
+ @selections-data-changed="onSelectionsDataChanged"
285
+ @checkAll="checkAllAlerts"
286
+ ref="alertSelection"
287
+ key="alertSelection"
288
+ />
289
+ <!--
328
290
  <selections-group
329
291
  v-if="isFC && sckanDisplay && sckanDisplay.length > 0"
330
292
  title="SCKAN"
@@ -350,43 +312,45 @@
350
312
  key="layersSelection"
351
313
  />
352
314
  -->
353
- <selections-group
354
- v-if="pathways && pathways.length > 0"
355
- title="Pathways"
356
- labelKey="label"
357
- identifierKey="type"
358
- colourStyle="line"
359
- :selections="pathways"
360
- :showAsLegend="!showPathwayFilter"
361
- @changed="pathwaysSelected"
362
- @selections-data-changed="onSelectionsDataChanged"
363
- @checkAll="checkAllPathways"
364
- ref="pathwaysSelection"
365
- key="pathwaysSelection"
366
- />
367
- <selections-group
368
- v-if="taxonConnectivity && taxonConnectivity.length > 0 && showPathwayFilter"
369
- title="Studied in"
370
- labelKey="label"
371
- identifierKey="taxon"
372
- helpMessage="Evidence exists that this set of neuron populations have been studied in the given species."
373
- :selections="taxonConnectivity"
374
- @changed="taxonsSelected"
375
- @checkboxMouseEnter="taxonMouseEnterEmitted"
376
- @selections-data-changed="onSelectionsDataChanged"
377
- @checkAll="checkAllTaxons"
378
- ref="taxonSelection"
379
- key="taxonSelection"
380
- />
381
- </div>
382
- <div
383
- @click="toggleDrawer"
384
- class="drawer-button"
385
- :class="{ open: drawerOpen, close: !drawerOpen }"
386
- >
387
- <el-icon><el-icon-arrow-left /></el-icon>
388
- </div>
389
- </div>
315
+ <selections-group
316
+ v-if="pathways && pathways.length > 0"
317
+ title="Pathways"
318
+ labelKey="label"
319
+ identifierKey="type"
320
+ colourStyle="line"
321
+ :selections="pathways"
322
+ :showAsLegend="!showPathwayFilter"
323
+ @changed="pathwaysSelected"
324
+ @selections-data-changed="onSelectionsDataChanged"
325
+ @checkAll="checkAllPathways"
326
+ ref="pathwaysSelection"
327
+ key="pathwaysSelection"
328
+ />
329
+ <selections-group
330
+ v-if="taxonConnectivity && taxonConnectivity.length > 0 && showPathwayFilter"
331
+ title="Studied in"
332
+ labelKey="label"
333
+ identifierKey="taxon"
334
+ helpMessage="Evidence exists that this set of neuron populations have been studied in the given species."
335
+ :selections="taxonConnectivity"
336
+ @changed="taxonsSelected"
337
+ @checkboxMouseEnter="taxonMouseEnterEmitted"
338
+ @selections-data-changed="onSelectionsDataChanged"
339
+ @checkAll="checkAllTaxons"
340
+ ref="taxonSelection"
341
+ key="taxonSelection"
342
+ />
343
+ </div>
344
+ <div
345
+ @click="toggleDrawer"
346
+ class="drawer-button"
347
+ :class="{ open: drawerOpen, close: !drawerOpen }"
348
+ >
349
+ <el-icon><el-icon-arrow-left /></el-icon>
350
+ </div>
351
+ </div>
352
+ </template>
353
+ </el-popover>
390
354
  <el-popover
391
355
  v-if="openMapRef"
392
356
  ref="open-map-popover"
@@ -513,9 +477,7 @@
513
477
  >
514
478
  <el-row v-if="showOpenMapButton">
515
479
  <el-popover
516
- trigger="hover"
517
- :show-after="tooltipDelay"
518
- :hide-after="tooltipDelay"
480
+ :visible="hoverVisibilities[4].value"
519
481
  content="Open new map"
520
482
  placement="right"
521
483
  :teleported="false"
@@ -526,15 +488,9 @@
526
488
  <div
527
489
  v-if="enableOpenMapUI && openMapOptions.length > 0"
528
490
  ref="openMapRef"
529
- v-help-mode="{
530
- id: 'flatmap-open-map',
531
- area: 'map-settings',
532
- title: 'Open new map',
533
- description:
534
- 'Open another map, such as a different species or a connectivity map.',
535
- placement: 'right',
536
- }"
537
491
  class="icon-button-container"
492
+ @mouseover="showTooltip(4)"
493
+ @mouseout="hideTooltip(4)"
538
494
  >
539
495
  <map-svg-icon icon="openMap" class="icon-button open-map-button" />
540
496
  </div>
@@ -545,25 +501,18 @@
545
501
  <el-popover
546
502
  content="Change settings"
547
503
  placement="right"
548
- :show-after="tooltipDelay"
549
- :hide-after="tooltipDelay"
504
+ :visible="hoverVisibilities[5].value"
550
505
  :teleported="false"
551
- trigger="hover"
506
+ trigger="manual"
552
507
  popper-class="flatmap-popper"
553
508
  ref="settingsPopover"
554
509
  >
555
510
  <template #reference>
556
511
  <div
557
512
  ref="backgroundIconRef"
558
- v-help-mode="{
559
- id: 'flatmap-settings',
560
- area: 'map-settings',
561
- title: 'Settings',
562
- description:
563
- 'Change the map settings, such as the background colour and the viewing mode.',
564
- placement: 'right',
565
- }"
566
513
  class="icon-button-container"
514
+ @mouseover="showTooltip(5)"
515
+ @mouseout="hideTooltip(5)"
567
516
  >
568
517
  <map-svg-icon icon="changeBckgd" class="icon-button" />
569
518
  </div>
@@ -608,7 +557,6 @@ import { capitalise, normaliseAlertToStringArray } from './utilities.js';
608
557
  import yellowstar from '../icons/yellowstar';
609
558
  import ResizeSensor from 'css-element-queries/src/ResizeSensor';
610
559
  import flatmap from '../services/flatmapLoader.js';
611
- import { attachSomaLocationMarkerMethods } from '../services/somaLocationMarkers.js';
612
560
  import { AnnotationService } from '@abi-software/sparc-annotation';
613
561
  import { mapState } from 'pinia';
614
562
  import { useMainStore } from '@/store/index';
@@ -618,8 +566,6 @@ import {
618
566
  Tooltip,
619
567
  TreeControls,
620
568
  getFlatmapFilterOptions,
621
- collectHelpModeSteps,
622
- helpModeDirective,
623
569
  } from '@abi-software/map-utilities';
624
570
  import '@abi-software/map-utilities/dist/style.css';
625
571
  import EventBus from './EventBus.js';
@@ -693,9 +639,6 @@ export default {
693
639
  DrawToolbar,
694
640
  FlatmapError,
695
641
  },
696
- directives: {
697
- helpMode: helpModeDirective,
698
- },
699
642
  beforeCreate: function () {
700
643
  //The state watcher may triggered before
701
644
  //created causing issue, This flag will
@@ -2383,27 +2326,133 @@ export default {
2383
2326
  },
2384
2327
  /**
2385
2328
  * @public
2386
- * Function to get the help mode steps of this flatmap, from the elements with ``v-help-mode``,
2387
- * to be used with ``HelpModeTour`` and ``HelpModeHover`` from ``@abi-software/map-utilities``.
2388
- * @returns {Array} The list of help steps.
2329
+ * Function to set help mode
2330
+ * by providing flag ``helpMode`` (true/false).
2331
+ * @arg {Boolean} `helpMode`
2389
2332
  */
2390
- getHelpModeSteps: function () {
2391
- return collectHelpModeSteps(this.$el);
2333
+ setHelpMode: function (helpMode) {
2334
+ const toolTipsLength = this.hoverVisibilities.length;
2335
+ const lastIndex = toolTipsLength - 1;
2336
+ const activePopoverObj = this.hoverVisibilities[this.helpModeActiveIndex];
2337
+
2338
+ if (activePopoverObj) {
2339
+ const popoverRefsId = activePopoverObj?.refs;
2340
+ const popoverRefId = activePopoverObj?.ref;
2341
+ const popoverRef = this.$refs[popoverRefsId ? popoverRefsId : popoverRefId];
2342
+
2343
+ if (popoverRef) {
2344
+ // Open pathway drawer if the tooltip is inside or beside
2345
+ const { parentElement, nextElementSibling } = popoverRef.$el;
2346
+ const isPathwayContainer = (element) => {
2347
+ return (
2348
+ element &&
2349
+ (element.classList.contains('pathway-container') ||
2350
+ element.classList.contains('pathway-location'))
2351
+ );
2352
+ };
2353
+
2354
+ if (isPathwayContainer(parentElement) || isPathwayContainer(nextElementSibling)) {
2355
+ if (this.requiresDrawer) {
2356
+ this.drawerOpen = true;
2357
+ } else {
2358
+ this.helpModeActiveIndex += 1;
2359
+ }
2360
+ }
2361
+ } else {
2362
+ // skip the unavailable tooltips
2363
+ this.helpModeActiveIndex += 1;
2364
+ this.setHelpMode(helpMode);
2365
+ }
2366
+ }
2367
+
2368
+ // Skip checkbox tooltip if pathway filter is not shown
2369
+ const activePopoverObjAfter = this.hoverVisibilities[this.helpModeActiveIndex];
2370
+ if (activePopoverObjAfter?.ref === 'checkBoxPopover' && !this.showPathwayFilter) {
2371
+ this.helpModeActiveIndex += 1;
2372
+ this.setHelpMode(helpMode);
2373
+ }
2374
+
2375
+ if (!helpMode) {
2376
+ // reset to iniital state
2377
+ this.helpModeActiveIndex = this.helpModeInitialIndex;
2378
+ }
2379
+
2380
+ if (this.viewingMode !== 'Annotation' && this.helpModeActiveIndex > 9) {
2381
+ this.helpModeActiveIndex = lastIndex;
2382
+ }
2383
+
2384
+ if (helpMode && this.helpModeActiveIndex >= lastIndex) {
2385
+ /**
2386
+ * This event is emitted when the tooltips in help mode reach the last item.
2387
+ */
2388
+ this.$emit('help-mode-last-item', true);
2389
+ }
2390
+
2391
+ if (helpMode && !this.helpModeDialog) {
2392
+ this.inHelp = true;
2393
+ this.hoverVisibilities.forEach((item) => {
2394
+ item.value = true;
2395
+ });
2396
+ } else if (helpMode && this.helpModeDialog && toolTipsLength > this.helpModeActiveIndex) {
2397
+ // Show the map tooltip as first item
2398
+ if (this.helpModeActiveIndex > -1) {
2399
+ this.closeFlatmapHelpPopup();
2400
+
2401
+ // wait for CSS transition
2402
+ setTimeout(() => {
2403
+ this.inHelp = false;
2404
+ this.hoverVisibilities.forEach((item) => {
2405
+ item.value = false;
2406
+ });
2407
+
2408
+ this.showTooltip(this.helpModeActiveIndex, 200);
2409
+ }, 300);
2410
+ } else if (this.helpModeActiveIndex === -1) {
2411
+ this.openFlatmapHelpPopup();
2412
+ }
2413
+ } else {
2414
+ this.inHelp = false;
2415
+ this.hoverVisibilities.forEach((item) => {
2416
+ item.value = false;
2417
+ });
2418
+ this.closeFlatmapHelpPopup();
2419
+ }
2392
2420
  },
2393
2421
  /**
2394
- * Open the pathway drawer to show the help of the items inside it.
2422
+ * @public
2423
+ * Function to show tooltip
2424
+ * by providing ``tooltipNumber``.
2425
+ * @arg {Number} `tooltipNumber`
2426
+ * @arg {Number} `timeout` _(default: `500`)_
2395
2427
  */
2396
- openHelpModeDrawer: function () {
2397
- if (this.requiresDrawer) this.drawerOpen = true;
2428
+ showTooltip: function (tooltipNumber, timeout = 500) {
2429
+ if (!this.inHelp) {
2430
+ clearTimeout(this.tooltipWait[tooltipNumber]);
2431
+ this.tooltipWait[tooltipNumber] = setTimeout(() => {
2432
+ this.hoverVisibilities[tooltipNumber].value = true;
2433
+ /**
2434
+ * This event is emitted after a tooltip in Flatmap is shown.
2435
+ */
2436
+ this.$emit('shown-tooltip');
2437
+ }, timeout);
2438
+ }
2398
2439
  },
2440
+
2399
2441
  /**
2400
- * Show the dataset marker in the drawer, which is otherwise only shown on hover.
2442
+ * @public
2443
+ * Function to hide tooltip
2444
+ * by providing ``tooltipNumber``.
2445
+ * @arg {Number} `tooltipNumber`
2446
+ * @arg {Number} `timeout` _(default: `500`)_
2401
2447
  */
2402
- setHelpModeMarker: function (visible) {
2403
- if (visible) this.openHelpModeDrawer();
2404
- this.helpModeMarkerVisible = visible;
2448
+ hideTooltip: function (tooltipNumber, timeout = 500) {
2449
+ if (!this.inHelp) {
2450
+ clearTimeout(this.tooltipWait[tooltipNumber]);
2451
+ this.tooltipWait[tooltipNumber] = setTimeout(() => {
2452
+ this.hoverVisibilities[tooltipNumber].value = false;
2453
+ }, timeout);
2454
+ }
2405
2455
  },
2406
-
2407
2456
  /**
2408
2457
  * @public
2409
2458
  * Function to display tooltip
@@ -2511,6 +2560,10 @@ export default {
2511
2560
  anchor: 'top',
2512
2561
  className: 'flatmap-popup-popper',
2513
2562
  });
2563
+ /**
2564
+ * This event is emitted after a tooltip on Flatmap's map is shown.
2565
+ */
2566
+ this.$emit('shown-map-tooltip');
2514
2567
  }
2515
2568
  }
2516
2569
  },
@@ -2733,7 +2786,7 @@ export default {
2733
2786
  });
2734
2787
  promise1
2735
2788
  .then((returnedObject) => {
2736
- this.mapImp = attachSomaLocationMarkerMethods(returnedObject);
2789
+ this.mapImp = returnedObject;
2737
2790
  this.serverURL = this.mapImp.makeServerUrl('').slice(0, -1);
2738
2791
  let mapVersion = this.mapImp.details.version;
2739
2792
  this.setFlightPathInfo(mapVersion);
@@ -3163,6 +3216,44 @@ export default {
3163
3216
  type: Boolean,
3164
3217
  default: true,
3165
3218
  },
3219
+ /**
3220
+ * The option to show tooltips for help mode.
3221
+ */
3222
+ helpMode: {
3223
+ type: Boolean,
3224
+ default: false,
3225
+ },
3226
+ /**
3227
+ * The active item index of help mode.
3228
+ */
3229
+ helpModeActiveItem: {
3230
+ type: Number,
3231
+ default: 0,
3232
+ },
3233
+ /**
3234
+ * The option to use helpModeDialog.
3235
+ * On default, `false`, clicking help will show all tooltips.
3236
+ * If `true`, clicking help will show the help-mode-dialog.
3237
+ */
3238
+ helpModeDialog: {
3239
+ type: Boolean,
3240
+ default: false,
3241
+ },
3242
+ /**
3243
+ * The last item of help mode.
3244
+ */
3245
+ helpModeLastItem: {
3246
+ type: Boolean,
3247
+ default: false,
3248
+ },
3249
+ /**
3250
+ * The initial index number for help mode tooltips.
3251
+ * Set negative (e.g. -2) if there are other tooltips outside of `hoverVisibilities`.
3252
+ */
3253
+ helpModeInitialIndex: {
3254
+ type: Number,
3255
+ default: 0,
3256
+ },
3166
3257
  /**
3167
3258
  * This flag dictate whether a context will be allocatged
3168
3259
  * for this instance
@@ -3344,8 +3435,6 @@ export default {
3344
3435
  flatmapAPI: this.flatmapAPI,
3345
3436
  sparcAPI: this.sparcAPI,
3346
3437
  userApiKey: this.userToken,
3347
- // For the help of the items in the pathway drawer, e.g. in the legends
3348
- openHelpModeDrawer: this.openHelpModeDrawer,
3349
3438
  };
3350
3439
  },
3351
3440
  data: function () {
@@ -3373,11 +3462,29 @@ export default {
3373
3462
  systems: [],
3374
3463
  taxonConnectivity: [],
3375
3464
  pathwaysMaxHeight: 1000,
3376
- // Delay before showing and hiding the control tooltips
3377
- tooltipDelay: 500,
3378
- helpModeMarkerVisible: false,
3465
+ tooltipWait: markRaw([]),
3466
+ hoverVisibilities: [
3467
+ { value: false, ref: 'markerPopover' }, // 0
3468
+ { value: false, ref: 'zoomInPopover' }, // 1
3469
+ { value: false, ref: 'zoomOutPopover' }, // 2
3470
+ { value: false, ref: 'zoomFitPopover' }, // 3
3471
+ { value: false, ref: 'openMapPopover' }, // 4
3472
+ { value: false, ref: 'settingsPopover' }, // 5
3473
+ { value: false, ref: 'checkBoxPopover' }, // 6
3474
+ { value: false, ref: 'warningPopover' }, // 7
3475
+ { value: false, ref: 'whatsNewPopover' }, // 8
3476
+ { value: false, ref: 'featuredMarkerPopover' }, // 9
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
3483
+ ],
3484
+ helpModeActiveIndex: this.helpModeInitialIndex,
3379
3485
  yellowstar: yellowstar,
3380
3486
  isFC: false,
3487
+ inHelp: false,
3381
3488
  currentBackground: 'white',
3382
3489
  availableBackground: ['white', 'lightskyblue', 'black'],
3383
3490
  loading: false,
@@ -3450,15 +3557,6 @@ export default {
3450
3557
  };
3451
3558
  },
3452
3559
  computed: {
3453
- warningHelpDescription: function () {
3454
- if (this.isLegacy) {
3455
- return 'This is a legacy map. Click the link below the icon to view the latest map instead.';
3456
- }
3457
- if (this.isFC) {
3458
- return 'This map displays the connectivity of individual neurons which align with the neuron populations from the ApiNATOMY models available in SCKAN.';
3459
- }
3460
- return 'This map displays the connectivity of neuron populations from the primarily rat-based ApiNATOMY models available in SCKAN. New connectivity and species specificity will be added as the SPARC program progresses.';
3461
- },
3462
3560
  ...mapState(useMainStore, ['userToken']),
3463
3561
  isValidDrawnCreated: function () {
3464
3562
  return Object.keys(this.drawnCreatedEvent).length > 0;
@@ -3488,6 +3586,9 @@ export default {
3488
3586
  legendEntry: function () {
3489
3587
  return [...this.flatmapLegends, ...this.externalLegends];
3490
3588
  },
3589
+ showDatasetMarkerTooltip: function () {
3590
+ return this.hoverVisibilities[9].value;
3591
+ },
3491
3592
  },
3492
3593
  watch: {
3493
3594
  entry: function () {
@@ -3499,6 +3600,19 @@ export default {
3499
3600
  },
3500
3601
  immediate: true,
3501
3602
  },
3603
+ helpMode: function (newVal, oldVal) {
3604
+ if (newVal !== oldVal) {
3605
+ this.setHelpMode(newVal);
3606
+ }
3607
+ },
3608
+ helpModeActiveItem: function () {
3609
+ // just take the action from helpModeActiveItem
3610
+ // work with local value since the indexing is different
3611
+ if (this.helpMode) {
3612
+ this.helpModeActiveIndex += 1;
3613
+ this.setHelpMode(this.helpMode);
3614
+ }
3615
+ },
3502
3616
  render: function (val) {
3503
3617
  if (val) {
3504
3618
  if (this.mapImp && this.mapImp.contextLost && !this.loading) {
@@ -3602,6 +3716,7 @@ export default {
3602
3716
  mounted: function () {
3603
3717
  this.openMapRef = shallowRef(this.$refs.openMapRef);
3604
3718
  this.backgroundIconRef = shallowRef(this.$refs.backgroundIconRef);
3719
+ this.tooltipWait.length = this.hoverVisibilities.length;
3605
3720
  this.flatmapQueries = markRaw(new FlatmapQueries());
3606
3721
  this.flatmapQueries.initialise(this.flatmapAPI);
3607
3722
  if (this.state) {
@@ -3758,12 +3873,10 @@ export default {
3758
3873
  width: auto;
3759
3874
  }
3760
3875
 
3761
- // Lined up with the legend items, the icon is wider than the 20px legend icons
3762
3876
  .flatmap-marker-help {
3763
- display: flex;
3764
- align-items: center;
3877
+ display: block;
3765
3878
  width: max-content;
3766
- margin: 8px 8.5px;
3879
+ margin: 0.5rem;
3767
3880
 
3768
3881
  :deep(.flatmap-marker svg) {
3769
3882
  display: block;
@@ -3772,12 +3885,6 @@ export default {
3772
3885
  }
3773
3886
  }
3774
3887
 
3775
- .flatmap-marker-help-label {
3776
- margin-left: 10px;
3777
- font-size: 12px;
3778
- color: rgb(48, 49, 51);
3779
- }
3780
-
3781
3888
  .el-dropdown-link {
3782
3889
  cursor: pointer;
3783
3890
  color: #409eff;
@@ -4199,6 +4306,12 @@ export default {
4199
4306
  }
4200
4307
  }
4201
4308
 
4309
+ :deep(.flatmap-popper.flatmap-marker-popper) {
4310
+ white-space: break-spaces;
4311
+ word-wrap: break-word;
4312
+ word-break: break-word;
4313
+ }
4314
+
4202
4315
  :deep(.el-loading-spinner) {
4203
4316
  .path {
4204
4317
  stroke: $app-primary-color;