@abi-software/scaffoldvuer 1.21.1-beta.2 → 2.0.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.
Files changed (45) hide show
  1. package/README.md +31 -12
  2. package/dist/index.html +9 -6
  3. package/dist/scaffoldvuer.js +14095 -13154
  4. package/dist/scaffoldvuer.umd.cjs +48 -48
  5. package/dist/style.css +1 -1
  6. package/eslint.config.js +37 -9
  7. package/package.json +10 -3
  8. package/public/index.html +9 -6
  9. package/src/App.vue +312 -279
  10. package/src/ScaffoldVuer-wc.js +4 -4
  11. package/src/app/DropZone.vue +11 -27
  12. package/src/app/ModelsInformation.js +22 -19
  13. package/src/app/ModelsTable.vue +42 -65
  14. package/src/app/TextureDemos.js +38 -64
  15. package/src/assets/_variables.scss +12 -10
  16. package/src/components/GlyphsControls.vue +3 -23
  17. package/src/components/LinesControls.vue +27 -66
  18. package/src/components/OpacityControls.vue +22 -26
  19. package/src/components/PointsControls.vue +20 -71
  20. package/src/components/PrimitiveControls.vue +35 -49
  21. package/src/components/ScaffoldOverlay.vue +63 -63
  22. package/src/components/ScaffoldTooltip.vue +36 -49
  23. package/src/components/ScaffoldTreeControls.vue +81 -129
  24. package/src/components/ScaffoldVuer.vue +509 -498
  25. package/src/components/TextureSlidesControls.vue +22 -64
  26. package/src/components/TransformationControls.vue +15 -42
  27. package/src/components/index.js +2 -2
  28. package/src/main.js +16 -18
  29. package/src/scripts/Annotation.js +3 -3
  30. package/src/scripts/BaseModule.js +26 -30
  31. package/src/scripts/EventNotifier.js +30 -36
  32. package/src/scripts/GraphicsHighlight.js +43 -50
  33. package/src/scripts/LocalFilesHelper.js +27 -26
  34. package/src/scripts/MappedNerves.js +2139 -697
  35. package/src/scripts/MappedOrgans.js +24 -25
  36. package/src/scripts/OrgansRenderer.js +445 -425
  37. package/src/scripts/RendererModule.js +133 -122
  38. package/src/scripts/Search.js +135 -151
  39. package/src/scripts/Utilities.js +129 -127
  40. package/src/scripts/WebGL.js +57 -91
  41. package/src/scripts/niftiHelper.js +3 -3
  42. package/src/store/index.js +7 -7
  43. package/vite.config.js +51 -50
  44. package/vite.static-build.js +7 -7
  45. package/vuese-generator.js +48 -56
@@ -31,7 +31,7 @@
31
31
  ref="display"
32
32
  tabindex="-1"
33
33
  style="height: 100%; width: 100%"
34
- @keydown.66="backgroundChangeCallback"
34
+ @keydown.b="backgroundChangeCallback"
35
35
  />
36
36
  <div v-show="displayUI && !isTransitioning">
37
37
  <DrawToolbar
@@ -40,7 +40,7 @@
40
40
  :toolbarOptions="toolbarOptions"
41
41
  :activeDrawTool="activeDrawTool"
42
42
  :activeDrawMode="activeDrawMode"
43
- :hoverVisibilities=hoverVisibilities
43
+ :hoverVisibilities="hoverVisibilities"
44
44
  @clickToolbar="toggleDrawing"
45
45
  @showTooltip="showHelpText"
46
46
  @hideTooltip="hideHelpText"
@@ -112,21 +112,21 @@
112
112
  @drawer-toggled="drawerToggled"
113
113
  @check-changed="$emit('check-changed', $event)"
114
114
  >
115
- <template v-slot:treeSlot>
116
- <slot name="treeSlot"></slot>
117
- <primitive-controls
118
- class="control-layer"
119
- ref="primitiveControls"
120
- :createData="createData"
121
- :viewingMode="viewingMode"
122
- :usageConfig="usageConfig"
123
- @primitivesUpdated="primitivesUpdated"
124
- />
125
- </template>
115
+ <template v-slot:treeSlot>
116
+ <slot name="treeSlot"></slot>
117
+ <primitive-controls
118
+ class="control-layer"
119
+ ref="primitiveControls"
120
+ :createData="createData"
121
+ :viewingMode="viewingMode"
122
+ :usageConfig="usageConfig"
123
+ @primitivesUpdated="primitivesUpdated"
124
+ />
125
+ </template>
126
126
  </ScaffoldTreeControls>
127
127
  </template>
128
128
  </el-popover>
129
- <!--
129
+ <!--
130
130
  <div class="primitive-controls-box">
131
131
 
132
132
  <primitive-controls
@@ -174,7 +174,7 @@
174
174
  <el-slider
175
175
  :min="0"
176
176
  :max="timeMax"
177
- :model-value="currentTime / 100 * timeMax"
177
+ :model-value="(currentTime / 100) * timeMax"
178
178
  :step="0.1"
179
179
  tooltip-class="time-slider-tooltip"
180
180
  class="slider"
@@ -300,11 +300,7 @@
300
300
  virtual-triggering
301
301
  >
302
302
  <el-row v-for="item in openMapOptions" :key="item.key">
303
- <el-button
304
- type="primary"
305
- plain
306
- @click="$emit('open-map', item.key)"
307
- >
303
+ <el-button type="primary" plain @click="$emit('open-map', item.key)">
308
304
  {{ item.display }}
309
305
  </el-button>
310
306
  </el-row>
@@ -323,23 +319,27 @@
323
319
  <div class="viewing-mode-container">
324
320
  <el-row class="backgroundText">Viewing Mode</el-row>
325
321
  <el-row class="backgroundControl">
326
- <div style="margin-bottom: 2px;">
327
- <template
328
- v-for="(value, key, index) in viewingModes"
329
- :key="key"
330
- >
331
- <template v-if="key === viewingMode">
332
- <span class="viewing-mode-title"><b >{{ key }}</b></span>
333
- </template>
334
- <template v-else>
335
- <span class="viewing-mode-unselected" @click="changeViewingMode(key)">{{ key }}</span>
336
- </template>
322
+ <div style="margin-bottom: 2px">
323
+ <template v-for="(value, key) in viewingModes" :key="key">
324
+ <template v-if="key === viewingMode">
325
+ <span class="viewing-mode-title">
326
+ <b>{{ key }}</b>
327
+ </span>
328
+ </template>
329
+ <template v-else>
330
+ <span class="viewing-mode-unselected" @click="changeViewingMode(key)">
331
+ {{ key }}
332
+ </span>
333
+ </template>
337
334
  </template>
338
335
  </div>
339
336
  <el-row class="viewing-mode-description">
340
337
  {{ modeDescription }}
341
338
  </el-row>
342
- <el-row v-if="viewingMode === 'Annotation' && offlineAnnotationEnabled" class="viewing-mode-description">
339
+ <el-row
340
+ v-if="viewingMode === 'Annotation' && offlineAnnotationEnabled"
341
+ class="viewing-mode-description"
342
+ >
343
343
  (Anonymous annotate)
344
344
  </el-row>
345
345
  </el-row>
@@ -374,26 +374,19 @@
374
374
  </div>
375
375
  <div class="background-colour-container">
376
376
  <el-row class="backgroundSpacer"></el-row>
377
- <el-row class="backgroundText"> Change background </el-row>
377
+ <el-row class="backgroundText">Change background</el-row>
378
378
  <el-row class="backgroundChooser">
379
379
  <div
380
380
  v-for="item in availableBackground"
381
381
  :key="item"
382
- :class="[
383
- 'backgroundChoice',
384
- item,
385
- item == currentBackground ? 'active' : '',
386
- ]"
382
+ :class="['backgroundChoice', item, item == currentBackground ? 'active' : '']"
387
383
  @click="backgroundChangeCallback(item)"
388
384
  />
389
385
  </el-row>
390
386
  </div>
391
387
  </div>
392
388
  </el-popover>
393
- <div
394
- class="settings-group control-layer"
395
- :class="{ open: drawerOpen, close: !drawerOpen }"
396
- >
389
+ <div class="settings-group control-layer" :class="{ open: drawerOpen, close: !drawerOpen }">
397
390
  <el-row v-if="showOpenMapButton">
398
391
  <el-popover
399
392
  :visible="hoverVisibilities[3].value"
@@ -445,21 +438,16 @@
445
438
  </template>
446
439
 
447
440
  <script>
448
- /* eslint-disable no-alert, no-console */
449
441
  import { inject, markRaw, provide, shallowRef } from 'vue';
450
- import {
451
- WarningFilled as ElIconWarningFilled,
452
- ArrowDown as ElIconArrowDown,
453
- ArrowLeft as ElIconArrowLeft,
454
- } from '@element-plus/icons-vue'
455
- import PrimitiveControls from "./PrimitiveControls.vue";
456
- import ScaffoldOverlay from "./ScaffoldOverlay.vue";
457
- import { readNIFTIFromSource } from "../scripts/niftiHelper.js"
458
- import ScaffoldTooltip from "./ScaffoldTooltip.vue";
459
- import ScaffoldTreeControls from "./ScaffoldTreeControls.vue";
460
- import { MapSvgIcon, MapSvgSpriteColor } from "@abi-software/svg-sprite";
461
- import { DrawToolbar } from '@abi-software/map-utilities'
462
- import '@abi-software/map-utilities/dist/style.css'
442
+ import { WarningFilled as ElIconWarningFilled } from '@element-plus/icons-vue';
443
+ import PrimitiveControls from './PrimitiveControls.vue';
444
+ import ScaffoldOverlay from './ScaffoldOverlay.vue';
445
+ import { readNIFTIFromSource } from '../scripts/niftiHelper.js';
446
+ import ScaffoldTooltip from './ScaffoldTooltip.vue';
447
+ import ScaffoldTreeControls from './ScaffoldTreeControls.vue';
448
+ import { MapSvgIcon, MapSvgSpriteColor } from '@abi-software/svg-sprite';
449
+ import { DrawToolbar } from '@abi-software/map-utilities';
450
+ import '@abi-software/map-utilities/dist/style.css';
463
451
  import {
464
452
  createNewAnnotationsWithFeatures,
465
453
  addUserAnnotationWithFeature,
@@ -472,39 +460,18 @@ import {
472
460
  getObjectsFromAnnotations,
473
461
  findObjectsWithNames,
474
462
  updateBoundingBox,
475
- } from "../scripts/Utilities.js";
476
- import {
477
- ElButton as Button,
478
- ElCol as Col,
479
- ElLoading as Loading,
480
- ElRadio as Radio,
481
- ElRadioGroup as RadioGroup,
482
- ElOption as Option,
483
- ElPopover as Popover,
484
- ElRow as Row,
485
- ElSelect as Select,
486
- ElSlider as Slider,
487
- ElTabPane as TabPane,
488
- ElTabs as Tabs,
489
- } from "element-plus";
463
+ } from '../scripts/Utilities.js';
490
464
  import { AnnotationService } from '@abi-software/sparc-annotation';
491
- import { EventNotifier } from "../scripts/EventNotifier.js";
492
- import { OrgansViewer } from "../scripts/OrgansRenderer.js";
493
- import { SearchIndex } from "../scripts/Search.js";
465
+ import { EventNotifier } from '../scripts/EventNotifier.js';
466
+ import { OrgansViewer } from '../scripts/OrgansRenderer.js';
467
+ import { SearchIndex } from '../scripts/Search.js';
494
468
  import { mapState, mapStores } from 'pinia';
495
- import { useMainStore } from "@/store/index";
496
- import { getNerveMaps } from "../scripts/MappedNerves.js";
469
+ import { useMainStore } from '@/store/index';
470
+ import { getNerveMaps } from '../scripts/MappedNerves.js';
497
471
  import { getOrganMaps } from '../scripts/MappedOrgans.js';
498
472
  const nervesMap = getNerveMaps();
499
473
  const organsMap = getOrganMaps();
500
- let foundNerves = 0;
501
-
502
- const haveSameElements = (arr1, arr2) => {
503
- if (arr1.length !== arr2.length) return false;
504
- return arr1.sort().every((value, index) => {
505
- return value === arr2.sort()[index]
506
- });
507
- }
474
+ // let foundNerves = 0;
508
475
 
509
476
  /**
510
477
  * A vue component of the scaffold viewer.
@@ -513,51 +480,37 @@ const haveSameElements = (arr1, arr2) => {
513
480
  * @requires ./TreeControls.vue
514
481
  */
515
482
  export default {
516
- name: "ScaffoldVuer",
483
+ name: 'ScaffoldVuer',
517
484
  components: {
518
- Button,
519
- Col,
520
- Loading,
521
- Option,
522
- Popover,
523
- Radio,
524
- RadioGroup,
525
- Row,
526
485
  ScaffoldOverlay,
527
- Select,
528
- Slider,
529
- TabPane,
530
- Tabs,
531
486
  MapSvgIcon,
532
487
  MapSvgSpriteColor,
533
488
  PrimitiveControls,
534
489
  ScaffoldTooltip,
535
490
  ElIconWarningFilled,
536
- ElIconArrowDown,
537
- ElIconArrowLeft,
538
491
  DrawToolbar,
539
- ScaffoldTreeControls
492
+ ScaffoldTreeControls,
540
493
  },
541
494
  setup(props) {
542
- let annotator = inject('$annotator')
495
+ let annotator = inject('$annotator');
543
496
  if (!annotator) {
544
497
  annotator = markRaw(new AnnotationService(`${props.flatmapAPI}annotator`));
545
- provide('$annotator', annotator)
498
+ provide('$annotator', annotator);
546
499
  }
547
- return { annotator }
500
+ return { annotator };
548
501
  },
549
502
  props: {
550
503
  /**
551
- * The option to edit annotation regardless of whether
552
- * resources matches or not
553
- */
554
- annotationIgnoreResource: {
504
+ * The option to edit annotation regardless of whether
505
+ * resources matches or not
506
+ */
507
+ annotationIgnoreResource: {
555
508
  type: Boolean,
556
509
  default: false,
557
510
  },
558
511
  /**
559
- * The option to show annotation information in sidebar
560
- */
512
+ * The option to show annotation information in sidebar
513
+ */
561
514
  annotationSidebar: {
562
515
  type: Boolean,
563
516
  default: false,
@@ -570,7 +523,7 @@ export default {
570
523
  */
571
524
  url: {
572
525
  type: String,
573
- default: "",
526
+ default: '',
574
527
  },
575
528
  /**
576
529
  * Show the colour control of set to true.
@@ -646,7 +599,7 @@ export default {
646
599
  */
647
600
  warningMessage: {
648
601
  type: String,
649
- default: "Beta feature - under active development",
602
+ default: 'Beta feature - under active development',
650
603
  },
651
604
  displayLatestChanges: {
652
605
  type: Boolean,
@@ -654,7 +607,7 @@ export default {
654
607
  },
655
608
  latestChangesMessage: {
656
609
  type: String,
657
- default: "New feature - Local search is now available",
610
+ default: 'New feature - Local search is now available',
658
611
  },
659
612
  /**
660
613
  * Show/hide pickable markers for regions.
@@ -684,11 +637,11 @@ export default {
684
637
  * the image in imgURL as marker instead.
685
638
  *
686
639
  */
687
- markerLabels : {
640
+ markerLabels: {
688
641
  type: Object,
689
642
  default: function () {
690
- return {}
691
- }
643
+ return {};
644
+ },
692
645
  },
693
646
  /**
694
647
  * Show/hide minimap.
@@ -702,7 +655,7 @@ export default {
702
655
  */
703
656
  format: {
704
657
  type: String,
705
- default: "metadata",
658
+ default: 'metadata',
706
659
  },
707
660
  /**
708
661
  * Settings for minimap position, size and alignment.
@@ -715,7 +668,7 @@ export default {
715
668
  y_offset: 16,
716
669
  width: 128,
717
670
  height: 128,
718
- align: "top-right",
671
+ align: 'top-right',
719
672
  };
720
673
  },
721
674
  },
@@ -742,7 +695,7 @@ export default {
742
695
  type: Object,
743
696
  default: function () {
744
697
  return {
745
- regions: ["nerves"]
698
+ regions: ['nerves'],
746
699
  };
747
700
  },
748
701
  },
@@ -755,18 +708,18 @@ export default {
755
708
  default: function () {
756
709
  return [
757
710
  {
758
- display: "Open AC Map",
759
- key: "AC"
711
+ display: 'Open AC Map',
712
+ key: 'AC',
760
713
  },
761
714
  {
762
- display: "Open FC Map",
763
- key: "FC"
715
+ display: 'Open FC Map',
716
+ key: 'FC',
764
717
  },
765
718
  {
766
- display: "Open 3D Human Map",
767
- key: "3D"
719
+ display: 'Open 3D Human Map',
720
+ key: '3D',
768
721
  },
769
- ]
722
+ ];
770
723
  },
771
724
  },
772
725
  /**
@@ -782,7 +735,7 @@ export default {
782
735
  */
783
736
  region: {
784
737
  type: String,
785
- default: "",
738
+ default: '',
786
739
  },
787
740
  /**
788
741
  * Optional prop for an URL of containing information of a viewport.
@@ -791,7 +744,7 @@ export default {
791
744
  */
792
745
  viewURL: {
793
746
  type: String,
794
- default: "",
747
+ default: '',
795
748
  },
796
749
  /**
797
750
  * Settings for turning on/off rendering
@@ -800,6 +753,16 @@ export default {
800
753
  type: Boolean,
801
754
  default: true,
802
755
  },
756
+ /**
757
+ * If this flag is set to true, renderer will only be redrawn when changes are
758
+ * made through ZincJS APIs or time is running. Any external change made to the scene will require
759
+ * invalidate() be called on object, region, scene and renderer in order to be redrawn.
760
+ *
761
+ */
762
+ renderOnDemand: {
763
+ type: Boolean,
764
+ default: true,
765
+ },
803
766
  /**
804
767
  * Specify the endpoint of the flatmap server.
805
768
  * This is used by annotation service included in
@@ -807,7 +770,7 @@ export default {
807
770
  */
808
771
  flatmapAPI: {
809
772
  type: String,
810
- default: "https://mapcore-demo.org/current/flatmap/v3/"
773
+ default: 'https://mapcore-demo.org/current/flatmap/v3/',
811
774
  },
812
775
  /**
813
776
  * The option to show local settings UI
@@ -846,7 +809,6 @@ export default {
846
809
  },
847
810
  data: function () {
848
811
  return {
849
- annotator: undefined,
850
812
  clientHeight: 300,
851
813
  colourRadio: true,
852
814
  createData: {
@@ -855,13 +817,13 @@ export default {
855
817
  toBeConfirmed: false,
856
818
  points: [],
857
819
  tempGroupName: undefined,
858
- shape: "",
820
+ shape: '',
859
821
  x: 0,
860
822
  y: 0,
861
823
  editingIndex: -1,
862
824
  faceIndex: -1,
863
825
  toBeDeleted: false,
864
- regionPrefix: "__annotation"
826
+ regionPrefix: '__annotation',
865
827
  },
866
828
  currentTime: 0.0,
867
829
  timeVarying: false,
@@ -892,37 +854,37 @@ export default {
892
854
  loading: false,
893
855
  duration: 3000,
894
856
  drawerOpen: true,
895
- currentBackground: "white",
896
- availableBackground: ["white", "lightskyblue", "black"],
857
+ currentBackground: 'white',
858
+ availableBackground: ['white', 'lightskyblue', 'black'],
897
859
  minimisedSlider: false,
898
- sliderPosition: "",
860
+ sliderPosition: '',
899
861
  timeMax: 100,
900
- orginalDuration: "",
901
- animateDuration: "6secs",
862
+ orginalDuration: '',
863
+ animateDuration: '6secs',
902
864
  playSpeed: [
903
865
  {
904
866
  value: 0.1,
905
- label: "0.1x",
867
+ label: '0.1x',
906
868
  },
907
869
  {
908
870
  value: 0.5,
909
- label: "0.5x",
871
+ label: '0.5x',
910
872
  },
911
873
  {
912
874
  value: 1,
913
- label: "1x",
875
+ label: '1x',
914
876
  },
915
877
  {
916
878
  value: 2,
917
- label: "2x",
879
+ label: '2x',
918
880
  },
919
881
  {
920
882
  value: 5,
921
- label: "5x",
883
+ label: '5x',
922
884
  },
923
885
  {
924
886
  value: 10,
925
- label: "10x",
887
+ label: '10x',
926
888
  },
927
889
  ],
928
890
  currentSpeed: 1,
@@ -930,20 +892,21 @@ export default {
930
892
  defaultCheckedKeys: [],
931
893
  outlinesRadio: true,
932
894
  tData: {
933
- label: "",
934
- region: "",
895
+ label: '',
896
+ region: '',
935
897
  visible: false,
936
898
  x: 200,
937
899
  y: 200,
938
900
  active: false,
939
901
  },
940
- fileFormat: "metadata",
902
+ fileFormat: 'metadata',
941
903
  previousMarkerLabels: markRaw({}),
942
- viewingMode: "Exploration",
904
+ viewingMode: 'Exploration',
943
905
  viewingModes: {
944
- "Exploration": "View and explore detailed visualization of 3D scaffolds",
945
- "Neuron Connection": "Discover nerve connections by selecting a nerve and viewing its associated connections",
946
- "Annotation": ['View feature annotations', 'Add, comment on and view feature annotations'],
906
+ Exploration: 'View and explore detailed visualization of 3D scaffolds',
907
+ 'Neuron Connection':
908
+ 'Discover nerve connections by selecting a nerve and viewing its associated connections',
909
+ Annotation: ['View feature annotations', 'Add, comment on and view feature annotations'],
947
910
  },
948
911
  openMapRef: undefined,
949
912
  backgroundIconRef: undefined,
@@ -951,25 +914,21 @@ export default {
951
914
  offlineAnnotationEnabled: false,
952
915
  offlineAnnotations: markRaw([]),
953
916
  authorisedUser: undefined,
954
- toolbarOptions: [
955
- "Delete",
956
- "Edit",
957
- "Point",
958
- "LineString",
959
- ],
917
+ toolbarOptions: ['Delete', 'Edit', 'Point', 'LineString'],
960
918
  existDrawnFeatures: markRaw([]), // Store all exist drawn features
961
919
  activeDrawTool: undefined,
962
920
  activeDrawMode: undefined,
963
921
  boundingDims: {
964
922
  centre: [0, 0, 0],
965
- size:[1, 1, 1],
923
+ size: [1, 1, 1],
966
924
  },
967
925
  lastSelected: markRaw({
968
- region: "",
969
- group: "",
926
+ region: '',
927
+ group: '',
970
928
  isSearch: false,
971
929
  }),
972
930
  //checkedRegions: []
931
+ unwatchRenderOnDemand: null,
973
932
  unwatchURL: null,
974
933
  unwatchRegion: null,
975
934
  unwatchState: null,
@@ -987,8 +946,7 @@ export default {
987
946
  /*
988
947
  url: {
989
948
  handler: function (newValue) {
990
- if (this.state === undefined || this.state.url === undefined)
991
- this.setURL(newValue);
949
+ if (this.state === undefined || this.state.url === undefined) this.setURL(newValue);
992
950
  },
993
951
  immediate: true,
994
952
  },
@@ -1020,7 +978,7 @@ export default {
1020
978
  */
1021
979
  helpMode: function (newVal, oldVal) {
1022
980
  if (newVal !== oldVal) {
1023
- this.setHelpMode(newVal)
981
+ this.setHelpMode(newVal);
1024
982
  }
1025
983
  },
1026
984
  helpModeActiveItem: function () {
@@ -1045,7 +1003,7 @@ export default {
1045
1003
  * Emit when time in the current scene has changed
1046
1004
  * @arg {String} "Current time in scene"
1047
1005
  */
1048
- this.$emit("timeChanged", this.currentTime);
1006
+ this.$emit('timeChanged', this.currentTime);
1049
1007
  },
1050
1008
  },
1051
1009
  duration: function () {
@@ -1053,28 +1011,28 @@ export default {
1053
1011
  },
1054
1012
  minimapSettings: {
1055
1013
  deep: true,
1056
- handler: "updateMinimapScissor",
1014
+ handler: 'updateMinimapScissor',
1057
1015
  },
1058
1016
  render: function (val) {
1059
1017
  this.toggleRendering(val);
1060
1018
  },
1061
- markerLabels: function(labels) {
1019
+ markerLabels: function (labels) {
1062
1020
  for (const [key, value] of Object.entries(this.previousMarkerLabels)) {
1063
- this.setMarkerModeForObjectsWithName(key, value, "off");
1021
+ this.setMarkerModeForObjectsWithName(key, value, 'off');
1064
1022
  }
1065
1023
  for (const [key, value] of Object.entries(labels)) {
1066
- this.setMarkerModeForObjectsWithName(key, value, "on");
1024
+ this.setMarkerModeForObjectsWithName(key, value, 'on');
1067
1025
  }
1068
- this.previousMarkerLabels = markRaw({...labels});
1026
+ this.previousMarkerLabels = markRaw({ ...labels });
1069
1027
  },
1070
1028
  },
1071
1029
  beforeCreate: function () {
1072
1030
  this.$module = new OrgansViewer();
1073
1031
  this.selectedObjects = [];
1074
1032
  this.hoveredObjects = [];
1075
- this.currentBackground = "white";
1033
+ this.currentBackground = 'white';
1076
1034
  this._currentURL = undefined;
1077
- this.availableBackground = ["white", "black", "lightskyblue"];
1035
+ this.availableBackground = ['white', 'black', 'lightskyblue'];
1078
1036
  this.$_searchIndex = new SearchIndex();
1079
1037
  },
1080
1038
  mounted: async function () {
@@ -1088,27 +1046,24 @@ export default {
1088
1046
  await this.$module.initialise(this.$refs.display);
1089
1047
  this.toggleRendering(this.render);
1090
1048
  this.clientHeight = this.$refs.scaffoldContainer.$el.clientHeight;
1091
- this.ro = new ResizeObserver(this.adjustLayout).observe(
1092
- this.$refs.scaffoldContainer.$el
1093
- );
1049
+ this.ro = new ResizeObserver(this.adjustLayout).observe(this.$refs.scaffoldContainer.$el);
1094
1050
  this.helpTextWait = [];
1095
1051
  this.helpTextWait.length = this.hoverVisibilities.length;
1096
1052
  this.defaultRate = this.$module.getPlayRate();
1097
1053
  this.$module.zincRenderer.addPreRenderCallbackFunction(() => {
1098
1054
  this.currentTime = this.$module.getCurrentTime();
1099
- })
1055
+ });
1100
1056
  this.$module.zincRenderer.addContextRestoredCallbackFunction(() => {
1101
1057
  this.backgroundChangeCallback(this.currentBackground);
1102
- })
1058
+ });
1103
1059
  //Setup some watchers that depend on threejs init()
1104
- this.unwatchURL = this.$watch(
1105
- 'url',
1106
- (newVal) => {
1107
- if (this.state === undefined || this.state.url === undefined) {
1108
- this.setURL(newVal);
1109
- }
1060
+ this.unwatchRenderOnDemand = this.$watch(
1061
+ 'renderOnDemand',
1062
+ (renderOnDemand) => {
1063
+ //Older versions of ZincJS do not support render on demand
1064
+ this.$module.zincRenderer.setRenderOnDemand?.(renderOnDemand);
1110
1065
  },
1111
- { immediate: true } // Runs immediately after creation, if desired
1066
+ { immediate: true },
1112
1067
  );
1113
1068
  this.unwatchRegion = this.$watch(
1114
1069
  'region',
@@ -1117,21 +1072,21 @@ export default {
1117
1072
  this.setFocusedRegion(region);
1118
1073
  }
1119
1074
  },
1120
- { immediate: true }
1075
+ { immediate: true },
1121
1076
  );
1122
1077
  this.unwatchState = this.$watch(
1123
1078
  'state',
1124
1079
  (state) => {
1125
1080
  this.setState(state);
1126
1081
  },
1127
- { deep: true, immediate: true }
1082
+ { deep: true, immediate: true },
1128
1083
  );
1129
1084
  this.unwatchViewURL = this.$watch(
1130
1085
  'viewURL',
1131
1086
  (viewURL) => {
1132
1087
  this.updateViewURL(viewURL);
1133
1088
  },
1134
- { immediate: true }
1089
+ { immediate: true },
1135
1090
  );
1136
1091
  this.unwatchURL = this.$watch(
1137
1092
  'url',
@@ -1140,17 +1095,18 @@ export default {
1140
1095
  this.setURL(newValue);
1141
1096
  }
1142
1097
  },
1143
- { immediate: true }
1098
+ { immediate: true },
1144
1099
  );
1145
1100
  this.unwatchMarkerCluster = this.$watch(
1146
1101
  'markerCluster',
1147
1102
  (val) => {
1148
1103
  this.$module.scene.enableMarkerCluster(val);
1149
1104
  },
1150
- { immediate: true }
1105
+ { immediate: true },
1151
1106
  );
1152
1107
  },
1153
1108
  beforeUnmount: function () {
1109
+ if (this.unwatchRenderOnDemand) this.unwatchRenderOnDemand();
1154
1110
  if (this.unwatchURL) this.unwatchURL();
1155
1111
  if (this.unwatchRegion) this.unwatchRegion();
1156
1112
  if (this.unwatchState) this.unwatchState();
@@ -1162,22 +1118,26 @@ export default {
1162
1118
  },
1163
1119
  computed: {
1164
1120
  ...mapStores(useMainStore),
1165
- ...mapState(useMainStore, ['userToken']),
1166
- annotationDisplay: function() {
1167
- return this.viewingMode === 'Annotation' && this.tData.active === true &&
1168
- (this.activeDrawMode !== "Point" && this.activeDrawMode !== 'LineString');
1121
+ ...mapState(useMainStore, ['userToken']),
1122
+ annotationDisplay: function () {
1123
+ return (
1124
+ this.viewingMode === 'Annotation' &&
1125
+ this.tData.active === true &&
1126
+ this.activeDrawMode !== 'Point' &&
1127
+ this.activeDrawMode !== 'LineString'
1128
+ );
1169
1129
  },
1170
- enableColourPicker: function() {
1130
+ enableColourPicker: function () {
1171
1131
  return this.showColourPicker && this.colourRadio;
1172
1132
  },
1173
1133
  modeDescription: function () {
1174
1134
  let description = this.viewingModes[this.viewingMode];
1175
1135
  if (this.viewingMode === 'Annotation') {
1176
1136
  if (this.authorisedUser) {
1177
- return description[1]
1137
+ return description[1];
1178
1138
  }
1179
- return description[0]
1180
- };
1139
+ return description[0];
1140
+ }
1181
1141
  return description;
1182
1142
  },
1183
1143
  },
@@ -1250,11 +1210,7 @@ export default {
1250
1210
  }
1251
1211
  const morph = zincObject.getGroup();
1252
1212
  if (morph && morph.position) {
1253
- zincObject.userData.originalPos = [
1254
- morph.position.x,
1255
- morph.position.y,
1256
- morph.position.z
1257
- ];
1213
+ zincObject.userData.originalPos = [morph.position.x, morph.position.y, morph.position.z];
1258
1214
  } else {
1259
1215
  zincObject.userData.originalPos = [0, 0, 0];
1260
1216
  }
@@ -1268,7 +1224,7 @@ export default {
1268
1224
  zincObject.userData.defaultColour = `#${zincObject.getColourHex()}`;
1269
1225
  zincObject.userData.isGreyScale = false;
1270
1226
  if (groupName in nervesMap) {
1271
- foundNerves++;
1227
+ // foundNerves++;
1272
1228
  zincObject.setAnatomicalId(nervesMap[groupName]);
1273
1229
  }
1274
1230
  } else {
@@ -1283,18 +1239,17 @@ export default {
1283
1239
  * Emit when a new object is added to the scene
1284
1240
  * @arg {Object} "The object added to the sceene"
1285
1241
  */
1286
- this.$emit("zinc-object-added", zincObject);
1242
+ this.$emit('zinc-object-added', zincObject);
1287
1243
  },
1288
1244
  /**
1289
1245
  * Internal only.
1290
1246
  * Remove an entry matching region and group from
1291
1247
  * local annotation list.
1292
1248
  */
1293
- removeFromOfflineAnnotation: function(regionPath, groupName) {
1249
+ removeFromOfflineAnnotation: function (regionPath, groupName) {
1294
1250
  for (let i = 0; i < this.offlineAnnotations.length; i++) {
1295
1251
  const annotation = this.offlineAnnotations[i];
1296
- if (annotation.region === regionPath &&
1297
- annotation.group === groupName) {
1252
+ if (annotation.region === regionPath && annotation.group === groupName) {
1298
1253
  this.offlineAnnotations.splice(i, 1);
1299
1254
  return;
1300
1255
  }
@@ -1303,7 +1258,7 @@ export default {
1303
1258
  /**
1304
1259
  * Rename Zinc Object
1305
1260
  */
1306
- renameZincObject: function (zincObject, newName) {
1261
+ renameZincObject: function (zincObject, newName) {
1307
1262
  if (this.$module.scene) {
1308
1263
  const scaffoldTreeControls = this.$refs.scaffoldTreeControls;
1309
1264
  const oldName = zincObject.groupName;
@@ -1334,7 +1289,7 @@ export default {
1334
1289
  addRegionsToSearchIndex: function () {
1335
1290
  const rootRegion = this.$module.scene.getRootRegion();
1336
1291
  const regions = rootRegion.getChildRegions(true);
1337
- regions.forEach(region => {
1292
+ regions.forEach((region) => {
1338
1293
  this.$_searchIndex.addRegion(region, region.uuid);
1339
1294
  });
1340
1295
  },
@@ -1347,9 +1302,9 @@ export default {
1347
1302
  */
1348
1303
  backgroundChangeCallback: function (colour) {
1349
1304
  this.currentBackground = colour;
1350
- this.$module.zincRenderer
1351
- .getThreeJSRenderer()
1352
- .setClearColor(this.currentBackground, 1);
1305
+ this.$module.zincRenderer.getThreeJSRenderer().setClearColor(this.currentBackground, 1);
1306
+ //The clear colour is set on the THREE.js renderer directly
1307
+ this.$module.zincRenderer.invalidate?.();
1353
1308
  },
1354
1309
  /**
1355
1310
  * Internal only.
@@ -1358,10 +1313,8 @@ export default {
1358
1313
  */
1359
1314
  captureScreenshotCallback: function (filename, width, height) {
1360
1315
  return () => {
1361
- //Remove the callback, only needs to happen once
1362
- this.$module.zincRenderer.removePostRenderCallbackFunction(
1363
- this.captureID
1364
- );
1316
+ //Remove the callback, only needs to happen once
1317
+ this.$module.zincRenderer.removePostRenderCallbackFunction(this.captureID);
1365
1318
 
1366
1319
  const renderer = this.$module.zincRenderer.getThreeJSRenderer();
1367
1320
  const camera = this.$module.scene.camera;
@@ -1376,27 +1329,30 @@ export default {
1376
1329
  camera.aspect = width / height;
1377
1330
  camera.updateProjectionMatrix();
1378
1331
  //this.$module.zincRenderer.onWindowResize();
1332
+ //Force a draw, the size and camera are changed directly
1333
+ this.$module.zincRenderer.invalidate?.();
1379
1334
  this.$module.zincRenderer.render();
1380
1335
  //renderer.render(this.$module.scene, camera);
1381
1336
 
1382
- let screenshot = renderer.domElement.toDataURL("image/png");
1337
+ let screenshot = renderer.domElement.toDataURL('image/png');
1383
1338
 
1384
1339
  renderer.setPixelRatio(originalPixelRatio);
1385
1340
  renderer.setSize(originalWidth, originalHeight, false);
1386
1341
  camera.aspect = originalAspect;
1387
1342
  camera.updateProjectionMatrix();
1388
1343
  //this.$module.zincRenderer.onWindowResize();
1344
+ this.$module.zincRenderer.invalidate?.();
1389
1345
  this.$module.zincRenderer.render();
1390
1346
  //renderer.render(this.$module.scene, camera);
1391
1347
 
1392
- let hrefElement = document.createElement("a");
1348
+ let hrefElement = document.createElement('a');
1393
1349
  //document.body.append(hrefElement);
1394
1350
  if (!filename) hrefElement.download = `screenshot.png`;
1395
1351
  else hrefElement.download = filename;
1396
1352
  hrefElement.href = screenshot;
1397
1353
  hrefElement.click();
1398
1354
  hrefElement.remove();
1399
- }
1355
+ };
1400
1356
  },
1401
1357
  /**
1402
1358
  * @public
@@ -1406,8 +1362,10 @@ export default {
1406
1362
  */
1407
1363
  captureScreenshot: function (filename, width = 1920, height = 1080) {
1408
1364
  this.captureID = this.$module.zincRenderer.addPostRenderCallbackFunction(
1409
- this.captureScreenshotCallback(filename, width, height)
1365
+ this.captureScreenshotCallback(filename, width, height),
1410
1366
  );
1367
+ //Post render callbacks only run when a frame is drawn
1368
+ this.$module.zincRenderer.invalidate?.();
1411
1369
  },
1412
1370
  /**
1413
1371
  * @public
@@ -1427,23 +1385,34 @@ export default {
1427
1385
  * @arg `comment`
1428
1386
  */
1429
1387
  addAndEditAnnotations: function (region, group, zincObject, comment) {
1430
- const annotation = addUserAnnotationWithFeature(this.annotator, this.userToken, zincObject,
1431
- region, group, this.url, comment);
1432
- this.existDrawnFeatures = markRaw(this.existDrawnFeatures.filter(feature => feature.id !== annotation.item.id));
1388
+ const annotation = addUserAnnotationWithFeature(
1389
+ this.annotator,
1390
+ this.userToken,
1391
+ zincObject,
1392
+ region,
1393
+ group,
1394
+ this.url,
1395
+ comment,
1396
+ );
1397
+ this.existDrawnFeatures = markRaw(
1398
+ this.existDrawnFeatures.filter((feature) => feature.id !== annotation.item.id),
1399
+ );
1433
1400
  this.existDrawnFeatures.push(annotation.feature);
1434
1401
  if (this.offlineAnnotationEnabled) {
1435
1402
  annotation.group = group;
1436
1403
  let regionPath = region;
1437
- if (regionPath.slice(-1) === "/") {
1404
+ if (regionPath.slice(-1) === '/') {
1438
1405
  regionPath = regionPath.slice(0, -1);
1439
1406
  }
1440
1407
  annotation.region = regionPath;
1441
1408
  this.offlineAnnotations = JSON.parse(sessionStorage.getItem('anonymous-annotation')) || [];
1442
1409
  const found = this.offlineAnnotations.find((element) => {
1443
- return element.group === annotation.group &&
1410
+ return (
1411
+ element.group === annotation.group &&
1444
1412
  element.region === annotation.region &&
1445
1413
  (this.annotationIgnoreResource || element.resource === annotation.resource) &&
1446
- element.feature.geometry.type === annotation.feature.geometry.type;
1414
+ element.feature.geometry.type === annotation.feature.geometry.type
1415
+ );
1447
1416
  });
1448
1417
  if (found) {
1449
1418
  Object.assign(found, annotation);
@@ -1452,7 +1421,7 @@ export default {
1452
1421
  }
1453
1422
  sessionStorage.setItem('anonymous-annotation', JSON.stringify(this.offlineAnnotations));
1454
1423
  }
1455
- this.$emit('userPrimitivesUpdated', {region, group, zincObject});
1424
+ this.$emit('userPrimitivesUpdated', { region, group, zincObject });
1456
1425
  },
1457
1426
  /**
1458
1427
  * @public
@@ -1462,34 +1431,45 @@ export default {
1462
1431
  * @arg `zincObject`,
1463
1432
  * @arg `oldName`
1464
1433
  */
1465
- renameAnnotations: function (region, group, zincObject, oldName) {
1434
+ renameAnnotations: function (region, group, zincObject, oldName) {
1466
1435
  //Pending support for online annotation
1467
- let regionPath = region.slice(-1) === "/" ? region : region + "/";
1436
+ let regionPath = region.slice(-1) === '/' ? region : region + '/';
1468
1437
  const oldFeatureID = regionPath + oldName;
1469
- const annotation = addUserAnnotationWithFeature(this.annotator, this.userToken, zincObject,
1470
- region, group, this.url, `Rename from ${oldFeatureID}`);
1471
- this.existDrawnFeatures = markRaw(this.existDrawnFeatures.filter(feature => feature.id !== oldFeatureID));
1438
+ const annotation = addUserAnnotationWithFeature(
1439
+ this.annotator,
1440
+ this.userToken,
1441
+ zincObject,
1442
+ region,
1443
+ group,
1444
+ this.url,
1445
+ `Rename from ${oldFeatureID}`,
1446
+ );
1447
+ this.existDrawnFeatures = markRaw(
1448
+ this.existDrawnFeatures.filter((feature) => feature.id !== oldFeatureID),
1449
+ );
1472
1450
  this.existDrawnFeatures.push(annotation.feature);
1473
1451
  if (this.offlineAnnotationEnabled) {
1474
1452
  annotation.group = group;
1475
1453
  regionPath = region;
1476
- if (regionPath.slice(-1) === "/") {
1454
+ if (regionPath.slice(-1) === '/') {
1477
1455
  regionPath = regionPath.slice(0, -1);
1478
1456
  }
1479
1457
  annotation.region = regionPath;
1480
1458
  this.offlineAnnotations = JSON.parse(sessionStorage.getItem('anonymous-annotation')) || [];
1481
1459
  const found = this.offlineAnnotations.find((element) => {
1482
- return element.group === oldName &&
1483
- element.region === annotation.region &&
1484
- (this.annotationIgnoreResource || element.resource === annotation.resource) &&
1485
- element.feature.geometry.type === annotation.feature.geometry.type;
1460
+ return (
1461
+ element.group === oldName &&
1462
+ element.region === annotation.region &&
1463
+ (this.annotationIgnoreResource || element.resource === annotation.resource) &&
1464
+ element.feature.geometry.type === annotation.feature.geometry.type
1465
+ );
1486
1466
  });
1487
1467
  if (found) {
1488
1468
  Object.assign(found, annotation);
1489
1469
  }
1490
1470
  sessionStorage.setItem('anonymous-annotation', JSON.stringify(this.offlineAnnotations));
1491
1471
  }
1492
- this.$emit('userPrimitivesUpdated', {region, group, zincObject, renamedFrom: oldName});
1472
+ this.$emit('userPrimitivesUpdated', { region, group, zincObject, renamedFrom: oldName });
1493
1473
  },
1494
1474
  /**
1495
1475
  * @public
@@ -1497,11 +1477,11 @@ export default {
1497
1477
  * This is only called from callback.
1498
1478
  * @arg `object`
1499
1479
  */
1500
- primitivesUpdated: function(object) {
1480
+ primitivesUpdated: function (object) {
1501
1481
  if (object.isZincObject && object.isEditable) {
1502
1482
  const group = object.groupName;
1503
1483
  const region = object.region.getFullPath();
1504
- this.addAndEditAnnotations(region, group, object, "Position Updated");
1484
+ this.addAndEditAnnotations(region, group, object, 'Position Updated');
1505
1485
  }
1506
1486
  },
1507
1487
  /**
@@ -1509,10 +1489,10 @@ export default {
1509
1489
  * Confirm creation of new primitive. This is only called from callback.
1510
1490
  * @arg `payload`
1511
1491
  */
1512
- confirmCreate: function(payload) {
1492
+ confirmCreate: function (payload) {
1513
1493
  if (payload) {
1514
1494
  let object = undefined;
1515
- if (payload.shape === "Point") {
1495
+ if (payload.shape === 'Point') {
1516
1496
  object = this.$module.scene.createPoints(
1517
1497
  payload.region,
1518
1498
  payload.group,
@@ -1520,7 +1500,7 @@ export default {
1520
1500
  payload.group,
1521
1501
  0x0022ee,
1522
1502
  );
1523
- } else if (payload.shape === "LineString") {
1503
+ } else if (payload.shape === 'LineString') {
1524
1504
  object = this.$module.scene.createLines(
1525
1505
  payload.region,
1526
1506
  payload.group,
@@ -1539,20 +1519,23 @@ export default {
1539
1519
  editedPoint = this.createData.points[0];
1540
1520
  }
1541
1521
  }
1542
- this._editingZincObject.editVertices([editedPoint],
1543
- payload.editingIndex);
1544
- const region = this._editingZincObject.region.getFullPath() + "/";
1522
+ this._editingZincObject.editVertices([editedPoint], payload.editingIndex);
1523
+ const region = this._editingZincObject.region.getFullPath() + '/';
1545
1524
  const group = this._editingZincObject.groupName;
1546
- this.addAndEditAnnotations(region, group, this._editingZincObject, "Position Updated");
1525
+ this.addAndEditAnnotations(region, group, this._editingZincObject, 'Position Updated');
1547
1526
  }
1548
1527
  } else if (payload.renaming) {
1549
1528
  const oldGroupName = this._editingZincObject.groupName;
1550
1529
  this.renameZincObject(this._editingZincObject, payload.group);
1551
- this.renameAnnotations(payload.region, payload.group,
1552
- this._editingZincObject, oldGroupName);
1530
+ this.renameAnnotations(
1531
+ payload.region,
1532
+ payload.group,
1533
+ this._editingZincObject,
1534
+ oldGroupName,
1535
+ );
1553
1536
  }
1554
1537
  if (object) {
1555
- this.addAndEditAnnotations(payload.region, payload.group, object.zincObject, "Create");
1538
+ this.addAndEditAnnotations(payload.region, payload.group, object.zincObject, 'Create');
1556
1539
  object.zincObject.isEditable = true;
1557
1540
  this.tData.region = payload.region;
1558
1541
  this.tData.label = payload.group;
@@ -1565,7 +1548,7 @@ export default {
1565
1548
  * Internal only.
1566
1549
  * Cancel create workflows. Reset all relevant UIs and data.
1567
1550
  */
1568
- cancelCreate: function() {
1551
+ cancelCreate: function () {
1569
1552
  this.changeActiveByName(undefined);
1570
1553
  this.createData.points.length = 0;
1571
1554
  this.createData.renaming = false;
@@ -1584,8 +1567,8 @@ export default {
1584
1567
  this.$module.scene.removeTemporaryPrimitive(this._tempPoint);
1585
1568
  this._tempPoint = undefined;
1586
1569
  }
1587
- if (this.annotationSidebar){
1588
- this.$emit("annotation-close");
1570
+ if (this.annotationSidebar) {
1571
+ this.$emit('annotation-close');
1589
1572
  }
1590
1573
  },
1591
1574
  /**
@@ -1595,15 +1578,18 @@ export default {
1595
1578
  */
1596
1579
  confirmComment: function (payload) {
1597
1580
  if (this._editingZincObject) {
1598
- let annotation = payload
1581
+ let annotation = payload;
1599
1582
  if (this._editingZincObject.isEditable) {
1600
- this.existDrawnFeatures = markRaw(this.existDrawnFeatures.filter(feature => feature.id !== annotation.item.id));
1583
+ this.existDrawnFeatures = markRaw(
1584
+ this.existDrawnFeatures.filter((feature) => feature.id !== annotation.item.id),
1585
+ );
1601
1586
  this.existDrawnFeatures.push(payload.feature);
1602
1587
  }
1603
1588
  if (this.offlineAnnotationEnabled) {
1604
- annotation.group = this._editingZincObject.groupName;;
1589
+ annotation.group = this._editingZincObject.groupName;
1605
1590
  annotation.region = this._editingZincObject.region.getFullPath();
1606
- this.offlineAnnotations = JSON.parse(sessionStorage.getItem('anonymous-annotation')) || [];
1591
+ this.offlineAnnotations =
1592
+ JSON.parse(sessionStorage.getItem('anonymous-annotation')) || [];
1607
1593
  this.offlineAnnotations.push(annotation);
1608
1594
  sessionStorage.setItem('anonymous-annotation', JSON.stringify(this.offlineAnnotations));
1609
1595
  }
@@ -1616,18 +1602,27 @@ export default {
1616
1602
  */
1617
1603
  confirmDelete: function (payload) {
1618
1604
  if (this._editingZincObject?.isEditable) {
1619
- const regionPath = this._editingZincObject.region.getFullPath() + "/";
1605
+ const regionPath = this._editingZincObject.region.getFullPath() + '/';
1620
1606
  const group = this._editingZincObject.groupName;
1621
1607
  let toBeDeleted = true;
1622
1608
  if (payload.editingIndex > -1 && this._editingZincObject.isPointset) {
1623
1609
  toBeDeleted = 1 > this._editingZincObject.deleteVertices(payload.editingIndex);
1624
1610
  }
1625
- const message = toBeDeleted ? "Deleted" : "Removed a vertex";
1611
+ const message = toBeDeleted ? 'Deleted' : 'Removed a vertex';
1626
1612
 
1627
- const annotation = addUserAnnotationWithFeature(this.annotator, this.userToken,
1628
- this._editingZincObject, regionPath, group, this.url, message);
1613
+ const annotation = addUserAnnotationWithFeature(
1614
+ this.annotator,
1615
+ this.userToken,
1616
+ this._editingZincObject,
1617
+ regionPath,
1618
+ group,
1619
+ this.url,
1620
+ message,
1621
+ );
1629
1622
  if (annotation) {
1630
- this.existDrawnFeatures = markRaw(this.existDrawnFeatures.filter(feature => feature.id !== annotation.item.id));
1623
+ this.existDrawnFeatures = markRaw(
1624
+ this.existDrawnFeatures.filter((feature) => feature.id !== annotation.item.id),
1625
+ );
1631
1626
  if (toBeDeleted) {
1632
1627
  const childRegion = this.$module.scene.getRootRegion().findChildFromPath(regionPath);
1633
1628
  childRegion.removeZincObject(this._editingZincObject);
@@ -1635,20 +1630,25 @@ export default {
1635
1630
  if (this.offlineAnnotationEnabled) {
1636
1631
  annotation.group = group;
1637
1632
  let regionPath = payload.region;
1638
- if (regionPath.slice(-1) === "/") {
1633
+ if (regionPath.slice(-1) === '/') {
1639
1634
  regionPath = regionPath.slice(0, -1);
1640
1635
  }
1641
1636
  annotation.region = regionPath;
1642
- this.offlineAnnotations = JSON.parse(sessionStorage.getItem('anonymous-annotation')) || [];
1637
+ this.offlineAnnotations =
1638
+ JSON.parse(sessionStorage.getItem('anonymous-annotation')) || [];
1643
1639
  if (toBeDeleted) {
1644
- this.offlineAnnotations = this.offlineAnnotations.filter(offline => offline.item.id !== annotation.item.id);
1640
+ this.offlineAnnotations = this.offlineAnnotations.filter(
1641
+ (offline) => offline.item.id !== annotation.item.id,
1642
+ );
1645
1643
  } else {
1646
- //Do not remove completely if there is primitive left
1644
+ //Do not remove completely if there is primitive left
1647
1645
  const found = this.offlineAnnotations.find((element) => {
1648
- return element.group === group &&
1649
- element.region === annotation.region &&
1650
- (this.annotationIgnoreResource || element.resource === annotation.resource) &&
1651
- element.feature.geometry.type === annotation.feature.geometry.type;
1646
+ return (
1647
+ element.group === group &&
1648
+ element.region === annotation.region &&
1649
+ (this.annotationIgnoreResource || element.resource === annotation.resource) &&
1650
+ element.feature.geometry.type === annotation.feature.geometry.type
1651
+ );
1652
1652
  });
1653
1653
  Object.assign(found, annotation);
1654
1654
  this.existDrawnFeatures.push(annotation.feature);
@@ -1659,7 +1659,7 @@ export default {
1659
1659
  region: this._editingZincObject.region,
1660
1660
  group,
1661
1661
  zincObject: this._editingZincObject,
1662
- deleted: true
1662
+ deleted: true,
1663
1663
  });
1664
1664
  }
1665
1665
  }
@@ -1669,7 +1669,7 @@ export default {
1669
1669
  * Internal only.
1670
1670
  * This is triggered when tooltip is hidden
1671
1671
  */
1672
- onTooltipHide: function() {
1672
+ onTooltipHide: function () {
1673
1673
  if (this.createData.toBeConfirmed && !this.annotationSidebar) {
1674
1674
  this.cancelCreate();
1675
1675
  }
@@ -1677,12 +1677,12 @@ export default {
1677
1677
  formatTooltip(val) {
1678
1678
  if (this.timeMax >= 1000) {
1679
1679
  if (val) {
1680
- let sec = ((val % 60000) / 1000).toFixed(2) + "s";
1681
- let min = val > 60000 ? (val / 60000).toFixed(0) + "m " : "";
1680
+ let sec = ((val % 60000) / 1000).toFixed(2) + 's';
1681
+ let min = val > 60000 ? (val / 60000).toFixed(0) + 'm ' : '';
1682
1682
  return min + sec;
1683
1683
  }
1684
1684
  }
1685
- return val ? val.toFixed(2) + " ms" : "0 ms";
1685
+ return val ? val.toFixed(2) + ' ms' : '0 ms';
1686
1686
  },
1687
1687
  /**
1688
1688
  * @public
@@ -1755,7 +1755,7 @@ export default {
1755
1755
  */
1756
1756
  findObjectsWithGroupName: function (name) {
1757
1757
  let objects = [];
1758
- if (name && name != "" && this.$module.scene) {
1758
+ if (name && name != '' && this.$module.scene) {
1759
1759
  objects = this.$module.scene.findObjectsWithGroupName(name);
1760
1760
  }
1761
1761
  return objects;
@@ -1769,7 +1769,7 @@ export default {
1769
1769
  toggleDrawing: function (type, icon) {
1770
1770
  this.createData.toBeDeleted = false;
1771
1771
  if (type === 'mode') {
1772
- this.cancelCreate()
1772
+ this.cancelCreate();
1773
1773
  this.activeDrawMode = icon;
1774
1774
  this.createData.shape = '';
1775
1775
  this.$module.selectObjectOnPick = true;
@@ -1785,7 +1785,7 @@ export default {
1785
1785
  *
1786
1786
  * @public
1787
1787
  */
1788
- toggleDrawingBox: function () {
1788
+ toggleDrawingBox: function () {
1789
1789
  this.createData.drawingBox = !this.createData.drawingBox;
1790
1790
  },
1791
1791
  /**
@@ -1797,14 +1797,13 @@ export default {
1797
1797
  viewRegion: function (names) {
1798
1798
  const rootRegion = this.$module.scene.getRootRegion();
1799
1799
  const groups = Array.isArray(names) ? names : [names];
1800
- const objects = findObjectsWithNames(rootRegion, groups, "", true);
1800
+ const objects = findObjectsWithNames(rootRegion, groups, '', true);
1801
1801
  let box = this.$module.scene.getBoundingBoxOfZincObjects(objects);
1802
1802
  if (box) {
1803
1803
  if (this.$module.isSyncControl()) {
1804
1804
  this.$module.setSyncControlZoomToBox(box);
1805
1805
  } else {
1806
- const dist =
1807
- this.$module.scene.camera.far - this.$module.scene.camera.near;
1806
+ const dist = this.$module.scene.camera.far - this.$module.scene.camera.near;
1808
1807
  this.$module.scene.viewAllWithBoundingBox(box);
1809
1808
  this.$module.scene.camera.far = this.$module.scene.camera.near + dist;
1810
1809
  this.$module.scene.camera.updateProjectionMatrix();
@@ -1818,13 +1817,11 @@ export default {
1818
1817
  if (this.isReady) {
1819
1818
  this.viewRegion(name);
1820
1819
  } else {
1821
- this.$module.setFinishDownloadCallback(
1822
- this.setURLFinishCallback({ region: name })
1823
- );
1820
+ this.$module.setFinishDownloadCallback(this.setURLFinishCallback({ region: name }));
1824
1821
  }
1825
1822
  }
1826
1823
  },
1827
- setRotationMode: function(mode) {
1824
+ setRotationMode: function (mode) {
1828
1825
  if (this.$module.scene) {
1829
1826
  const cameracontrol = this.$module.scene.getZincCameraControls();
1830
1827
  cameracontrol.setRotationMode(mode);
@@ -1836,81 +1833,87 @@ export default {
1836
1833
  const url = new URL(viewURL, this.url);
1837
1834
  this.$module.scene.loadViewURL(url);
1838
1835
  } else {
1839
- this.$module.setFinishDownloadCallback(
1840
- this.setURLFinishCallback({ viewURL: viewURL })
1841
- );
1836
+ this.$module.setFinishDownloadCallback(this.setURLFinishCallback({ viewURL: viewURL }));
1842
1837
  }
1843
1838
  }
1844
1839
  },
1845
- createEditTemporaryPoint: function(identifiers) {
1840
+ createEditTemporaryPoint: function (identifiers) {
1846
1841
  const worldCoords = identifiers[0].extraData.worldCoords;
1847
1842
  if (worldCoords) {
1848
- if (this.createData.shape === "Point" || this.createData.editingIndex > -1) {
1849
- if (this.createData.points.length === 0) {
1843
+ if (this.createData.shape === 'Point' || this.createData.editingIndex > -1) {
1844
+ if (this.createData.points.length === 0) {
1850
1845
  this.showRegionTooltipWithAnnotations(identifiers, false, false);
1851
1846
  this.tData.x = 50;
1852
1847
  this.tData.y = 200;
1853
1848
  if (this._tempPoint) {
1854
- const positionAttribute = this._tempPoint.geometry.getAttribute( 'instancePosition' );
1849
+ const positionAttribute = this._tempPoint.geometry.getAttribute('instancePosition');
1855
1850
  positionAttribute.setXYZ(0, worldCoords[0], worldCoords[1], worldCoords[2]);
1856
1851
  positionAttribute.needsUpdate = true;
1857
1852
  this._tempPoint.pointPositions[0] = worldCoords[0];
1858
1853
  this._tempPoint.pointPositions[1] = worldCoords[1];
1859
1854
  this._tempPoint.pointPositions[2] = worldCoords[2];
1860
1855
  } else {
1861
- this._tempPoint = this.$module.scene.addTemporaryPoints(
1862
- [worldCoords], 0x00ffff);
1856
+ this._tempPoint = this.$module.scene.addTemporaryPoints([worldCoords], 0x00ffff);
1863
1857
  }
1864
1858
  }
1865
1859
  }
1866
1860
  }
1867
1861
  },
1868
- createEditTemporaryLines: function(identifiers) {
1862
+ createEditTemporaryLines: function (identifiers) {
1869
1863
  const worldCoords = identifiers[0].extraData.worldCoords;
1870
1864
  if (worldCoords) {
1871
- if (this.createData.shape === "LineString" ||
1872
- (this.createData.editingIndex > -1 && this.createData.faceIndex > -1)) {
1873
- if (this.createData.points.length === 1) {
1865
+ if (
1866
+ this.createData.shape === 'LineString' ||
1867
+ (this.createData.editingIndex > -1 && this.createData.faceIndex > -1)
1868
+ ) {
1869
+ if (this.createData.points.length === 1) {
1874
1870
  this.showRegionTooltipWithAnnotations(identifiers, false, false);
1875
1871
  //this.tData.x = 50;
1876
1872
  //this.tData.y = 200;
1877
1873
  if (this._tempLine) {
1878
- const positionAttribute = this._tempLine.geometry.getAttribute( 'position' );
1874
+ const positionAttribute = this._tempLine.geometry.getAttribute('position');
1879
1875
  positionAttribute.setXYZ(1, worldCoords[0], worldCoords[1], worldCoords[2]);
1880
1876
  positionAttribute.needsUpdate = true;
1881
1877
  } else {
1882
1878
  this._tempLine = this.$module.scene.addTemporaryLines(
1883
- [this.createData.points[0], worldCoords], 0x00ffff);
1879
+ [this.createData.points[0], worldCoords],
1880
+ 0x00ffff,
1881
+ );
1884
1882
  }
1885
1883
  }
1886
1884
  }
1887
1885
  }
1888
1886
  },
1889
- createEditTemporaryPrimitive: function(identifiers) {
1890
- if (this.createData.shape === "LineString" ||
1891
- (this.createData.editingIndex > -1 &&
1892
- this.createData.faceIndex > -1)) {
1887
+ createEditTemporaryPrimitive: function (identifiers) {
1888
+ if (
1889
+ this.createData.shape === 'LineString' ||
1890
+ (this.createData.editingIndex > -1 && this.createData.faceIndex > -1)
1891
+ ) {
1893
1892
  this.createEditTemporaryLines(identifiers);
1894
1893
  } else {
1895
- if (this.createData.shape === "Point" || this.createData.editingIndex > -1) {
1894
+ if (this.createData.shape === 'Point' || this.createData.editingIndex > -1) {
1896
1895
  this.createEditTemporaryPoint(identifiers);
1897
1896
  }
1898
1897
  }
1899
1898
  },
1900
- draw: function(data) {
1899
+ draw: function (data) {
1901
1900
  if (data && data.length > 0 && data[0].data.group) {
1902
1901
  if (data[0].extraData.worldCoords) {
1903
- if (this.createData.shape === "LineString" ||
1904
- (this.createData.editingIndex > -1 && this.createData.faceIndex > -1)) {
1902
+ if (
1903
+ this.createData.shape === 'LineString' ||
1904
+ (this.createData.editingIndex > -1 && this.createData.faceIndex > -1)
1905
+ ) {
1905
1906
  this.drawLine(data[0].extraData.worldCoords, data);
1906
- } else if (this.createData.shape === "Point" ||
1907
- (this.createData.editingIndex > -1 && this.createData.faceIndex === -1)) {
1907
+ } else if (
1908
+ this.createData.shape === 'Point' ||
1909
+ (this.createData.editingIndex > -1 && this.createData.faceIndex === -1)
1910
+ ) {
1908
1911
  this.drawPoint(data[0].extraData.worldCoords, data);
1909
1912
  }
1910
1913
  }
1911
1914
  }
1912
1915
  },
1913
- drawPoint: function(coords, data) {
1916
+ drawPoint: function (coords, data) {
1914
1917
  if (this.createData.toBeConfirmed === false) {
1915
1918
  this.createData.points.length = 0;
1916
1919
  this.createData.points.push(coords);
@@ -1926,11 +1929,11 @@ export default {
1926
1929
  }
1927
1930
  }
1928
1931
  },
1929
- drawLine: function(coords, data) {
1932
+ drawLine: function (coords, data) {
1930
1933
  if (this.createData.toBeConfirmed === false) {
1931
1934
  if (this.createData.points.length === 1) {
1932
1935
  this.createData.points.push(coords);
1933
- if (this.createData.editingIndex === -1 && !this.createData.renaming) {
1936
+ if (this.createData.editingIndex === -1 && !this.createData.renaming) {
1934
1937
  this.createData.tempGroupName = undefined;
1935
1938
  }
1936
1939
  this.createData.toBeConfirmed = true;
@@ -1969,7 +1972,7 @@ export default {
1969
1972
  setTimeout(this.stopFreeSpin, 4000);
1970
1973
  }
1971
1974
  },
1972
- activateDeleteMode: function(eventIdentifiers) {
1975
+ activateDeleteMode: function (eventIdentifiers) {
1973
1976
  const zincObject = getDeletableObjects(eventIdentifiers);
1974
1977
  if (zincObject) {
1975
1978
  const editing = getEditablePoint(eventIdentifiers);
@@ -1979,27 +1982,30 @@ export default {
1979
1982
  this.createData.editingIndex = editingIndex;
1980
1983
  this.createData.renaming = false;
1981
1984
  this.createData.tempGroupName = this._editingZincObject.groupName;
1982
- this.createData.regionPrefix = this._editingZincObject.region.getFullPath();
1985
+ this.createData.regionPrefix = this._editingZincObject.region.getFullPath();
1983
1986
  this.createData.toBeConfirmed = true;
1984
1987
  this.createData.toBeDeleted = true;
1985
1988
  this.tData.x = 50;
1986
1989
  this.tData.y = 200;
1987
1990
  }
1988
1991
  },
1989
- activateEditingMode: function(eventIdentifiers) {
1992
+ activateEditingMode: function (eventIdentifiers) {
1990
1993
  let editing = getEditablePoint(eventIdentifiers);
1991
1994
  if (editing) {
1992
- this.activatePointEditingMode(editing.zincObject, editing.index,
1993
- editing.point);
1995
+ this.activatePointEditingMode(editing.zincObject, editing.index, editing.point);
1994
1996
  } else {
1995
1997
  editing = getEditableLines(eventIdentifiers);
1996
1998
  if (editing) {
1997
- this.activateLineEditingMode(editing.zincObject, editing.faceIndex,
1998
- editing.vertexIndex, editing.point);
1999
+ this.activateLineEditingMode(
2000
+ editing.zincObject,
2001
+ editing.faceIndex,
2002
+ editing.vertexIndex,
2003
+ editing.point,
2004
+ );
1999
2005
  }
2000
2006
  }
2001
2007
  },
2002
- activateRenamingMode: function(eventIdentifiers) {
2008
+ activateRenamingMode: function (eventIdentifiers) {
2003
2009
  let editing = getEditablePoint(eventIdentifiers);
2004
2010
  if (!editing) {
2005
2011
  editing = getEditableLines(eventIdentifiers);
@@ -2010,7 +2016,7 @@ export default {
2010
2016
  this.createData.editingIndex = -1;
2011
2017
  this.createData.renaming = true;
2012
2018
  this.createData.tempGroupName = this._editingZincObject.groupName;
2013
- this.createData.regionPrefix = this._editingZincObject.region.getFullPath();
2019
+ this.createData.regionPrefix = this._editingZincObject.region.getFullPath();
2014
2020
  this.createData.toBeConfirmed = true;
2015
2021
  this.createData.toBeDeleted = false;
2016
2022
  this.showRegionTooltipWithAnnotations(eventIdentifiers, false, false);
@@ -2018,10 +2024,10 @@ export default {
2018
2024
  this.tData.y = 200;
2019
2025
  }
2020
2026
  },
2021
- activateAnnotationMode: function(names, event) {
2027
+ activateAnnotationMode: function (names, event) {
2022
2028
  if (this.authorisedUser || this.offlineAnnotationEnabled) {
2023
2029
  this.createData.toBeDeleted = false;
2024
- if ((this.createData.shape !== "") || (this.createData.editingIndex > -1)) {
2030
+ if (this.createData.shape !== '' || this.createData.editingIndex > -1) {
2025
2031
  // Create new shape bsaed on current settings
2026
2032
  if (names.length > 0) {
2027
2033
  if (event.identifiers[0].coords) {
@@ -2030,12 +2036,12 @@ export default {
2030
2036
  }
2031
2037
  } else {
2032
2038
  //Make sure the tooltip is displayed with annotaion mode
2033
- if (this.activeDrawMode === "Edit") {
2039
+ if (this.activeDrawMode === 'Edit') {
2034
2040
  this.activateEditingMode(event.identifiers);
2035
- } else if (this.activeDrawMode === "Delete") {
2041
+ } else if (this.activeDrawMode === 'Delete') {
2036
2042
  this.activateDeleteMode(event.identifiers);
2037
2043
  }
2038
- if (this.activeDrawMode !== "Point" && this.activeDrawMode !== "LineString") {
2044
+ if (this.activeDrawMode !== 'Point' && this.activeDrawMode !== 'LineString') {
2039
2045
  this.showRegionTooltipWithAnnotations(event.identifiers, true, false);
2040
2046
  } else {
2041
2047
  this.showRegionTooltipWithAnnotations(event.identifiers, true, true);
@@ -2045,23 +2051,23 @@ export default {
2045
2051
  this.showRegionTooltipWithAnnotations(event.identifiers, true, true);
2046
2052
  }
2047
2053
  },
2048
- activatePointEditingMode: function(zincObject, index, point) {
2054
+ activatePointEditingMode: function (zincObject, index, _point) {
2049
2055
  this._editingZincObject = zincObject;
2050
2056
  this.createData.faceIndex = -1;
2051
2057
  this.createData.renaming = false;
2052
2058
  this.createData.toBeDeleted = false;
2053
2059
  this.createData.editingIndex = index;
2054
- this.createData.regionPrefix = this._editingZincObject.region.getFullPath();
2060
+ this.createData.regionPrefix = this._editingZincObject.region.getFullPath();
2055
2061
  this.createData.tempGroupName = this._editingZincObject.groupName;
2056
2062
  //this.drawPoint(point, undefined);
2057
2063
  },
2058
- activateLineEditingMode: function(zincObject, faceIndex, vertexIndex, point) {
2064
+ activateLineEditingMode: function (zincObject, faceIndex, vertexIndex, point) {
2059
2065
  this._editingZincObject = zincObject;
2060
2066
  this.createData.faceIndex = faceIndex;
2061
2067
  this.createData.renaming = false;
2062
2068
  this.createData.toBeDeleted = false;
2063
2069
  this.createData.editingIndex = vertexIndex;
2064
- this.createData.regionPrefix = this._editingZincObject.region.getFullPath();
2070
+ this.createData.regionPrefix = this._editingZincObject.region.getFullPath();
2065
2071
  this.createData.tempGroupName = this._editingZincObject.groupName;
2066
2072
  this.drawLine(point, undefined);
2067
2073
  },
@@ -2077,9 +2083,7 @@ export default {
2077
2083
  if (event.eventType == 1 || event.eventType == 2) {
2078
2084
  event.identifiers.forEach((identifier) => {
2079
2085
  if (identifier) {
2080
- let id = identifier.data.id
2081
- ? identifier.data.id
2082
- : identifier.data.group;
2086
+ let id = identifier.data.id ? identifier.data.id : identifier.data.group;
2083
2087
  names.push(id);
2084
2088
  }
2085
2089
  });
@@ -2089,30 +2093,35 @@ export default {
2089
2093
  let regionPath = undefined;
2090
2094
  if (event.identifiers.length > 0 && event.identifiers[0]) {
2091
2095
  id = event.identifiers[0].data.id
2092
- ? event.identifiers[0].data.id
2093
- : event.identifiers[0].data.group;
2096
+ ? event.identifiers[0].data.id
2097
+ : event.identifiers[0].data.group;
2094
2098
  if (event.identifiers[0].data.region) {
2095
2099
  regionPath = event.identifiers[0].data.region;
2096
2100
  }
2097
2101
  }
2098
2102
  /*
2099
- * Event Type 1: Selected
2100
- * Event Type 2: Highlighted
2101
- * Event Type 3: Move
2102
- */
2103
+ * Event Type 1: Selected
2104
+ * Event Type 2: Highlighted
2105
+ * Event Type 3: Move
2106
+ */
2103
2107
  if (event.eventType == 1) {
2104
2108
  if (this.viewingMode === 'Annotation') {
2105
2109
  this.tData.label = id;
2106
2110
  this.tData.region = regionPath;
2107
2111
  const zincObject = getClickedObjects(event);
2108
- if (this.createData.editingIndex === -1 ) {
2112
+ if (this.createData.editingIndex === -1) {
2109
2113
  this._editingZincObject = zincObject;
2110
2114
  }
2111
2115
  if (zincObject) {
2112
- const regionPath = this._editingZincObject.region.getFullPath() + "/";
2116
+ const regionPath = this._editingZincObject.region.getFullPath() + '/';
2113
2117
  const group = this._editingZincObject.groupName;
2114
- this.annotationFeature = createNewAnnotationsWithFeatures(this._editingZincObject,
2115
- regionPath, group, this.url, '').feature;
2118
+ this.annotationFeature = createNewAnnotationsWithFeatures(
2119
+ this._editingZincObject,
2120
+ regionPath,
2121
+ group,
2122
+ this.url,
2123
+ '',
2124
+ ).feature;
2116
2125
  }
2117
2126
  this.activateAnnotationMode(names, event);
2118
2127
  } else {
@@ -2133,19 +2142,19 @@ export default {
2133
2142
  isSearch: false,
2134
2143
  region: regionPath,
2135
2144
  group: event.identifiers[0].data.group,
2136
- }
2145
+ };
2137
2146
  } else if (event.identifiers.length === 0) {
2138
2147
  this.lastSelected = {
2139
2148
  isSearch: false,
2140
- region: "",
2141
- group: "",
2142
- }
2149
+ region: '',
2150
+ group: '',
2151
+ };
2143
2152
  }
2144
2153
  /**
2145
2154
  * Emit when an object is selected
2146
2155
  * @arg {Object} "Identifier of selected objects"
2147
2156
  */
2148
- this.$emit("scaffold-selected", event.identifiers);
2157
+ this.$emit('scaffold-selected', event.identifiers);
2149
2158
  }
2150
2159
  } else if (event.eventType == 2) {
2151
2160
  this.hideRegionTooltip();
@@ -2159,7 +2168,7 @@ export default {
2159
2168
  if (event.identifiers.length > 0 && event.identifiers[0]) {
2160
2169
  if (event.identifiers[0].coords) {
2161
2170
  this.tData.active = false;
2162
- if (this.viewingMode !== "Annotation" || !this.annotationSidebar) {
2171
+ if (this.viewingMode !== 'Annotation' || !this.annotationSidebar) {
2163
2172
  this.tData.visible = true;
2164
2173
  }
2165
2174
  this.tData.label = id;
@@ -2173,13 +2182,12 @@ export default {
2173
2182
  * Emit when an object is highlighted
2174
2183
  * @arg {Object} "Identifier of selected objects"
2175
2184
  */
2176
- this.$emit("scaffold-highlighted", event.identifiers);
2185
+ this.$emit('scaffold-highlighted', event.identifiers);
2177
2186
  } else if (event.eventType == 3) {
2178
2187
  //MOVE
2179
2188
  if (event.identifiers.length > 0 && event.identifiers[0]) {
2180
2189
  if (event.identifiers[0].coords) {
2181
- const offsets =
2182
- this.$refs.scaffoldContainer.$el.getBoundingClientRect();
2190
+ const offsets = this.$refs.scaffoldContainer.$el.getBoundingClientRect();
2183
2191
  this.tData.x = event.identifiers[0].coords.x - offsets.left;
2184
2192
  this.tData.y = event.identifiers[0].coords.y - offsets.top;
2185
2193
  }
@@ -2306,7 +2314,7 @@ export default {
2306
2314
  * @arg flag Disable the checkbox when true and enable when false
2307
2315
  * @arg childrenOnly Only disable/enable any child graphics/regions
2308
2316
  */
2309
- setRegionCheckboxDisabled: function(region, flag, childrenOnly = true) {
2317
+ setRegionCheckboxDisabled: function (region, flag, childrenOnly = true) {
2310
2318
  this.$refs.scaffoldTreeControls.setRegionCheckboxDisabled(region, flag, childrenOnly);
2311
2319
  },
2312
2320
  /**
@@ -2347,10 +2355,8 @@ export default {
2347
2355
  item.value = true;
2348
2356
  });
2349
2357
  } else if (helpMode && this.helpModeDialog && toolTipsLength > this.helpModeActiveIndex) {
2350
-
2351
2358
  // Show the map tooltip as first item
2352
2359
  if (this.helpModeActiveIndex > -1) {
2353
-
2354
2360
  // wait for CSS transition
2355
2361
  setTimeout(() => {
2356
2362
  this.inHelp = false;
@@ -2372,17 +2378,11 @@ export default {
2372
2378
  * Callback function used by showRegionTooltip in the case when the tooltip
2373
2379
  * is out of view.
2374
2380
  */
2375
- displayTooltipOfObjectsCallback: function (
2376
- name,
2377
- objects,
2378
- regionPath,
2379
- resetView,
2380
- liveUpdates
2381
- ) {
2381
+ displayTooltipOfObjectsCallback: function (name, objects, regionPath, resetView, liveUpdates) {
2382
2382
  const instance = this;
2383
2383
  return function () {
2384
2384
  instance.$module.zincRenderer.removePostRenderCallbackFunction(
2385
- instance.$_regionTooltipCallback
2385
+ instance.$_regionTooltipCallback,
2386
2386
  );
2387
2387
  instance.$_regionTooltipCallback = undefined;
2388
2388
  instance.displayTooltipOfObjects(name, objects, regionPath, resetView, liveUpdates);
@@ -2396,9 +2396,7 @@ export default {
2396
2396
  },
2397
2397
  displayTooltipOfObjects: function (name, objects, regionPath, resetView, liveUpdates) {
2398
2398
  if (objects.length > 0) {
2399
- let coords = objects[0].getClosestVertexDOMElementCoords(
2400
- this.$module.scene
2401
- );
2399
+ let coords = objects[0].getClosestVertexDOMElementCoords(this.$module.scene);
2402
2400
  if (coords) {
2403
2401
  //The coords is not in view, view all if resetView flag is true
2404
2402
  if (!coords.inView) {
@@ -2409,7 +2407,7 @@ export default {
2409
2407
  //before getting the position of the tooltip.
2410
2408
  if (this.$_regionTooltipCallback) {
2411
2409
  this.$module.zincRenderer.removePostRenderCallbackFunction(
2412
- this.$_regionTooltipCallback
2410
+ this.$_regionTooltipCallback,
2413
2411
  );
2414
2412
  this.$module.$_regionTooltipCallback = undefined;
2415
2413
  }
@@ -2420,12 +2418,12 @@ export default {
2420
2418
  objects,
2421
2419
  regionPath,
2422
2420
  resetView,
2423
- liveUpdates
2424
- )
2421
+ liveUpdates,
2422
+ ),
2425
2423
  );
2426
2424
  }
2427
2425
  } else {
2428
- if (!name.includes("Search Results for")) {
2426
+ if (!name.includes('Search Results for')) {
2429
2427
  this.tData.active = true;
2430
2428
  } else {
2431
2429
  this.tData.active = false;
@@ -2437,7 +2435,7 @@ export default {
2437
2435
  this.tData.region = regionPath;
2438
2436
  if (this.$_liveCoordinatesUpdated) {
2439
2437
  this.$module.zincRenderer.removePostRenderCallbackFunction(
2440
- this.$_liveCoordinatesUpdated
2438
+ this.$_liveCoordinatesUpdated,
2441
2439
  );
2442
2440
  this.$_liveCoordinatesUpdated = undefined;
2443
2441
  }
@@ -2445,7 +2443,7 @@ export default {
2445
2443
  this.$module.setupLiveCoordinates(objects);
2446
2444
  this.$_liveCoordinatesUpdated =
2447
2445
  this.$module.zincRenderer.addPostRenderCallbackFunction(
2448
- this.liveUpdateTooltipPosition
2446
+ this.liveUpdateTooltipPosition,
2449
2447
  );
2450
2448
  }
2451
2449
  }
@@ -2462,15 +2460,15 @@ export default {
2462
2460
  * Setting liveUpdates to true will update the tooltip location
2463
2461
  * at every rendering loop.
2464
2462
  */
2465
- showRegionTooltipWithObjects: function (label, zincObjects, regionPath, resetView, liveUpdates) {
2463
+ showRegionTooltipWithObjects: function (
2464
+ label,
2465
+ zincObjects,
2466
+ regionPath,
2467
+ resetView,
2468
+ liveUpdates,
2469
+ ) {
2466
2470
  if (label && zincObjects && zincObjects.length > 0 && this.$module.scene) {
2467
- return this.displayTooltipOfObjects(
2468
- label,
2469
- zincObjects,
2470
- regionPath,
2471
- resetView,
2472
- liveUpdates
2473
- );
2471
+ return this.displayTooltipOfObjects(label, zincObjects, regionPath, resetView, liveUpdates);
2474
2472
  }
2475
2473
  this.hideRegionTooltip();
2476
2474
  return false;
@@ -2485,18 +2483,12 @@ export default {
2485
2483
  if (name && this.$module.scene) {
2486
2484
  const rootRegion = this.$module.scene.getRootRegion();
2487
2485
  const groups = [name];
2488
- const objects = findObjectsWithNames(rootRegion, groups, "", true);
2486
+ const objects = findObjectsWithNames(rootRegion, groups, '', true);
2489
2487
  let regionPath = undefined;
2490
2488
  if (objects && objects.length > 0) {
2491
2489
  regionPath = objects[0].getRegion().getFullPath();
2492
2490
  }
2493
- return this.showRegionTooltipWithObjects(
2494
- name,
2495
- objects,
2496
- regionPath,
2497
- resetView,
2498
- liveUpdates
2499
- );
2491
+ return this.showRegionTooltipWithObjects(name, objects, regionPath, resetView, liveUpdates);
2500
2492
  }
2501
2493
  this.hideRegionTooltip();
2502
2494
  return false;
@@ -2512,7 +2504,7 @@ export default {
2512
2504
  if (this.$module.scene) {
2513
2505
  const result = getObjectsFromAnnotations(this.$module.scene, annotations);
2514
2506
  if (this._editingZincObject) {
2515
- result.regionPath = this._editingZincObject.region.getFullPath() + "/";
2507
+ result.regionPath = this._editingZincObject.region.getFullPath() + '/';
2516
2508
  result.label = this._editingZincObject.groupName;
2517
2509
  }
2518
2510
  if (result && result.objects.length > 0) {
@@ -2522,24 +2514,26 @@ export default {
2522
2514
  result.objects,
2523
2515
  result.regionPath,
2524
2516
  resetView,
2525
- liveUpdates
2517
+ liveUpdates,
2526
2518
  );
2527
2519
  } else {
2528
- const region = this.tData.region ? this.tData.region +"/" : "";
2529
- const annotationEntry = [{
2530
- "featureId": region + this.tData.label,
2531
- "resourceId": this.url,
2532
- "resource": this.url,
2533
- "feature": this.annotationFeature,
2534
- "offline": this.offlineAnnotationEnabled,
2535
- }];
2520
+ const region = this.tData.region ? this.tData.region + '/' : '';
2521
+ const annotationEntry = [
2522
+ {
2523
+ featureId: region + this.tData.label,
2524
+ resourceId: this.url,
2525
+ resource: this.url,
2526
+ feature: this.annotationFeature,
2527
+ offline: this.offlineAnnotationEnabled,
2528
+ },
2529
+ ];
2536
2530
  this.$emit('annotation-open', {
2537
2531
  annotationEntry: annotationEntry,
2538
2532
  createData: this.createData,
2539
2533
  confirmCreate: this.confirmCreate,
2540
2534
  cancelCreate: this.cancelCreate,
2541
2535
  confirmDelete: this.confirmDelete,
2542
- confirmComment: this.confirmComment
2536
+ confirmComment: this.confirmComment,
2543
2537
  });
2544
2538
  return;
2545
2539
  }
@@ -2550,15 +2544,17 @@ export default {
2550
2544
  },
2551
2545
  clearAnnotationFeature: function () {
2552
2546
  const annotations = this.getOfflineAnnotations();
2553
- const featureGroups = this.existDrawnFeatures.map(feature => decodeURIComponent(feature.id).split("/").pop());
2547
+ const featureGroups = this.existDrawnFeatures.map((feature) =>
2548
+ decodeURIComponent(feature.id).split('/').pop(),
2549
+ );
2554
2550
  featureGroups.forEach((name) => {
2555
2551
  const zincObject = this.$module.scene.findObjectsWithGroupName(name, false);
2556
2552
  if (zincObject && zincObject.length) {
2557
- const regionPath = zincObject[0].region.getFullPath() + "/";
2553
+ const regionPath = zincObject[0].region.getFullPath() + '/';
2558
2554
  const childRegion = this.$module.scene.getRootRegion().findChildFromPath(regionPath);
2559
2555
  childRegion.removeZincObject(zincObject[0]);
2560
2556
  }
2561
- })
2557
+ });
2562
2558
  this.$refs.scaffoldTreeControls.removeRegion('__annotation');
2563
2559
  // Offline annotations are removed when switch viewing mode
2564
2560
  // Restore data in case need to save settings, doesn't affect anything
@@ -2568,16 +2564,22 @@ export default {
2568
2564
  let drawnFeatures;
2569
2565
  if (this.offlineAnnotationEnabled) {
2570
2566
  this.offlineAnnotations = JSON.parse(sessionStorage.getItem('anonymous-annotation')) || [];
2571
- drawnFeatures = this.offlineAnnotations.filter((offline) => {
2572
- return offline.resource === this.url && offline.feature.properties.drawn;
2573
- }).map(offline => offline.feature);
2567
+ drawnFeatures = this.offlineAnnotations
2568
+ .filter((offline) => {
2569
+ return offline.resource === this.url && offline.feature.properties.drawn;
2570
+ })
2571
+ .map((offline) => offline.feature);
2574
2572
  } else {
2575
2573
  drawnFeatures = [];
2576
2574
  const drawn = await getDrawnAnnotations(this.annotator, this.userToken, this.url);
2577
2575
  if (drawn && drawn.features) {
2578
2576
  drawnFeatures = [...drawn.features];
2579
2577
  }
2580
- const drawnEncode = await getDrawnAnnotations(this.annotator, this.userToken, encodeURIComponent(this.url));
2578
+ const drawnEncode = await getDrawnAnnotations(
2579
+ this.annotator,
2580
+ this.userToken,
2581
+ encodeURIComponent(this.url),
2582
+ );
2581
2583
  if (drawnEncode && drawnEncode.features) {
2582
2584
  drawnFeatures = [...drawnFeatures, ...drawnEncode.features];
2583
2585
  }
@@ -2596,7 +2598,7 @@ export default {
2596
2598
  this.viewingMode = modeName;
2597
2599
  }
2598
2600
  this.clearAnnotationFeature();
2599
- if (this.viewingMode === "Annotation") {
2601
+ if (this.viewingMode === 'Annotation') {
2600
2602
  this.loading = true;
2601
2603
  this.annotator.authenticate(this.userToken).then((userData) => {
2602
2604
  if (userData.name && userData.email && userData.canUpdate) {
@@ -2610,19 +2612,20 @@ export default {
2610
2612
  this.addAnnotationFeature();
2611
2613
  this.loading = false;
2612
2614
  });
2613
- } else if (this.viewingMode === "Exploration") {
2615
+ } else if (this.viewingMode === 'Exploration') {
2614
2616
  this.activeDrawTool = undefined;
2615
2617
  this.activeDrawMode = undefined;
2616
- this.createData.shape = "";
2617
- } else if (this.viewingMode === "Neuron Connection") {
2618
+ this.createData.shape = '';
2619
+ } else if (this.viewingMode === 'Neuron Connection') {
2618
2620
  // enable to make organs and nerves clickable and searchable for neuron connection mode
2619
2621
  objectIsPickable = false;
2620
2622
  }
2621
- if ((this.viewingMode === "Exploration") ||
2622
- (this.viewingMode === "Neuron Connection") ||
2623
- (this.viewingMode === "Annotation") &&
2624
- (this.createData.shape === "")) {
2625
- this.$module.selectObjectOnPick = true;
2623
+ if (
2624
+ this.viewingMode === 'Exploration' ||
2625
+ this.viewingMode === 'Neuron Connection' ||
2626
+ (this.viewingMode === 'Annotation' && this.createData.shape === '')
2627
+ ) {
2628
+ this.$module.selectObjectOnPick = true;
2626
2629
  } else {
2627
2630
  this.$module.selectObjectOnPick = false;
2628
2631
  }
@@ -2638,10 +2641,10 @@ export default {
2638
2641
  emitOfflineAnnotationUpdate: function () {
2639
2642
  this.$emit('update-offline-annotation-enabled', this.offlineAnnotationEnabled);
2640
2643
  },
2641
- forceContextRestore: function() {
2644
+ forceContextRestore: function () {
2642
2645
  this.$module.zincRenderer.forceContextRestore();
2643
2646
  },
2644
- forceContextLoss: function() {
2647
+ forceContextLoss: function () {
2645
2648
  this.$module.zincRenderer.forceContextLoss();
2646
2649
  },
2647
2650
  /**
@@ -2650,9 +2653,7 @@ export default {
2650
2653
  */
2651
2654
  hideRegionTooltip: function () {
2652
2655
  if (this.$_liveCoordinatesUpdated) {
2653
- this.$module.zincRenderer.removePostRenderCallbackFunction(
2654
- this.$_liveCoordinatesUpdated
2655
- );
2656
+ this.$module.zincRenderer.removePostRenderCallbackFunction(this.$_liveCoordinatesUpdated);
2656
2657
  //Unset the tracking
2657
2658
  this.$module.setupLiveCoordinates(undefined);
2658
2659
  this.$_liveCoordinatesUpdated = undefined;
@@ -2703,14 +2704,17 @@ export default {
2703
2704
  * @arg {Boolean} `flag`
2704
2705
  */
2705
2706
  setColour: function (flag, forced = false) {
2706
- if (this.isReady && this.$module.scene &&
2707
- typeof flag === "boolean" &&
2708
- (forced || flag !== this.colourRadio)) {
2707
+ if (
2708
+ this.isReady &&
2709
+ this.$module.scene &&
2710
+ typeof flag === 'boolean' &&
2711
+ (forced || flag !== this.colourRadio)
2712
+ ) {
2709
2713
  this.loading = true;
2710
2714
  //This can take sometime to finish , nextTick does not bring out
2711
2715
  //the loading screen so I opt for timeout loop here.
2712
2716
  setTimeout(() => {
2713
- this.setGreyScale(!flag)
2717
+ this.setGreyScale(!flag);
2714
2718
  this.loading = false;
2715
2719
  this.colourRadio = flag;
2716
2720
  }, 100);
@@ -2722,10 +2726,13 @@ export default {
2722
2726
  * The parameter ``flag`` is a boolean, ``true`` to show lines, ``false`` to hide them.
2723
2727
  * @arg {Boolean} `flag`
2724
2728
  */
2725
- setOutlines: function (flag, forced = false) {
2726
- if (this.isReady && this.$module.scene &&
2727
- typeof flag === "boolean" &&
2728
- (forced || flag !== this.outlinesRadio)) {
2729
+ setOutlines: function (flag, forced = false) {
2730
+ if (
2731
+ this.isReady &&
2732
+ this.$module.scene &&
2733
+ typeof flag === 'boolean' &&
2734
+ (forced || flag !== this.outlinesRadio)
2735
+ ) {
2729
2736
  this.outlinesRadio = flag;
2730
2737
  this.$nextTick(() => this.$refs.scaffoldTreeControls.setOutlines(flag));
2731
2738
  }
@@ -2744,8 +2751,8 @@ export default {
2744
2751
  }
2745
2752
  const rootRegion = this.$module.scene.getRootRegion();
2746
2753
  const groups = [name];
2747
- const objects = findObjectsWithNames(rootRegion, groups, "", true);
2748
- objects.forEach(object => object.setMarkerMode(mode, options));
2754
+ const objects = findObjectsWithNames(rootRegion, groups, '', true);
2755
+ objects.forEach((object) => object.setMarkerMode(mode, options));
2749
2756
  }
2750
2757
  },
2751
2758
  /**
@@ -2758,7 +2765,7 @@ export default {
2758
2765
  if (this.$module.scene) {
2759
2766
  const result = getObjectsFromAnnotations(this.$module.scene, annotations);
2760
2767
  if (result && result.objects.length > 0) {
2761
- result.objects.forEach(object => object.setMarkerMode(mode));
2768
+ result.objects.forEach((object) => object.setMarkerMode(mode));
2762
2769
  }
2763
2770
  }
2764
2771
  },
@@ -2798,22 +2805,20 @@ export default {
2798
2805
  */
2799
2806
  search: function (text, displayLabel) {
2800
2807
  if (this.$_searchIndex) {
2801
- if (text === undefined || text === "" ||
2802
- ((Array.isArray(text) && text.length === 0))
2803
- ) {
2808
+ if (text === undefined || text === '' || (Array.isArray(text) && text.length === 0)) {
2804
2809
  this.lastSelected = {
2805
- region: "",
2806
- group: "",
2810
+ region: '',
2811
+ group: '',
2807
2812
  isSearch: true,
2808
- }
2813
+ };
2809
2814
  this.objectSelected([], true);
2810
2815
  return false;
2811
2816
  } else {
2812
2817
  this.lastSelected = {
2813
- region: "",
2818
+ region: '',
2814
2819
  group: text,
2815
2820
  isSearch: true,
2816
- }
2821
+ };
2817
2822
  const result = this.$_searchIndex.searchAndProcessResult(text);
2818
2823
  const zincObjects = result.zincObjects;
2819
2824
  if (zincObjects.length > 0) {
@@ -2826,7 +2831,7 @@ export default {
2826
2831
  zincObjects,
2827
2832
  result.regionPath,
2828
2833
  true,
2829
- true
2834
+ true,
2830
2835
  );
2831
2836
  }
2832
2837
  }
@@ -2863,26 +2868,23 @@ export default {
2863
2868
  updateSettingsfromScene: function () {
2864
2869
  this.currentSpeed = 1;
2865
2870
  this.$module.setPlayRate(this.defaultRate);
2866
- this.orginalDuration =
2867
- this.$module.scene.getMetadataTag("OriginalDuration");
2868
- this.animateDuration = this.$module.scene.getMetadataTag("Duration");
2869
- let timeStamps = this.$module.scene.getMetadataTag("TimeStamps");
2871
+ this.orginalDuration = this.$module.scene.getMetadataTag('OriginalDuration');
2872
+ this.animateDuration = this.$module.scene.getMetadataTag('Duration');
2873
+ let timeStamps = this.$module.scene.getMetadataTag('TimeStamps');
2870
2874
  this.timeStamps = {};
2871
2875
  for (const key in timeStamps) {
2872
2876
  this.timeStamps[timeStamps[key]] = key;
2873
2877
  }
2874
2878
  this.timeMax = this.$module.scene.getDuration();
2875
2879
  },
2876
- restoreSettings: function(options) {
2880
+ restoreSettings: function (options) {
2877
2881
  if (options) {
2878
2882
  if (options.viewport) {
2879
- this.$module.scene
2880
- .getZincCameraControls()
2881
- .setCurrentCameraSettings(options.viewport);
2882
- } else if (options.viewURL && options.viewURL !== "") {
2883
+ this.$module.scene.getZincCameraControls().setCurrentCameraSettings(options.viewport);
2884
+ } else if (options.viewURL && options.viewURL !== '') {
2883
2885
  const url = new URL(options.viewURL, this.url);
2884
2886
  this.$module.scene.loadViewURL(url);
2885
- } else if (options.region && options.region !== "") {
2887
+ } else if (options.region && options.region !== '') {
2886
2888
  this.viewRegion(options.region);
2887
2889
  }
2888
2890
  if (options.visibility) {
@@ -2894,13 +2896,13 @@ export default {
2894
2896
  if (options.background) {
2895
2897
  this.backgroundChangeCallback(options.background);
2896
2898
  }
2897
- if ("colour" in options) {
2899
+ if ('colour' in options) {
2898
2900
  this.setColour(options.colour);
2899
2901
  }
2900
2902
  if (options.offlineAnnotations) {
2901
2903
  sessionStorage.setItem('anonymous-annotation', options.offlineAnnotations);
2902
2904
  }
2903
- if ("outlines" in options) {
2905
+ if ('outlines' in options) {
2904
2906
  this.setOutlines(options.outlines);
2905
2907
  }
2906
2908
  if (options.viewingMode) {
@@ -2916,17 +2918,17 @@ export default {
2916
2918
  }
2917
2919
  }
2918
2920
  },
2919
- calculateBoundingBox: function() {
2921
+ calculateBoundingBox: function () {
2920
2922
  if (this.isReady) {
2921
- const {centre, size} = this.$module.getCentreAndSize();
2923
+ const { centre, size } = this.$module.getCentreAndSize();
2922
2924
  this.boundingDims.centre = centre;
2923
2925
  this.boundingDims.size = size;
2924
2926
  }
2925
2927
  },
2926
- downloadErrorCallback: function() {
2928
+ downloadErrorCallback: function () {
2927
2929
  return (error) => {
2928
2930
  this.$emit('on-error', error);
2929
- }
2931
+ };
2930
2932
  },
2931
2933
  setURLFinishCallback: function (options) {
2932
2934
  return () => {
@@ -2942,18 +2944,25 @@ export default {
2942
2944
  this.setMarkers();
2943
2945
  //Create a bounding box.
2944
2946
  this._boundingBoxGeo = this.$module.scene.addBoundingBoxPrimitive(
2945
- "_helper", "boundingBox", 0x40E0D0, 0.15);
2947
+ '_helper',
2948
+ 'boundingBox',
2949
+ 0x40e0d0,
2950
+ 0.15,
2951
+ );
2946
2952
  //Create planes.
2947
2953
  this._slides = this.$module.scene.addSlicesPrimitive(
2948
- "_helper", ["x-plane", "y-plane", "z-plane"], [0xFF5555, 0x55FF55, 0x5555FF],
2949
- 0.5);
2954
+ '_helper',
2955
+ ['x-plane', 'y-plane', 'z-plane'],
2956
+ [0xff5555, 0x55ff55, 0x5555ff],
2957
+ 0.5,
2958
+ );
2950
2959
  //this.$module.scene.createAxisDisplay(false);
2951
2960
  //this.$module.scene.enableAxisDisplay(true, true);
2952
2961
  this.isReady = true;
2953
2962
  this.calculateBoundingBox();
2954
2963
  this.$nextTick(() => {
2955
2964
  this.restoreSettings(options);
2956
- this.$emit("on-ready");
2965
+ this.$emit('on-ready');
2957
2966
  });
2958
2967
  };
2959
2968
  },
@@ -2982,7 +2991,7 @@ export default {
2982
2991
  state.viewport = zincCameraControls.getCurrentViewport();
2983
2992
  }
2984
2993
  if (this.lastSelected && this.lastSelected.group) {
2985
- state.search = {...this.lastSelected};
2994
+ state.search = { ...this.lastSelected };
2986
2995
  }
2987
2996
  if (this.offlineAnnotationEnabled) {
2988
2997
  state.offlineAnnotations = sessionStorage.getItem('anonymous-annotation');
@@ -3011,8 +3020,15 @@ export default {
3011
3020
  offlineAnnotations: state.offlineAnnotations,
3012
3021
  });
3013
3022
  } else {
3014
- if (state.background || state.colour || state.search || state.outlines ||
3015
- state.viewport || state.viewingMode || state.visibility) {
3023
+ if (
3024
+ state.background ||
3025
+ state.colour ||
3026
+ state.search ||
3027
+ state.outlines ||
3028
+ state.viewport ||
3029
+ state.viewingMode ||
3030
+ state.visibility
3031
+ ) {
3016
3032
  if (this.isReady && this.$module.scene) {
3017
3033
  this.restoreSettings(state);
3018
3034
  } else {
@@ -3026,7 +3042,7 @@ export default {
3026
3042
  viewingMode: state.viewingMode,
3027
3043
  viewport: state.viewport,
3028
3044
  visibility: state.visibility,
3029
- })
3045
+ }),
3030
3046
  );
3031
3047
  }
3032
3048
  }
@@ -3063,10 +3079,10 @@ export default {
3063
3079
  importOfflineAnnotations: function (annotationsList) {
3064
3080
  if (this.offlineAnnotationEnabled) {
3065
3081
  //Make sure the annotations are encoded correctly
3066
- annotationsList.forEach(annotation => {
3082
+ annotationsList.forEach((annotation) => {
3067
3083
  const group = annotation.group;
3068
3084
  const region = annotation.region;
3069
- let fullName = region.slice(-1) === "/" ? region : region + "/";
3085
+ let fullName = region.slice(-1) === '/' ? region : region + '/';
3070
3086
  const noSlash = fullName.slice(0, -1);
3071
3087
  annotation.region = noSlash;
3072
3088
  fullName = fullName + group;
@@ -3078,7 +3094,7 @@ export default {
3078
3094
  annotationFeaturesToPrimitives(this.$module.scene, featuresList);
3079
3095
  //Make a local non-reactive copy.
3080
3096
  annotationsList.forEach((annotation) => {
3081
- this.offlineAnnotations.push({...annotation});
3097
+ this.offlineAnnotations.push({ ...annotation });
3082
3098
  });
3083
3099
  sessionStorage.setItem('anonymous-annotation', JSON.stringify(this.offlineAnnotations));
3084
3100
  }
@@ -3104,9 +3120,7 @@ export default {
3104
3120
  this.isReady = false;
3105
3121
  this.$_searchIndex.removeAll();
3106
3122
  this.hideRegionTooltip();
3107
- this.$module.setDownloadErrorCallback(
3108
- this.downloadErrorCallback()
3109
- );
3123
+ this.$module.setDownloadErrorCallback(this.downloadErrorCallback());
3110
3124
  this.$module.setFinishDownloadCallback(
3111
3125
  this.setURLFinishCallback({
3112
3126
  background: state?.background,
@@ -3119,22 +3133,22 @@ export default {
3119
3133
  viewport: state?.viewport,
3120
3134
  visibility: state?.visibility,
3121
3135
  offlineAnnotations: state?.offlineAnnotations,
3122
- })
3136
+ }),
3123
3137
  );
3124
- if (this.fileFormat === "gltf") {
3125
- this.$module.loadGLTFFromURL(newValue, "scene", true);
3138
+ if (this.fileFormat === 'gltf') {
3139
+ this.$module.loadGLTFFromURL(newValue, 'scene', true);
3126
3140
  } else {
3127
- if (this?.usageConfig?.tubeLines || state?.usageConfig?.tubeLines){
3141
+ if (this?.usageConfig?.tubeLines || state?.usageConfig?.tubeLines) {
3128
3142
  options.tubeLines = true;
3129
3143
  }
3130
3144
  this.$module.loadOrgansFromURL(
3131
3145
  newValue,
3132
3146
  undefined,
3133
3147
  undefined,
3134
- "scene",
3148
+ 'scene',
3135
3149
  undefined,
3136
3150
  true,
3137
- options
3151
+ options,
3138
3152
  );
3139
3153
  }
3140
3154
  if (this.$module && this.$module.scene) {
@@ -3172,20 +3186,20 @@ export default {
3172
3186
  this.clientHeight = this.$refs.scaffoldContainer.$el.clientHeight;
3173
3187
  this.minimisedSlider = width < 812;
3174
3188
  if (this.minimisedSlider) {
3175
- this.sliderPosition = this.drawerOpen ? "right" : "left";
3189
+ this.sliderPosition = this.drawerOpen ? 'right' : 'left';
3176
3190
  } else {
3177
- this.sliderPosition = "";
3191
+ this.sliderPosition = '';
3178
3192
  }
3179
3193
  }
3180
3194
  },
3181
3195
  toggleRendering: function (flag) {
3182
3196
  if (this.$module.zincRenderer) {
3183
3197
  if (flag) {
3184
- this.forceContextRestore();
3198
+ // this.forceContextRestore();
3185
3199
  this.$module.zincRenderer.animate();
3186
3200
  } else {
3187
3201
  this.$module.zincRenderer.stopAnimate();
3188
- this.forceContextLoss();
3202
+ // this.forceContextLoss();
3189
3203
  }
3190
3204
  }
3191
3205
  },
@@ -3209,7 +3223,7 @@ export default {
3209
3223
  * only triggered during syncControl mode
3210
3224
  * @arg {Object} "Information on the navigation"
3211
3225
  */
3212
- this.$emit("scaffold-navigated", payload);
3226
+ this.$emit('scaffold-navigated', payload);
3213
3227
  },
3214
3228
  /**
3215
3229
  * Rotate mode - "none", "horizontal", "vertical", "free" but
@@ -3225,10 +3239,10 @@ export default {
3225
3239
  */
3226
3240
  setMarkers: function () {
3227
3241
  for (const [key, value] of Object.entries(this.markerLabels)) {
3228
- this.setMarkerModeForObjectsWithName(key, value, "on");
3242
+ this.setMarkerModeForObjectsWithName(key, value, 'on');
3229
3243
  }
3230
3244
  },
3231
- readNIFTIFromSource: async function(urls, useHeaderInfo, maskURL, settings, options) {
3245
+ readNIFTIFromSource: async function (urls, useHeaderInfo, maskURL, settings, options) {
3232
3246
  const newTexture = await readNIFTIFromSource(urls, useHeaderInfo, maskURL, settings, options);
3233
3247
  return newTexture;
3234
3248
  },
@@ -3238,7 +3252,6 @@ export default {
3238
3252
 
3239
3253
  <!-- Add "scoped" attribute to limit CSS to this component only -->
3240
3254
  <style scoped lang="scss">
3241
-
3242
3255
  .message-icon {
3243
3256
  position: absolute;
3244
3257
  top: 15px;
@@ -3323,7 +3336,11 @@ export default {
3323
3336
  font-weight: normal;
3324
3337
  line-height: 20px;
3325
3338
  padding-left: 8px;
3326
- text-shadow: -1px -1px #fff, 1px -1px #fff, -1px 1px #fff, 1px -1px #fff;
3339
+ text-shadow:
3340
+ -1px -1px #fff,
3341
+ 1px -1px #fff,
3342
+ -1px 1px #fff,
3343
+ 1px -1px #fff;
3327
3344
  }
3328
3345
 
3329
3346
  .tab-content {
@@ -3492,7 +3509,7 @@ export default {
3492
3509
  height: 24px !important;
3493
3510
  width: 24px !important;
3494
3511
  &.open-map-button {
3495
- margin-bottom:4px;
3512
+ margin-bottom: 4px;
3496
3513
  }
3497
3514
 
3498
3515
  &:hover {
@@ -3587,7 +3604,6 @@ export default {
3587
3604
  }
3588
3605
  }
3589
3606
 
3590
-
3591
3607
  :deep(.scaffold-popper.el-popper.el-popper) {
3592
3608
  padding: 6px 4px;
3593
3609
  font-size: 12px;
@@ -3625,7 +3641,6 @@ export default {
3625
3641
  }
3626
3642
  }
3627
3643
 
3628
-
3629
3644
  :deep(.popper-zoomout) {
3630
3645
  padding-right: 11px;
3631
3646
 
@@ -3669,11 +3684,11 @@ export default {
3669
3684
 
3670
3685
  &.speed {
3671
3686
  margin-left: 8px;
3672
- width:50px!important;
3687
+ width: 50px !important;
3673
3688
  height: 24px;
3674
3689
  :deep(.el-select__wrapper) {
3675
3690
  padding: 0;
3676
- min-height: 24px
3691
+ min-height: 24px;
3677
3692
  }
3678
3693
  }
3679
3694
  }
@@ -3689,8 +3704,6 @@ export default {
3689
3704
  }
3690
3705
  }
3691
3706
  }
3692
-
3693
-
3694
3707
  </style>
3695
3708
 
3696
3709
  <style lang="scss">
@@ -3699,11 +3712,10 @@ canvas:focus {
3699
3712
  }
3700
3713
 
3701
3714
  .scaffold-container {
3702
- --el-color-primary: #8300BF;
3715
+ --el-color-primary: #8300bf;
3703
3716
  --el-color-primary-light-5: #cd99e5;
3704
3717
  --el-color-primary-light-7: #dab3ec;
3705
- --el-color-primary-light-8: #e6ccf2
3706
- --el-color-primary-light-9: #f3e6f9;
3718
+ --el-color-primary-light-8: #e6ccf2 --el-color-primary-light-9: #f3e6f9;
3707
3719
  height: 100%;
3708
3720
  width: 100%;
3709
3721
  position: relative;
@@ -3711,7 +3723,7 @@ canvas:focus {
3711
3723
 
3712
3724
  .time-slider-tooltip {
3713
3725
  padding: 6px 4px !important;
3714
- font-family: "Asap", sans-serif;
3726
+ font-family: 'Asap', sans-serif;
3715
3727
  font-size: 12px !important;
3716
3728
  color: rgb(48, 49, 51) !important;
3717
3729
  background-color: #f3ecf6 !important;
@@ -3720,8 +3732,8 @@ canvas:focus {
3720
3732
  min-width: unset !important;
3721
3733
  .el-popper__arrow {
3722
3734
  &:before {
3723
- border-color: $app-primary-color!important;
3724
- background-color: #f3ecf6!important;
3735
+ border-color: $app-primary-color !important;
3736
+ background-color: #f3ecf6 !important;
3725
3737
  }
3726
3738
  }
3727
3739
  }
@@ -3729,11 +3741,10 @@ canvas:focus {
3729
3741
  .scaffold_viewer_dropdown .el-select-dropdown__item {
3730
3742
  white-space: nowrap;
3731
3743
  text-align: left;
3732
- font-family: "Asap", sans-serif;
3744
+ font-family: 'Asap', sans-serif;
3733
3745
  &.is-selected {
3734
3746
  color: $app-primary-color;
3735
3747
  font-weight: normal;
3736
3748
  }
3737
3749
  }
3738
-
3739
3750
  </style>