@abi-software/scaffoldvuer 1.1.0-beta.1 → 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 () {
@@ -694,20 +750,21 @@ export default {
694
750
  isTransitioning: false,
695
751
  tooltipAppendToBody: false,
696
752
  hoverVisibilities: [
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 },
708
- { 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
709
765
  ],
710
766
  inHelp: false,
767
+ helpModeActiveIndex: this.helpModeInitialIndex,
711
768
  loading: false,
712
769
  duration: 3000,
713
770
  drawerOpen: true,
@@ -800,8 +857,18 @@ export default {
800
857
  },
801
858
  immediate: true,
802
859
  },
803
- helpMode: function (val) {
804
- 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
+ }
805
872
  },
806
873
  displayMarkers: function (val) {
807
874
  this.$module.scene.displayMarkers = val;
@@ -828,6 +895,12 @@ export default {
828
895
  render: function (val) {
829
896
  this.toggleRendering(val);
830
897
  },
898
+ markerCluster: {
899
+ handler: function (val) {
900
+ this.$module.scene.enableMarkerCluster(val);
901
+ },
902
+ immediate: true,
903
+ },
831
904
  markerLabels: function(labels) {
832
905
  this.previousMarkerLabels.forEach((pml)=>{
833
906
  this.setMarkerModeForObjectsWithName(pml, "off");
@@ -860,6 +933,8 @@ export default {
860
933
  this.ro = new ResizeObserver(this.adjustLayout).observe(
861
934
  this.$refs.scaffoldContainer
862
935
  );
936
+ this.helpTextWait = [];
937
+ this.helpTextWait.length = this.hoverVisibilities.length;
863
938
  this.defaultRate = this.$module.getPlayRate();
864
939
  this.$module.zincRenderer.addPreRenderCallbackFunction(() => {
865
940
  this.currentTime = this.$module.getCurrentTime();
@@ -1136,7 +1211,7 @@ export default {
1136
1211
  /**
1137
1212
  * Find and and zoom into objects with the provided list of names.
1138
1213
  * @arg List of names
1139
- *
1214
+ *
1140
1215
  * @vuese
1141
1216
  */
1142
1217
  viewRegion: function (names) {
@@ -1227,7 +1302,7 @@ export default {
1227
1302
  },
1228
1303
  /**
1229
1304
  * Return renderer information
1230
- *
1305
+ *
1231
1306
  * @vuese
1232
1307
  */
1233
1308
  getRendererInfo: function () {
@@ -1421,7 +1496,7 @@ export default {
1421
1496
  *
1422
1497
  * @arg Selected zinc objects
1423
1498
  * @arg Flag to determine if callback should be triggered when new selection
1424
- * is made
1499
+ * is made
1425
1500
  */
1426
1501
  objectSelected: function (objects, propagate) {
1427
1502
  this.updatePrimitiveControls(objects);
@@ -1432,7 +1507,7 @@ export default {
1432
1507
  *
1433
1508
  * @arg Hovered zinc objects
1434
1509
  * @arg Flag to determine if callback should be triggered when new selection
1435
- * is made
1510
+ * is made
1436
1511
  */
1437
1512
  objectHovered: function (objects, propagate) {
1438
1513
  this.hoveredObjects = objects;
@@ -1485,11 +1560,68 @@ export default {
1485
1560
  * Function to toggle on/off overlay help.
1486
1561
  */
1487
1562
  setHelpMode: function (helpMode) {
1488
- 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) {
1489
1606
  this.inHelp = true;
1490
1607
  this.hoverVisibilities.forEach((item) => {
1491
1608
  item.value = true;
1492
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
+ }
1493
1625
  } else {
1494
1626
  this.inHelp = false;
1495
1627
  this.hoverVisibilities.forEach((item) => {
@@ -1730,25 +1862,32 @@ export default {
1730
1862
  * This is called when mouse cursor enters supported elements
1731
1863
  * with help tootltips.
1732
1864
  */
1733
- showHelpText: function (helpTextNumber) {
1865
+ showHelpText: function (helpTextNumber, timeout = 500) {
1734
1866
  if (!this.inHelp) {
1735
- this.helpTextWait = setTimeout(() => {
1867
+ clearTimeout(this.helpTextWait[helpTextNumber]);
1868
+ this.helpTextWait[helpTextNumber] = setTimeout(() => {
1736
1869
  this.hoverVisibilities[helpTextNumber].value = true;
1737
- }, 500);
1870
+ /**
1871
+ * This event is emitted after a tooltip in Flatmap is shown.
1872
+ */
1873
+ this.$emit('shown-tooltip');
1874
+ }, timeout);
1738
1875
  }
1739
1876
  },
1740
1877
  /**
1741
1878
  * This is called when mouse cursor exits supported element..
1742
1879
  */
1743
- hideHelpText: function (helpTextNumber) {
1880
+ hideHelpText: function (helpTextNumber, timeout = 500) {
1744
1881
  if (!this.inHelp) {
1745
- this.hoverVisibilities[helpTextNumber].value = false;
1746
- clearTimeout(this.helpTextWait);
1882
+ clearTimeout(this.helpTextWait[helpTextNumber]);
1883
+ this.helpTextWait[helpTextNumber] = setTimeout(() => {
1884
+ this.hoverVisibilities[helpTextNumber].value = false;
1885
+ }, timeout);
1747
1886
  }
1748
1887
  },
1749
1888
  /**
1750
1889
  * @vuese
1751
- *
1890
+ *
1752
1891
  * Search a object and display the tooltip
1753
1892
  * @arg text to search across
1754
1893
  * @arg toggle the tooltip if this is set
@@ -1758,7 +1897,7 @@ export default {
1758
1897
  if (text === undefined || text === "" ||
1759
1898
  ((Array.isArray(text) && text.length === 0))
1760
1899
  ) {
1761
- this.objectSelected([], true);
1900
+ this.objectSelected([], true);
1762
1901
  return false;
1763
1902
  } else {
1764
1903
  const result = this.$_searchIndex.searchAndProcessResult(text);
@@ -1788,7 +1927,7 @@ export default {
1788
1927
  },
1789
1928
  /**
1790
1929
  * @vuese
1791
- *
1930
+ *
1792
1931
  * Get the list of suggested terms based on the provided term.
1793
1932
  * This can be used for autocomplete.
1794
1933
  */
@@ -1911,7 +2050,7 @@ export default {
1911
2050
  /**
1912
2051
  * export current scene in GLTF.
1913
2052
  * @arg Return in binary form when set to true
1914
- *
2053
+ *
1915
2054
  * @vuese
1916
2055
  */
1917
2056
  exportGLTF: function (binary) {
@@ -2004,7 +2143,7 @@ export default {
2004
2143
  },
2005
2144
  /**
2006
2145
  * @vuese
2007
- *
2146
+ *
2008
2147
  * Force the renderer to resize
2009
2148
  */
2010
2149
  forceResize: function () {
@@ -2083,6 +2222,8 @@ export default {
2083
2222
  padding: 9px 10px;
2084
2223
  min-width: 150px;
2085
2224
  font-size: 12px;
2225
+ white-space: initial !important;
2226
+ text-align: initial;
2086
2227
  color: #fff;
2087
2228
  }
2088
2229
 
@@ -2315,9 +2456,9 @@ export default {
2315
2456
  &.shape {
2316
2457
  margin-left: 4px;
2317
2458
  margin-right: 4px;
2318
- color: var(--el-color-primary-light-5);
2459
+ color: var(--el-color-primary-light-5)!important;
2319
2460
  &.active {
2320
- color: var(--el-color-primary);
2461
+ color: var(--el-color-primary)!important;
2321
2462
  }
2322
2463
  }
2323
2464
  }
@@ -2389,7 +2530,7 @@ export default {
2389
2530
  border: 1px solid $app-primary-color;
2390
2531
  white-space: nowrap;
2391
2532
  min-width: unset;
2392
- width: unset!important;;
2533
+ word-break: break-word;
2393
2534
  pointer-events: none;
2394
2535
 
2395
2536
  .el-popper__arrow {
@@ -2421,7 +2562,7 @@ export default {
2421
2562
 
2422
2563
  :deep(.popper-zoomout) {
2423
2564
  padding-right: 11px;
2424
- left: -21px !important;
2565
+
2425
2566
  .popper__arrow {
2426
2567
  left: 53px !important;
2427
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('/');