@abi-software/flatmapvuer 1.6.2-beta.1 → 1.6.2-beta.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/flatmapvuer",
3
- "version": "1.6.2-beta.1",
3
+ "version": "1.6.2-beta.3",
4
4
  "license": "Apache-2.0",
5
5
  "files": [
6
6
  "dist/*",
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@abi-software/flatmap-viewer": "^3.2.8",
47
- "@abi-software/map-utilities": "^1.2.2-beta.1",
47
+ "@abi-software/map-utilities": "^1.2.1",
48
48
  "@abi-software/sparc-annotation": "0.3.2",
49
49
  "@abi-software/svg-sprite": "^1.0.1",
50
50
  "@element-plus/icons-vue": "^2.3.1",
@@ -152,6 +152,7 @@ Please use `const` to assign meaningful names to them...
152
152
  class: '.maplibregl-canvas',
153
153
  }"
154
154
  :toolbarOptions="toolbarOptions"
155
+ :drawnType="drawnType"
155
156
  :activeDrawTool="activeDrawTool"
156
157
  :activeDrawMode="activeDrawMode"
157
158
  :newlyDrawnEntry="drawnCreatedEvent"
@@ -453,22 +454,44 @@ Please use `const` to assign meaningful names to them...
453
454
  </template>
454
455
  </div>
455
456
  <el-row class="viewing-mode-description">
456
- {{ modeDescription }}
457
+ {{ viewingModes[viewingMode] }}
457
458
  </el-row>
458
459
  </el-row>
459
460
  <template v-if="viewingMode === 'Annotation' && userInformation">
460
- <el-row class="backgroundText">Annotations From</el-row>
461
+ <el-row class="backgroundText">Drawn By*</el-row>
461
462
  <el-row class="backgroundControl">
462
463
  <el-select
463
464
  :teleported="false"
464
- v-model="annotationFrom"
465
+ v-model="drawnType"
465
466
  placeholder="Select"
466
467
  class="select-box"
467
468
  popper-class="flatmap_dropdown"
468
- @change="setAnnotationFrom"
469
+ @change="setDrawnType"
469
470
  >
470
471
  <el-option
471
- v-for="item in annotatedSource"
472
+ v-for="item in drawnTypes"
473
+ :key="item"
474
+ :label="item"
475
+ :value="item"
476
+ >
477
+ <el-row>
478
+ <el-col :span="12">{{ item }}</el-col>
479
+ </el-row>
480
+ </el-option>
481
+ </el-select>
482
+ </el-row>
483
+ <el-row class="backgroundText">Annotated By*</el-row>
484
+ <el-row class="backgroundControl">
485
+ <el-select
486
+ :teleported="false"
487
+ v-model="annotatedType"
488
+ placeholder="Select"
489
+ class="select-box"
490
+ popper-class="flatmap_dropdown"
491
+ @change="setAnnotatedType"
492
+ >
493
+ <el-option
494
+ v-for="item in annotatedTypes"
472
495
  :key="item"
473
496
  :label="item"
474
497
  :value="item"
@@ -750,7 +773,6 @@ export default {
750
773
  if (this.annotationSidebar) this.$emit("annotation-close")
751
774
  this.closeTooltip()
752
775
  this.annotationEventCallback({}, { type: 'aborted' })
753
- this.initialiseDrawing()
754
776
  },
755
777
  /**
756
778
  * @public
@@ -863,7 +885,8 @@ export default {
863
885
  }
864
886
  this.doubleClickedFeature = false
865
887
  }
866
- } else if (this.activeDrawMode === 'Delete') {
888
+ }
889
+ if (this.activeDrawMode === 'Delete') {
867
890
  this.changeAnnotationDrawMode({
868
891
  mode: 'simple_select',
869
892
  options: { featureIds: [data.feature.feature.id] }
@@ -952,7 +975,6 @@ export default {
952
975
  if (this.annotationEntry.type === 'deleted') {
953
976
  if (this.annotationSidebar) this.$emit("annotation-close")
954
977
  this.closeTooltip()
955
- // Only delete need, keep the annotation tooltip/sidebar open if created/updated
956
978
  this.annotationEntry = {}
957
979
  }
958
980
  this.addAnnotationFeature()
@@ -993,6 +1015,12 @@ export default {
993
1015
  let drawnFeatures = await this.annotator.drawnFeatures(this.userToken, this.serverURL, annotatedItemIds)
994
1016
  // The annotator has `resource` and `features` fields
995
1017
  if ('resource' in drawnFeatures) drawnFeatures = drawnFeatures.features
1018
+ // Use to switch the displayed feature type
1019
+ if (this.drawnType !== 'All tools') {
1020
+ drawnFeatures = drawnFeatures.filter((feature) => {
1021
+ return feature.geometry.type === this.drawnType
1022
+ })
1023
+ }
996
1024
  return drawnFeatures
997
1025
  },
998
1026
  /**
@@ -1002,19 +1030,21 @@ export default {
1002
1030
  addAnnotationFeature: async function () {
1003
1031
  if (this.mapImp) {
1004
1032
  if (!this.featureAnnotationSubmitted) this.clearAnnotationFeature()
1005
- if (!this.featureAnnotationSubmitted) this.loading = true
1006
- const userId = this.annotationFrom === 'Anyone' ?
1007
- undefined : this.userInformation.orcid ?
1008
- this.userInformation.orcid : '0000-0000-0000-0000'
1009
- const participated = this.annotationFrom === 'Anyone' ?
1010
- undefined : this.annotationFrom === 'Me' ?
1011
- true : false
1012
- const drawnFeatures = await this.fetchDrawnFeatures(userId, participated)
1013
- this.existDrawnFeatures = drawnFeatures
1014
- this.loading = false
1015
- if (!this.featureAnnotationSubmitted) {
1016
- for (const feature of drawnFeatures) {
1017
- this.mapImp.addAnnotationFeature(feature)
1033
+ if (this.drawnType !== 'None') {
1034
+ if (!this.featureAnnotationSubmitted) this.loading = true
1035
+ const userId = this.annotatedType === 'Anyone' ?
1036
+ undefined : this.userInformation.orcid ?
1037
+ this.userInformation.orcid : '0000-0000-0000-0000'
1038
+ const participated = this.annotatedType === 'Anyone' ?
1039
+ undefined : this.annotatedType === 'Me' ?
1040
+ true : false
1041
+ const drawnFeatures = await this.fetchDrawnFeatures(userId, participated)
1042
+ this.existDrawnFeatures = drawnFeatures
1043
+ this.loading = false
1044
+ if (!this.featureAnnotationSubmitted) {
1045
+ for (const feature of drawnFeatures) {
1046
+ this.mapImp.addAnnotationFeature(feature)
1047
+ }
1018
1048
  }
1019
1049
  }
1020
1050
  }
@@ -1032,13 +1062,26 @@ export default {
1032
1062
  this.$el.querySelector('.maplibregl-ctrl-group').style.display = 'none'
1033
1063
  }
1034
1064
  },
1065
+ /**
1066
+ * @public
1067
+ * Function to switch the type of annotation.
1068
+ * @arg {Boolean} `flag`
1069
+ */
1070
+ setDrawnType: function (flag) {
1071
+ this.drawnType = flag
1072
+ if (this.mapImp) {
1073
+ this.manualAbortedOnClose()
1074
+ this.addAnnotationFeature()
1075
+ this.initialiseDrawing()
1076
+ }
1077
+ },
1035
1078
  /**
1036
1079
  * @public
1037
1080
  * Function to switch the type of person who annotated.
1038
1081
  * @arg {Boolean} `flag`
1039
1082
  */
1040
- setAnnotationFrom: function (flag) {
1041
- this.annotationFrom = flag
1083
+ setAnnotatedType: function (flag) {
1084
+ this.annotatedType = flag
1042
1085
  if (this.mapImp) {
1043
1086
  this.manualAbortedOnClose()
1044
1087
  this.addAnnotationFeature()
@@ -1546,7 +1589,7 @@ export default {
1546
1589
  this.annotationEntry = {}
1547
1590
  } else if (data.type === 'modeChanged') {
1548
1591
  if (data.feature.mode === 'direct_select') this.doubleClickedFeature = true
1549
- if (this.annotationSidebar && data.feature.mode === 'simple_select' && this.activeDrawMode === 'Deleted') {
1592
+ if (this.annotationSidebar && data.feature.mode === 'simple_select') {
1550
1593
  this.annotationEventCallback({}, { type: 'aborted' })
1551
1594
  }
1552
1595
  } else if (data.type === 'selectionChanged') {
@@ -1581,7 +1624,6 @@ export default {
1581
1624
  if (data.type === 'created') this.drawnCreatedEvent = payload
1582
1625
  else this.checkAndCreatePopups(payload)
1583
1626
  }
1584
- if (data.type === 'updated') this.previousEditEvent = data
1585
1627
  if (data.type === 'deleted') this.previousDeletedEvent = data
1586
1628
  else this.previousDeletedEvent = {}
1587
1629
  },
@@ -1669,14 +1711,6 @@ export default {
1669
1711
  !this.activeDrawTool
1670
1712
  ) {
1671
1713
  this.checkAndCreatePopups(payload)
1672
- if (this.annotationSidebar && this.previousEditEvent.type === 'updated') {
1673
- this.annotationEntry = {
1674
- ...this.previousEditEvent,
1675
- resourceId: this.serverURL
1676
- }
1677
- this.annotationEventCallback({}, { type: 'aborted' })
1678
- }
1679
- this.previousEditEvent = {}
1680
1714
  }
1681
1715
  this.$emit('resource-selected', payload)
1682
1716
  } else {
@@ -1801,7 +1835,7 @@ export default {
1801
1835
  }
1802
1836
 
1803
1837
  // highlight all available features
1804
- this.mapImp.zoomToFeatures(featuresToHighlight, { noZoomIn: true });
1838
+ this.mapImp.selectFeatures(featuresToHighlight);
1805
1839
  }
1806
1840
  },
1807
1841
  emitConnectivityGraphError: function (errorData) {
@@ -1836,8 +1870,12 @@ export default {
1836
1870
  if (data.feature.featureId && data.feature.models) {
1837
1871
  this.displayTooltip(data.feature.models)
1838
1872
  } else if (data.feature.feature) {
1839
- // in drawing or edit/delete mode is on or valid drawn
1840
- if (this.activeDrawTool || this.activeDrawMode || this.isValidDrawnCreated) {
1873
+ // in drawing or edit/delete mode is on or has connectivity
1874
+ if (
1875
+ this.activeDrawTool ||
1876
+ this.activeDrawMode ||
1877
+ Object.keys(this.connectionEntry).length > 0
1878
+ ) {
1841
1879
  this.featureAnnotationSubmitted = false
1842
1880
  this.annotationEntry.featureId = data.feature.feature.id
1843
1881
  if (this.activeDrawTool) {
@@ -2140,7 +2178,8 @@ export default {
2140
2178
  !this.disableUI && (
2141
2179
  (
2142
2180
  this.viewingMode === 'Annotation' &&
2143
- !this.annotationSidebar
2181
+ !this.annotationSidebar &&
2182
+ this.userInformation
2144
2183
  ) ||
2145
2184
  (
2146
2185
  this.viewingMode === 'Exploration' &&
@@ -2154,6 +2193,7 @@ export default {
2154
2193
  this.mapImp.showPopup(featureId, this.$refs.tooltip.$el, options);
2155
2194
  this.popUpCssHacks();
2156
2195
  });
2196
+
2157
2197
  }
2158
2198
  },
2159
2199
  hasTooltipEntry: function () {
@@ -2913,10 +2953,12 @@ export default {
2913
2953
  viewingModes: {
2914
2954
  'Exploration': 'Find relevant research and view detail of neural pathways by selecting a pathway to view its connections and data sources',
2915
2955
  'Neuron Connection': 'Discover Neuron connections by selecting a neuron and viewing its associated network connections',
2916
- 'Annotation': ['View feature annotations', 'Add, comment on and view feature annotations']
2956
+ 'Annotation': 'View internal identifiers of features'
2917
2957
  },
2918
- annotationFrom: 'Anyone',
2919
- annotatedSource: ['Anyone', 'Me', 'Others'],
2958
+ drawnType: 'All tools',
2959
+ drawnTypes: ['All tools', 'Point', 'LineString', 'Polygon', 'None'],
2960
+ annotatedType: 'Anyone',
2961
+ annotatedTypes: ['Anyone', 'Me', 'Others'],
2920
2962
  openMapRef: undefined,
2921
2963
  backgroundIconRef: undefined,
2922
2964
  toolbarOptions: [
@@ -2933,7 +2975,6 @@ export default {
2933
2975
  activeDrawTool: undefined,
2934
2976
  featureAnnotationSubmitted: false,
2935
2977
  drawnCreatedEvent: {},
2936
- previousEditEvent: {},
2937
2978
  previousDeletedEvent: {},
2938
2979
  connectionEntry: {},
2939
2980
  existDrawnFeatures: [], // Store all exist drawn features
@@ -2988,17 +3029,7 @@ export default {
2988
3029
  }
2989
3030
  this.drawerOpen = false
2990
3031
  return true
2991
- },
2992
- modeDescription: function () {
2993
- let description = this.viewingModes[this.viewingMode]
2994
- if (this.viewingMode === 'Annotation') {
2995
- if (this.userInformation) {
2996
- return description[1]
2997
- }
2998
- return description[0]
2999
- }
3000
- return description
3001
- },
3032
+ }
3002
3033
  },
3003
3034
  watch: {
3004
3035
  entry: function () {