@abi-software/scaffoldvuer 1.1.0-beta.0 → 1.1.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.
@@ -37,6 +37,7 @@
37
37
  trigger="manual"
38
38
  width="80"
39
39
  popper-class="flatmap-popper"
40
+ ref="commentPopover"
40
41
  :visible="hoverVisibilities[9].value"
41
42
  >
42
43
  <template #reference>
@@ -57,6 +58,7 @@
57
58
  trigger="manual"
58
59
  width="80"
59
60
  popper-class="flatmap-popper"
61
+ ref="drawPointPopover"
60
62
  :visible="hoverVisibilities[10].value"
61
63
  >
62
64
  <template #reference>
@@ -77,6 +79,7 @@
77
79
  trigger="manual"
78
80
  width="80"
79
81
  popper-class="flatmap-popper"
82
+ ref="drawLinePopover"
80
83
  :visible="hoverVisibilities[11].value"
81
84
  >
82
85
  <template #reference>
@@ -97,6 +100,7 @@
97
100
  :visible="hoverVisibilities[6].value"
98
101
  :content="warningMessage"
99
102
  placement="right"
103
+ width="max-content"
100
104
  :teleported="false"
101
105
  popper-class="scaffold-popper message-popper right-popper non-selectable"
102
106
  >
@@ -120,6 +124,7 @@
120
124
  :teleported="false"
121
125
  trigger="manual"
122
126
  popper-class="scaffold-popper message-popper right-popper non-selectable"
127
+ ref="whatsNewPopover"
123
128
  >
124
129
  <template #reference>
125
130
  <div
@@ -137,9 +142,11 @@
137
142
  :visible="hoverVisibilities[5].value"
138
143
  content="Change region visibility"
139
144
  placement="right"
145
+ width="max-content"
140
146
  :teleported="false"
141
147
  trigger="manual"
142
148
  popper-class="scaffold-popper right-popper non-selectable"
149
+ ref="regionVisibilityPopover"
143
150
  >
144
151
  <template #reference>
145
152
  <tree-controls
@@ -159,6 +166,7 @@
159
166
  <el-popover
160
167
  v-if="timeVarying"
161
168
  ref="sliderPopover"
169
+ width="max-content"
162
170
  :visible="hoverVisibilities[4].value"
163
171
  content="Move the slider to animate the region"
164
172
  placement="top"
@@ -242,10 +250,12 @@
242
250
  <el-popover
243
251
  :visible="hoverVisibilities[0].value"
244
252
  content="Zoom in"
253
+ width="max-content"
245
254
  placement="left"
246
255
  :teleported="false"
247
256
  trigger="manual"
248
257
  popper-class="scaffold-popper left-popper non-selectable"
258
+ ref="zoomInPopover"
249
259
  >
250
260
  <template #reference>
251
261
  <map-svg-icon
@@ -261,9 +271,11 @@
261
271
  :visible="hoverVisibilities[1].value"
262
272
  content="Zoom out"
263
273
  placement="top-end"
274
+ width="max-content"
264
275
  :teleported="false"
265
276
  trigger="manual"
266
277
  popper-class="scaffold-popper popper-zoomout non-selectable"
278
+ ref="zoomOutPopover"
267
279
  >
268
280
  <template #reference>
269
281
  <map-svg-icon
@@ -280,7 +292,9 @@
280
292
  placement="top"
281
293
  :teleported="false"
282
294
  trigger="manual"
295
+ width="max-content"
283
296
  popper-class="scaffold-popper non-selectable"
297
+ ref="zoomFitPopover"
284
298
  >
285
299
  <div>
286
300
  Fit to
@@ -361,7 +375,7 @@
361
375
  @click="backgroundChangeCallback(item)"
362
376
  />
363
377
  </el-row>
364
- </div>
378
+ </div>
365
379
  </el-popover>
366
380
  <div
367
381
  class="settings-group"
@@ -374,7 +388,9 @@
374
388
  placement="right"
375
389
  :teleported="false"
376
390
  trigger="manual"
391
+ width="max-content"
377
392
  popper-class="scaffold-popper right-popper non-selectable"
393
+ ref="openMapPopover"
378
394
  >
379
395
  <template #reference>
380
396
  <map-svg-icon
@@ -393,9 +409,11 @@
393
409
  :visible="hoverVisibilities[3].value"
394
410
  content="Change background color"
395
411
  placement="right"
412
+ width="max-content"
396
413
  :teleported="false"
397
414
  trigger="manual"
398
415
  popper-class="scaffold-popper right-popper non-selectable"
416
+ ref="settingsPopover"
399
417
  >
400
418
  <template #reference>
401
419
  <map-svg-icon
@@ -527,6 +545,37 @@ export default {
527
545
  type: Boolean,
528
546
  default: false,
529
547
  },
548
+ /**
549
+ * The active item index of help mode.
550
+ */
551
+ helpModeActiveItem: {
552
+ type: Number,
553
+ default: 0,
554
+ },
555
+ /**
556
+ * The option to use helpModeDialog.
557
+ * On default, `false`, clicking help will show all tooltips.
558
+ * If `true`, clicking help will show the help-mode-dialog.
559
+ */
560
+ helpModeDialog: {
561
+ type: Boolean,
562
+ default: false,
563
+ },
564
+ /**
565
+ * The last item of help mode.
566
+ */
567
+ helpModeLastItem: {
568
+ type: Boolean,
569
+ default: false,
570
+ },
571
+ /**
572
+ * The initial index number for help mode tooltips.
573
+ * Set negative (e.g. -1) if there are other tooltips outside of `hoverVisibilities`.
574
+ */
575
+ helpModeInitialIndex: {
576
+ type: Number,
577
+ default: 0,
578
+ },
530
579
  /**
531
580
  * Use for show/display beta warning icon.
532
581
  */
@@ -557,6 +606,13 @@ export default {
557
606
  type: Boolean,
558
607
  default: false,
559
608
  },
609
+ /**
610
+ * Display adjacent markers with a cluster marker.
611
+ */
612
+ markerCluster: {
613
+ type: Boolean,
614
+ default: false,
615
+ },
560
616
  markerLabels : {
561
617
  type: Array,
562
618
  default: function () {
@@ -668,6 +724,7 @@ export default {
668
724
  return {
669
725
  flatmapAPI: this.flatmapAPI,
670
726
  scaffoldUrl: this.url,
727
+ $annotator: this.annotator,
671
728
  };
672
729
  },
673
730
  data: function () {
@@ -693,20 +750,21 @@ export default {
693
750
  isTransitioning: false,
694
751
  tooltipAppendToBody: false,
695
752
  hoverVisibilities: [
696
- { value: false },
697
- { value: false },
698
- { value: false },
699
- { value: false },
700
- { value: false },
701
- { value: false },
702
- { value: false },
703
- { value: false },
704
- { value: false },
705
- { value: false },
706
- { value: false },
707
- { value: false },
753
+ { value: false, ref: 'zoomInPopover' }, // 0
754
+ { value: false, ref: 'zoomOutPopover' }, // 1
755
+ { value: false, ref: 'zoomFitPopover' }, // 2
756
+ { value: false, ref: 'settingsPopover' }, // 3
757
+ { value: false, ref: 'sliderPopover' }, // 4
758
+ { value: false, ref: 'regionVisibilityPopover' }, // 5
759
+ { value: false, ref: 'warningPopover' }, // 6
760
+ { value: false, ref: 'whatsNewPopover' }, // 7
761
+ { value: false, ref: 'openMapPopover' }, // 8
762
+ { value: false, ref: 'commentPopover' }, //9
763
+ { value: false, ref: 'drawPointPopover' }, //10
764
+ { value: false, ref: 'drawLinePopover' }, //11
708
765
  ],
709
766
  inHelp: false,
767
+ helpModeActiveIndex: this.helpModeInitialIndex,
710
768
  loading: false,
711
769
  duration: 3000,
712
770
  drawerOpen: true,
@@ -799,8 +857,18 @@ export default {
799
857
  },
800
858
  immediate: true,
801
859
  },
802
- helpMode: function (val) {
803
- this.setHelpMode(val);
860
+ helpMode: function (newVal, oldVal) {
861
+ if (newVal !== oldVal) {
862
+ this.setHelpMode(newVal)
863
+ }
864
+ },
865
+ helpModeActiveItem: function () {
866
+ // just take the action from helpModeActiveItem
867
+ // work with local value since the indexing is different
868
+ if (this.helpMode) {
869
+ this.helpModeActiveIndex += 1;
870
+ this.setHelpMode(this.helpMode);
871
+ }
804
872
  },
805
873
  displayMarkers: function (val) {
806
874
  this.$module.scene.displayMarkers = val;
@@ -827,6 +895,12 @@ export default {
827
895
  render: function (val) {
828
896
  this.toggleRendering(val);
829
897
  },
898
+ markerCluster: {
899
+ handler: function (val) {
900
+ this.$module.scene.enableMarkerCluster(val);
901
+ },
902
+ immediate: true,
903
+ },
830
904
  markerLabels: function(labels) {
831
905
  this.previousMarkerLabels.forEach((pml)=>{
832
906
  this.setMarkerModeForObjectsWithName(pml, "off");
@@ -859,6 +933,8 @@ export default {
859
933
  this.ro = new ResizeObserver(this.adjustLayout).observe(
860
934
  this.$refs.scaffoldContainer
861
935
  );
936
+ this.helpTextWait = [];
937
+ this.helpTextWait.length = this.hoverVisibilities.length;
862
938
  this.defaultRate = this.$module.getPlayRate();
863
939
  this.$module.zincRenderer.addPreRenderCallbackFunction(() => {
864
940
  this.currentTime = this.$module.getCurrentTime();
@@ -1135,7 +1211,7 @@ export default {
1135
1211
  /**
1136
1212
  * Find and and zoom into objects with the provided list of names.
1137
1213
  * @arg List of names
1138
- *
1214
+ *
1139
1215
  * @vuese
1140
1216
  */
1141
1217
  viewRegion: function (names) {
@@ -1226,7 +1302,7 @@ export default {
1226
1302
  },
1227
1303
  /**
1228
1304
  * Return renderer information
1229
- *
1305
+ *
1230
1306
  * @vuese
1231
1307
  */
1232
1308
  getRendererInfo: function () {
@@ -1420,7 +1496,7 @@ export default {
1420
1496
  *
1421
1497
  * @arg Selected zinc objects
1422
1498
  * @arg Flag to determine if callback should be triggered when new selection
1423
- * is made
1499
+ * is made
1424
1500
  */
1425
1501
  objectSelected: function (objects, propagate) {
1426
1502
  this.updatePrimitiveControls(objects);
@@ -1431,7 +1507,7 @@ export default {
1431
1507
  *
1432
1508
  * @arg Hovered zinc objects
1433
1509
  * @arg Flag to determine if callback should be triggered when new selection
1434
- * is made
1510
+ * is made
1435
1511
  */
1436
1512
  objectHovered: function (objects, propagate) {
1437
1513
  this.hoveredObjects = objects;
@@ -1484,11 +1560,68 @@ export default {
1484
1560
  * Function to toggle on/off overlay help.
1485
1561
  */
1486
1562
  setHelpMode: function (helpMode) {
1487
- if (helpMode) {
1563
+ const toolTipsLength = this.hoverVisibilities.length;
1564
+ const lastIndex = toolTipsLength - 1;
1565
+ const activePopoverObj = this.hoverVisibilities[this.helpModeActiveIndex];
1566
+
1567
+ if (activePopoverObj) {
1568
+ const popoverRefId = activePopoverObj?.ref;
1569
+ const popoverRef = this.$refs[popoverRefId];
1570
+
1571
+ if (popoverRef) {
1572
+ // Open pathway drawer if the tooltip is inside or beside
1573
+ const { parentElement, nextElementSibling } = popoverRef.$el;
1574
+ const isPathwayContainer = (element) => {
1575
+ return element && (
1576
+ element.classList.contains('pathway-container') ||
1577
+ element.classList.contains('pathway-location')
1578
+ );
1579
+ };
1580
+
1581
+ if (
1582
+ isPathwayContainer(parentElement) ||
1583
+ isPathwayContainer(nextElementSibling)
1584
+ ) {
1585
+ this.drawerOpen = true;
1586
+ }
1587
+ } else {
1588
+ // skip the unavailable tooltips
1589
+ this.helpModeActiveIndex += 1;
1590
+ }
1591
+ }
1592
+
1593
+ if (!helpMode) {
1594
+ // reset to iniital state
1595
+ this.helpModeActiveIndex = this.helpModeInitialIndex;
1596
+ }
1597
+
1598
+ if (helpMode && this.helpModeActiveIndex >= lastIndex) {
1599
+ /**
1600
+ * This event is emitted when the tooltips in help mode reach the last item.
1601
+ */
1602
+ this.$emit('help-mode-last-item', true);
1603
+ }
1604
+
1605
+ if (helpMode && !this.helpModeDialog) {
1488
1606
  this.inHelp = true;
1489
1607
  this.hoverVisibilities.forEach((item) => {
1490
1608
  item.value = true;
1491
1609
  });
1610
+ } else if (helpMode && this.helpModeDialog && toolTipsLength > this.helpModeActiveIndex) {
1611
+
1612
+ // Show the map tooltip as first item
1613
+ if (this.helpModeActiveIndex > -1) {
1614
+
1615
+ // wait for CSS transition
1616
+ setTimeout(() => {
1617
+ this.inHelp = false;
1618
+ this.hoverVisibilities.forEach((item) => {
1619
+ item.value = false;
1620
+ });
1621
+
1622
+ this.showHelpText(this.helpModeActiveIndex, 200);
1623
+ }, 300);
1624
+ }
1492
1625
  } else {
1493
1626
  this.inHelp = false;
1494
1627
  this.hoverVisibilities.forEach((item) => {
@@ -1729,25 +1862,32 @@ export default {
1729
1862
  * This is called when mouse cursor enters supported elements
1730
1863
  * with help tootltips.
1731
1864
  */
1732
- showHelpText: function (helpTextNumber) {
1865
+ showHelpText: function (helpTextNumber, timeout = 500) {
1733
1866
  if (!this.inHelp) {
1734
- this.helpTextWait = setTimeout(() => {
1867
+ clearTimeout(this.helpTextWait[helpTextNumber]);
1868
+ this.helpTextWait[helpTextNumber] = setTimeout(() => {
1735
1869
  this.hoverVisibilities[helpTextNumber].value = true;
1736
- }, 500);
1870
+ /**
1871
+ * This event is emitted after a tooltip in Flatmap is shown.
1872
+ */
1873
+ this.$emit('shown-tooltip');
1874
+ }, timeout);
1737
1875
  }
1738
1876
  },
1739
1877
  /**
1740
1878
  * This is called when mouse cursor exits supported element..
1741
1879
  */
1742
- hideHelpText: function (helpTextNumber) {
1880
+ hideHelpText: function (helpTextNumber, timeout = 500) {
1743
1881
  if (!this.inHelp) {
1744
- this.hoverVisibilities[helpTextNumber].value = false;
1745
- clearTimeout(this.helpTextWait);
1882
+ clearTimeout(this.helpTextWait[helpTextNumber]);
1883
+ this.helpTextWait[helpTextNumber] = setTimeout(() => {
1884
+ this.hoverVisibilities[helpTextNumber].value = false;
1885
+ }, timeout);
1746
1886
  }
1747
1887
  },
1748
1888
  /**
1749
1889
  * @vuese
1750
- *
1890
+ *
1751
1891
  * Search a object and display the tooltip
1752
1892
  * @arg text to search across
1753
1893
  * @arg toggle the tooltip if this is set
@@ -1757,7 +1897,7 @@ export default {
1757
1897
  if (text === undefined || text === "" ||
1758
1898
  ((Array.isArray(text) && text.length === 0))
1759
1899
  ) {
1760
- this.objectSelected([], true);
1900
+ this.objectSelected([], true);
1761
1901
  return false;
1762
1902
  } else {
1763
1903
  const result = this.$_searchIndex.searchAndProcessResult(text);
@@ -1787,7 +1927,7 @@ export default {
1787
1927
  },
1788
1928
  /**
1789
1929
  * @vuese
1790
- *
1930
+ *
1791
1931
  * Get the list of suggested terms based on the provided term.
1792
1932
  * This can be used for autocomplete.
1793
1933
  */
@@ -1910,7 +2050,7 @@ export default {
1910
2050
  /**
1911
2051
  * export current scene in GLTF.
1912
2052
  * @arg Return in binary form when set to true
1913
- *
2053
+ *
1914
2054
  * @vuese
1915
2055
  */
1916
2056
  exportGLTF: function (binary) {
@@ -2003,7 +2143,7 @@ export default {
2003
2143
  },
2004
2144
  /**
2005
2145
  * @vuese
2006
- *
2146
+ *
2007
2147
  * Force the renderer to resize
2008
2148
  */
2009
2149
  forceResize: function () {
@@ -2082,6 +2222,8 @@ export default {
2082
2222
  padding: 9px 10px;
2083
2223
  min-width: 150px;
2084
2224
  font-size: 12px;
2225
+ white-space: initial !important;
2226
+ text-align: initial;
2085
2227
  color: #fff;
2086
2228
  }
2087
2229
 
@@ -2314,9 +2456,9 @@ export default {
2314
2456
  &.shape {
2315
2457
  margin-left: 4px;
2316
2458
  margin-right: 4px;
2317
- color: var(--el-color-primary-light-5);
2459
+ color: var(--el-color-primary-light-5)!important;
2318
2460
  &.active {
2319
- color: var(--el-color-primary);
2461
+ color: var(--el-color-primary)!important;
2320
2462
  }
2321
2463
  }
2322
2464
  }
@@ -2388,7 +2530,7 @@ export default {
2388
2530
  border: 1px solid $app-primary-color;
2389
2531
  white-space: nowrap;
2390
2532
  min-width: unset;
2391
- width: unset!important;;
2533
+ word-break: break-word;
2392
2534
  pointer-events: none;
2393
2535
 
2394
2536
  .el-popper__arrow {
@@ -2420,7 +2562,7 @@ export default {
2420
2562
 
2421
2563
  :deep(.popper-zoomout) {
2422
2564
  padding-right: 11px;
2423
- left: -21px !important;
2565
+
2424
2566
  .popper__arrow {
2425
2567
  left: 53px !important;
2426
2568
  }
@@ -1,7 +1,9 @@
1
1
  // The Vue build version to load with the `import` command
2
2
  // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
3
3
  import ScaffoldVuer from "./ScaffoldVuer.vue";
4
+ import HelpModeDialog from "./HelpModeDialog.vue";
4
5
 
5
6
  export {
6
- ScaffoldVuer
7
+ ScaffoldVuer,
8
+ HelpModeDialog,
7
9
  };
@@ -33,6 +33,7 @@ declare module 'vue' {
33
33
  ElTabPane: typeof import('element-plus/es')['ElTabPane']
34
34
  ElTabs: typeof import('element-plus/es')['ElTabs']
35
35
  ElTree: typeof import('element-plus/es')['ElTree']
36
+ HelpModeDialog: typeof import('./components/HelpModeDialog.vue')['default']
36
37
  LinesControls: typeof import('./components/LinesControls.vue')['default']
37
38
  OpacityControls: typeof import('./components/OpacityControls.vue')['default']
38
39
  PointsControls: typeof import('./components/PointsControls.vue')['default']
@@ -2,7 +2,6 @@ import { THREE } from 'zincjs';
2
2
  import { RendererModule } from './RendererModule.js';
3
3
  import Annotation from './Annotation.js';
4
4
 
5
-
6
5
  // Current model's associate data, data fields, external link, nerve map
7
6
  // informations,
8
7
  // these are proived in the organsFileMap array.
@@ -542,7 +541,7 @@ const OrgansSceneData = function() {
542
541
  _this.sceneData.viewURL = undefined;
543
542
  _this.sceneData.metaURL = url;
544
543
  organScene.addZincObjectAddedCallbacks(_addOrganPartCallback(undefined, partName, false));
545
- organScene.loadGLTF(url, undefined, undefined, downloadCompletedCallback());
544
+ organScene.loadGLTF(url, undefined, downloadCompletedCallback());
546
545
  _this.scene = organScene;
547
546
  _this.zincRenderer.setCurrentScene(organScene);
548
547
  _this.graphicsHighlight.reset();
@@ -278,7 +278,6 @@ const createNewAnnotationsWithFeatures = (zincObject, region, group, scaffoldUrl
278
278
  export const addUserAnnotationWithFeature = (service, userToken, zincObject, region, group, scaffoldUrl, action) => {
279
279
  if (service && service.currentUser) {
280
280
  const annotation = createNewAnnotationsWithFeatures(zincObject, region, group, scaffoldUrl, action);
281
- console.log(annotation)
282
281
  if (annotation) {
283
282
  annotation.creator = {...service.currentUser};
284
283
  if (!annotation.creator.orcid) annotation.creator.orcid = '0000-0000-0000-0000';
@@ -309,7 +308,6 @@ export const getDrawnAnnotations = async (service, userToken, scaffoldUrl) => {
309
308
  export const annotationFeaturesToPrimitives = (scene, features) => {
310
309
  if (scene) {
311
310
  features.forEach((feature) => {
312
- console.log(feature)
313
311
  const geometry = feature.geometry;
314
312
  const regionGroup = decodeURIComponent(feature.id);
315
313
  const last = regionGroup.lastIndexOf('/');