@abi-software/flatmapvuer 1.6.2-beta.9 → 1.7.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.
- package/dist/flatmapvuer.js +3041 -3085
- package/dist/flatmapvuer.umd.cjs +20 -20
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/components/FlatmapVuer.vue +81 -103
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/flatmapvuer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
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.10",
|
|
47
|
-
"@abi-software/map-utilities": "^1.
|
|
47
|
+
"@abi-software/map-utilities": "^1.3.0",
|
|
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,7 +152,6 @@ Please use `const` to assign meaningful names to them...
|
|
|
152
152
|
class: '.maplibregl-canvas',
|
|
153
153
|
}"
|
|
154
154
|
:toolbarOptions="toolbarOptions"
|
|
155
|
-
:drawnType="drawnType"
|
|
156
155
|
:activeDrawTool="activeDrawTool"
|
|
157
156
|
:activeDrawMode="activeDrawMode"
|
|
158
157
|
:newlyDrawnEntry="drawnCreatedEvent"
|
|
@@ -454,44 +453,22 @@ Please use `const` to assign meaningful names to them...
|
|
|
454
453
|
</template>
|
|
455
454
|
</div>
|
|
456
455
|
<el-row class="viewing-mode-description">
|
|
457
|
-
{{
|
|
456
|
+
{{ modeDescription }}
|
|
458
457
|
</el-row>
|
|
459
458
|
</el-row>
|
|
460
459
|
<template v-if="viewingMode === 'Annotation' && userInformation">
|
|
461
|
-
<el-row class="backgroundText">
|
|
460
|
+
<el-row class="backgroundText">Annotations From</el-row>
|
|
462
461
|
<el-row class="backgroundControl">
|
|
463
462
|
<el-select
|
|
464
463
|
:teleported="false"
|
|
465
|
-
v-model="
|
|
464
|
+
v-model="annotationFrom"
|
|
466
465
|
placeholder="Select"
|
|
467
466
|
class="select-box"
|
|
468
467
|
popper-class="flatmap_dropdown"
|
|
469
|
-
@change="
|
|
468
|
+
@change="setAnnotationFrom"
|
|
470
469
|
>
|
|
471
470
|
<el-option
|
|
472
|
-
v-for="item in
|
|
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"
|
|
471
|
+
v-for="item in annotatedSource"
|
|
495
472
|
:key="item"
|
|
496
473
|
:label="item"
|
|
497
474
|
:value="item"
|
|
@@ -668,20 +645,24 @@ const centroid = (geometry) => {
|
|
|
668
645
|
let featureGeometry = { lng: 0, lat: 0, }
|
|
669
646
|
let coordinates
|
|
670
647
|
if (geometry.type === "Polygon") {
|
|
671
|
-
|
|
648
|
+
if (geometry.coordinates.length) {
|
|
649
|
+
coordinates = geometry.coordinates[0]
|
|
650
|
+
}
|
|
672
651
|
} else {
|
|
673
652
|
coordinates = geometry.coordinates
|
|
674
653
|
}
|
|
675
|
-
if (
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
654
|
+
if (coordinates) {
|
|
655
|
+
if (!(geometry.type === 'Point')) {
|
|
656
|
+
coordinates.map((coor) => {
|
|
657
|
+
featureGeometry.lng += parseFloat(coor[0])
|
|
658
|
+
featureGeometry.lat += parseFloat(coor[1])
|
|
659
|
+
})
|
|
660
|
+
featureGeometry.lng = featureGeometry.lng / coordinates.length
|
|
661
|
+
featureGeometry.lat = featureGeometry.lat / coordinates.length
|
|
662
|
+
} else {
|
|
663
|
+
featureGeometry.lng += parseFloat(coordinates[0])
|
|
664
|
+
featureGeometry.lat += parseFloat(coordinates[1])
|
|
665
|
+
}
|
|
685
666
|
}
|
|
686
667
|
return featureGeometry
|
|
687
668
|
}
|
|
@@ -773,6 +754,7 @@ export default {
|
|
|
773
754
|
if (this.annotationSidebar) this.$emit("annotation-close")
|
|
774
755
|
this.closeTooltip()
|
|
775
756
|
this.annotationEventCallback({}, { type: 'aborted' })
|
|
757
|
+
this.initialiseDrawing()
|
|
776
758
|
},
|
|
777
759
|
/**
|
|
778
760
|
* @public
|
|
@@ -848,21 +830,19 @@ export default {
|
|
|
848
830
|
* @arg {String} `name`
|
|
849
831
|
*/
|
|
850
832
|
toolbarEvent: function (type, name) {
|
|
833
|
+
if (this.isValidDrawnCreated) return;
|
|
851
834
|
this.manualAbortedOnClose()
|
|
852
835
|
this.doubleClickedFeature = false
|
|
853
|
-
|
|
836
|
+
// Deselect any feature when draw mode/tool is changed
|
|
837
|
+
this.changeAnnotationDrawMode({ mode: 'simple_select' })
|
|
854
838
|
if (type === 'mode') {
|
|
855
|
-
// Deselect any feature when draw mode is changed
|
|
856
|
-
this.changeAnnotationDrawMode({ mode: 'simple_select' })
|
|
857
839
|
this.activeDrawMode = name
|
|
858
840
|
} else if (type === 'tool') {
|
|
841
|
+
// Remove any unsubmitted drawn
|
|
842
|
+
this.cancelDrawnFeature()
|
|
859
843
|
if (name) {
|
|
860
844
|
const tool = name.replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`)
|
|
861
845
|
this.changeAnnotationDrawMode({ mode: `draw${tool}` })
|
|
862
|
-
this.initialiseDrawing()
|
|
863
|
-
} else {
|
|
864
|
-
this.changeAnnotationDrawMode({ mode: 'simple_select' })
|
|
865
|
-
this.cancelDrawnFeature()
|
|
866
846
|
}
|
|
867
847
|
this.activeDrawTool = name
|
|
868
848
|
}
|
|
@@ -885,8 +865,7 @@ export default {
|
|
|
885
865
|
}
|
|
886
866
|
this.doubleClickedFeature = false
|
|
887
867
|
}
|
|
888
|
-
}
|
|
889
|
-
if (this.activeDrawMode === 'Delete') {
|
|
868
|
+
} else if (this.activeDrawMode === 'Delete') {
|
|
890
869
|
this.changeAnnotationDrawMode({
|
|
891
870
|
mode: 'simple_select',
|
|
892
871
|
options: { featureIds: [data.feature.feature.id] }
|
|
@@ -972,9 +951,12 @@ export default {
|
|
|
972
951
|
) {
|
|
973
952
|
this.featureAnnotationSubmitted = true
|
|
974
953
|
this.mapImp.commitAnnotationEvent(this.annotationEntry)
|
|
975
|
-
if (
|
|
954
|
+
if (annotation.body.comment === "Position Updated") {
|
|
955
|
+
this.annotationEntry.positionUpdated = false
|
|
956
|
+
} else if (this.annotationEntry.type === 'deleted') {
|
|
976
957
|
if (this.annotationSidebar) this.$emit("annotation-close")
|
|
977
958
|
this.closeTooltip()
|
|
959
|
+
// Only delete need, keep the annotation tooltip/sidebar open if created/updated
|
|
978
960
|
this.annotationEntry = {}
|
|
979
961
|
}
|
|
980
962
|
this.addAnnotationFeature()
|
|
@@ -1015,12 +997,6 @@ export default {
|
|
|
1015
997
|
let drawnFeatures = await this.annotator.drawnFeatures(this.userToken, this.serverURL, annotatedItemIds)
|
|
1016
998
|
// The annotator has `resource` and `features` fields
|
|
1017
999
|
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
|
-
}
|
|
1024
1000
|
return drawnFeatures
|
|
1025
1001
|
},
|
|
1026
1002
|
/**
|
|
@@ -1029,22 +1005,22 @@ export default {
|
|
|
1029
1005
|
*/
|
|
1030
1006
|
addAnnotationFeature: async function () {
|
|
1031
1007
|
if (this.mapImp) {
|
|
1032
|
-
if (!this.featureAnnotationSubmitted)
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1008
|
+
if (!this.featureAnnotationSubmitted) {
|
|
1009
|
+
this.clearAnnotationFeature()
|
|
1010
|
+
this.loading = true
|
|
1011
|
+
}
|
|
1012
|
+
const userId = this.annotationFrom === 'Anyone' ?
|
|
1013
|
+
undefined : this.userInformation.orcid ?
|
|
1014
|
+
this.userInformation.orcid : '0000-0000-0000-0000'
|
|
1015
|
+
const participated = this.annotationFrom === 'Anyone' ?
|
|
1016
|
+
undefined : this.annotationFrom === 'Me' ?
|
|
1017
|
+
true : false
|
|
1018
|
+
const drawnFeatures = await this.fetchDrawnFeatures(userId, participated)
|
|
1019
|
+
this.existDrawnFeatures = drawnFeatures
|
|
1020
|
+
this.loading = false
|
|
1021
|
+
if (!this.featureAnnotationSubmitted) {
|
|
1022
|
+
for (const feature of drawnFeatures) {
|
|
1023
|
+
this.mapImp.addAnnotationFeature(feature)
|
|
1048
1024
|
}
|
|
1049
1025
|
}
|
|
1050
1026
|
}
|
|
@@ -1062,26 +1038,13 @@ export default {
|
|
|
1062
1038
|
this.$el.querySelector('.maplibregl-ctrl-group').style.display = 'none'
|
|
1063
1039
|
}
|
|
1064
1040
|
},
|
|
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
|
-
},
|
|
1078
1041
|
/**
|
|
1079
1042
|
* @public
|
|
1080
1043
|
* Function to switch the type of person who annotated.
|
|
1081
1044
|
* @arg {Boolean} `flag`
|
|
1082
1045
|
*/
|
|
1083
|
-
|
|
1084
|
-
this.
|
|
1046
|
+
setAnnotationFrom: function (flag) {
|
|
1047
|
+
this.annotationFrom = flag
|
|
1085
1048
|
if (this.mapImp) {
|
|
1086
1049
|
this.manualAbortedOnClose()
|
|
1087
1050
|
this.addAnnotationFeature()
|
|
@@ -1589,7 +1552,7 @@ export default {
|
|
|
1589
1552
|
this.annotationEntry = {}
|
|
1590
1553
|
} else if (data.type === 'modeChanged') {
|
|
1591
1554
|
if (data.feature.mode === 'direct_select') this.doubleClickedFeature = true
|
|
1592
|
-
if (this.annotationSidebar && data.feature.mode === 'simple_select') {
|
|
1555
|
+
if (this.annotationSidebar && data.feature.mode === 'simple_select' && this.activeDrawMode === 'Deleted') {
|
|
1593
1556
|
this.annotationEventCallback({}, { type: 'aborted' })
|
|
1594
1557
|
}
|
|
1595
1558
|
} else if (data.type === 'selectionChanged') {
|
|
@@ -1607,6 +1570,15 @@ export default {
|
|
|
1607
1570
|
this.connectionEntry = drawnFeature.connection
|
|
1608
1571
|
}
|
|
1609
1572
|
this.annotationDrawModeEvent(payload)
|
|
1573
|
+
} else {
|
|
1574
|
+
if (this.annotationSidebar && this.previousEditEvent.type === 'updated') {
|
|
1575
|
+
this.annotationEntry = {
|
|
1576
|
+
...this.previousEditEvent,
|
|
1577
|
+
resourceId: this.serverURL
|
|
1578
|
+
}
|
|
1579
|
+
this.annotationEventCallback({}, { type: 'aborted' })
|
|
1580
|
+
}
|
|
1581
|
+
this.previousEditEvent = {}
|
|
1610
1582
|
}
|
|
1611
1583
|
}
|
|
1612
1584
|
} else {
|
|
@@ -1624,6 +1596,7 @@ export default {
|
|
|
1624
1596
|
if (data.type === 'created') this.drawnCreatedEvent = payload
|
|
1625
1597
|
else this.checkAndCreatePopups(payload)
|
|
1626
1598
|
}
|
|
1599
|
+
if (data.type === 'updated') this.previousEditEvent = data
|
|
1627
1600
|
if (data.type === 'deleted') this.previousDeletedEvent = data
|
|
1628
1601
|
else this.previousDeletedEvent = {}
|
|
1629
1602
|
},
|
|
@@ -1870,12 +1843,8 @@ export default {
|
|
|
1870
1843
|
if (data.feature.featureId && data.feature.models) {
|
|
1871
1844
|
this.displayTooltip(data.feature.models)
|
|
1872
1845
|
} else if (data.feature.feature) {
|
|
1873
|
-
// in drawing or edit/delete mode is on or
|
|
1874
|
-
if (
|
|
1875
|
-
this.activeDrawTool ||
|
|
1876
|
-
this.activeDrawMode ||
|
|
1877
|
-
Object.keys(this.connectionEntry).length > 0
|
|
1878
|
-
) {
|
|
1846
|
+
// in drawing or edit/delete mode is on or valid drawn
|
|
1847
|
+
if (this.activeDrawTool || this.activeDrawMode || this.isValidDrawnCreated) {
|
|
1879
1848
|
this.featureAnnotationSubmitted = false
|
|
1880
1849
|
this.annotationEntry.featureId = data.feature.feature.id
|
|
1881
1850
|
if (this.activeDrawTool) {
|
|
@@ -1932,7 +1901,9 @@ export default {
|
|
|
1932
1901
|
* Function to close tooltip.
|
|
1933
1902
|
*/
|
|
1934
1903
|
closeTooltip: function () {
|
|
1935
|
-
this.$refs.tooltip
|
|
1904
|
+
if (this.$refs.tooltip) {
|
|
1905
|
+
this.$refs.tooltip.$el.style.display = 'none'
|
|
1906
|
+
}
|
|
1936
1907
|
document.querySelectorAll('.maplibregl-popup').forEach((item) => {
|
|
1937
1908
|
item.style.display = 'none'
|
|
1938
1909
|
})
|
|
@@ -2178,8 +2149,7 @@ export default {
|
|
|
2178
2149
|
!this.disableUI && (
|
|
2179
2150
|
(
|
|
2180
2151
|
this.viewingMode === 'Annotation' &&
|
|
2181
|
-
!this.annotationSidebar
|
|
2182
|
-
this.userInformation
|
|
2152
|
+
!this.annotationSidebar
|
|
2183
2153
|
) ||
|
|
2184
2154
|
(
|
|
2185
2155
|
this.viewingMode === 'Exploration' &&
|
|
@@ -2193,7 +2163,6 @@ export default {
|
|
|
2193
2163
|
this.mapImp.showPopup(featureId, this.$refs.tooltip.$el, options);
|
|
2194
2164
|
this.popUpCssHacks();
|
|
2195
2165
|
});
|
|
2196
|
-
|
|
2197
2166
|
}
|
|
2198
2167
|
},
|
|
2199
2168
|
hasTooltipEntry: function () {
|
|
@@ -2958,12 +2927,10 @@ export default {
|
|
|
2958
2927
|
viewingModes: {
|
|
2959
2928
|
'Exploration': 'Find relevant research and view detail of neural pathways by selecting a pathway to view its connections and data sources',
|
|
2960
2929
|
'Neuron Connection': 'Discover Neuron connections by selecting a neuron and viewing its associated network connections',
|
|
2961
|
-
'Annotation': 'View
|
|
2930
|
+
'Annotation': ['View feature annotations', 'Add, comment on and view feature annotations']
|
|
2962
2931
|
},
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
annotatedType: 'Anyone',
|
|
2966
|
-
annotatedTypes: ['Anyone', 'Me', 'Others'],
|
|
2932
|
+
annotationFrom: 'Anyone',
|
|
2933
|
+
annotatedSource: ['Anyone', 'Me', 'Others'],
|
|
2967
2934
|
openMapRef: undefined,
|
|
2968
2935
|
backgroundIconRef: undefined,
|
|
2969
2936
|
toolbarOptions: [
|
|
@@ -2980,6 +2947,7 @@ export default {
|
|
|
2980
2947
|
activeDrawTool: undefined,
|
|
2981
2948
|
featureAnnotationSubmitted: false,
|
|
2982
2949
|
drawnCreatedEvent: {},
|
|
2950
|
+
previousEditEvent: {},
|
|
2983
2951
|
previousDeletedEvent: {},
|
|
2984
2952
|
connectionEntry: {},
|
|
2985
2953
|
existDrawnFeatures: [], // Store all exist drawn features
|
|
@@ -3034,7 +3002,17 @@ export default {
|
|
|
3034
3002
|
}
|
|
3035
3003
|
this.drawerOpen = false
|
|
3036
3004
|
return true
|
|
3037
|
-
}
|
|
3005
|
+
},
|
|
3006
|
+
modeDescription: function () {
|
|
3007
|
+
let description = this.viewingModes[this.viewingMode]
|
|
3008
|
+
if (this.viewingMode === 'Annotation') {
|
|
3009
|
+
if (this.userInformation) {
|
|
3010
|
+
return description[1]
|
|
3011
|
+
}
|
|
3012
|
+
return description[0]
|
|
3013
|
+
}
|
|
3014
|
+
return description
|
|
3015
|
+
},
|
|
3038
3016
|
},
|
|
3039
3017
|
watch: {
|
|
3040
3018
|
entry: function () {
|