@abi-software/flatmapvuer 0.6.1-annotator.1 → 0.6.1-annotator.2
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 +84 -74
- package/dist/flatmapvuer.umd.cjs +48 -48
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/components/AnnotationTool.vue +1 -1
- package/src/components/{RelevanceDialog.vue → ConnectionDialog.vue} +9 -9
- package/src/components/FlatmapVuer.vue +72 -61
- package/src/components.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/flatmapvuer",
|
|
3
|
-
"version": "0.6.1-annotator.
|
|
3
|
+
"version": "0.6.1-annotator.2",
|
|
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": "^2.6.2",
|
|
47
|
-
"@abi-software/sparc-annotation": "0.
|
|
47
|
+
"@abi-software/sparc-annotation": "0.3.1",
|
|
48
48
|
"@abi-software/svg-sprite": "^0.4.0-vue3.3",
|
|
49
49
|
"@element-plus/icons-vue": "^2.3.1",
|
|
50
50
|
"css-element-queries": "^1.2.2",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div class="dialog-container">
|
|
3
3
|
<el-row>
|
|
4
4
|
<span class="dialog-title" v-if="drawing">Finalise drawing</span>
|
|
5
|
-
<span class="dialog-title" v-else>Visualise
|
|
5
|
+
<span class="dialog-title" v-else>Visualise connection</span>
|
|
6
6
|
<el-row v-if="drawing">
|
|
7
7
|
<el-col :span="13">
|
|
8
8
|
<el-button type="primary" plain @click="$emit('confirm', true)">
|
|
@@ -21,16 +21,16 @@
|
|
|
21
21
|
</el-button>
|
|
22
22
|
</el-row>
|
|
23
23
|
</el-row>
|
|
24
|
-
<el-row v-if="
|
|
24
|
+
<el-row v-if="connection">
|
|
25
25
|
<el-col>
|
|
26
26
|
<b><span>Related Features</span></b>
|
|
27
27
|
<el-row v-for="(value, key) in entry" :key="key">
|
|
28
28
|
<el-col :span="20">
|
|
29
|
-
<el-card shadow="hover" @click="handleTooltipOpen(
|
|
30
|
-
<span>{{ capitalise(
|
|
29
|
+
<el-card shadow="hover" @click="handleTooltipOpen(key)">
|
|
30
|
+
<span>{{ capitalise(value.label) }}</span>
|
|
31
31
|
</el-card>
|
|
32
32
|
</el-col>
|
|
33
|
-
<el-col :span="4" v-if="
|
|
33
|
+
<el-col :span="4" v-if="key === tooltipId">
|
|
34
34
|
<el-icon><el-icon-circle-close @click="handleTooltipClose" /></el-icon>
|
|
35
35
|
</el-col>
|
|
36
36
|
</el-row>
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
} from 'element-plus'
|
|
50
50
|
|
|
51
51
|
export default {
|
|
52
|
-
name: '
|
|
52
|
+
name: 'ConnectionDialog',
|
|
53
53
|
components: {
|
|
54
54
|
Row,
|
|
55
55
|
Col,
|
|
@@ -63,7 +63,7 @@ export default {
|
|
|
63
63
|
type: Boolean,
|
|
64
64
|
default: false,
|
|
65
65
|
},
|
|
66
|
-
|
|
66
|
+
connection: {
|
|
67
67
|
type: Boolean,
|
|
68
68
|
default: false,
|
|
69
69
|
},
|
|
@@ -74,7 +74,7 @@ export default {
|
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
76
|
watch: {
|
|
77
|
-
|
|
77
|
+
connection: function () {
|
|
78
78
|
this.tooltipId = undefined
|
|
79
79
|
},
|
|
80
80
|
},
|
|
@@ -124,4 +124,4 @@ export default {
|
|
|
124
124
|
border: 0;
|
|
125
125
|
cursor: pointer;
|
|
126
126
|
}
|
|
127
|
-
</style>
|
|
127
|
+
</style>
|
|
@@ -20,6 +20,11 @@
|
|
|
20
20
|
:visible="hoverVisibilities[6].value"
|
|
21
21
|
ref="warningPopover"
|
|
22
22
|
>
|
|
23
|
+
<!--
|
|
24
|
+
What magic meaning do the numbers 6, 7, etc have?
|
|
25
|
+
|
|
26
|
+
Please use `const` to assign meaningful names to them...
|
|
27
|
+
-->
|
|
23
28
|
<p
|
|
24
29
|
v-if="isLegacy"
|
|
25
30
|
@mouseover="showToolitip(6)"
|
|
@@ -140,7 +145,7 @@
|
|
|
140
145
|
v-show="viewingMode === 'Annotation' && userInformation && !disableUI"
|
|
141
146
|
>
|
|
142
147
|
<el-popover
|
|
143
|
-
content="
|
|
148
|
+
content="Draw Connection"
|
|
144
149
|
placement="top"
|
|
145
150
|
:teleported="false"
|
|
146
151
|
trigger="manual"
|
|
@@ -151,8 +156,8 @@
|
|
|
151
156
|
<template #reference>
|
|
152
157
|
<map-svg-icon
|
|
153
158
|
icon="connection"
|
|
154
|
-
class="icon-button
|
|
155
|
-
@click="
|
|
159
|
+
class="icon-button drawConnection inactive"
|
|
160
|
+
@click="connectionDialogPopup"
|
|
156
161
|
@mouseover="showToolitip(10)"
|
|
157
162
|
@mouseout="hideToolitip(10)"
|
|
158
163
|
/>
|
|
@@ -668,17 +673,17 @@
|
|
|
668
673
|
:annotationDisplay="viewingMode === 'Annotation'"
|
|
669
674
|
@annotation="commitAnnotationEvent"
|
|
670
675
|
/>
|
|
671
|
-
<
|
|
672
|
-
class="
|
|
673
|
-
v-show="
|
|
674
|
-
:entry="
|
|
676
|
+
<ConnectionDialog
|
|
677
|
+
class="connection-dialog"
|
|
678
|
+
v-show="connectionDisplay"
|
|
679
|
+
:entry="connectionEntry"
|
|
675
680
|
:drawing="inDrawing"
|
|
676
|
-
:
|
|
677
|
-
@display="
|
|
681
|
+
:connection="connection"
|
|
682
|
+
@display="connectionDialogPopup"
|
|
678
683
|
@confirm="confirmDrawnFeature"
|
|
679
684
|
@cancel="cancelDrawnFeature"
|
|
680
685
|
@popup="closePopup"
|
|
681
|
-
@tooltip="
|
|
686
|
+
@tooltip="displayConnectedFeatureTooltip"
|
|
682
687
|
/>
|
|
683
688
|
</div>
|
|
684
689
|
</div>
|
|
@@ -717,7 +722,7 @@ import yellowstar from '../icons/yellowstar'
|
|
|
717
722
|
import ResizeSensor from 'css-element-queries/src/ResizeSensor'
|
|
718
723
|
import * as flatmap from '@abi-software/flatmap-viewer'
|
|
719
724
|
import { AnnotationService } from '@abi-software/sparc-annotation'
|
|
720
|
-
import
|
|
725
|
+
import ConnectionDialog from './ConnectionDialog.vue'
|
|
721
726
|
import { mapState } from 'pinia'
|
|
722
727
|
import { useMainStore } from '@/store/index'
|
|
723
728
|
|
|
@@ -908,7 +913,7 @@ export default {
|
|
|
908
913
|
this.initialiseDrawing()
|
|
909
914
|
}
|
|
910
915
|
},
|
|
911
|
-
|
|
916
|
+
displayConnectedFeatureTooltip: function (id) {
|
|
912
917
|
if (this.mapImp) {
|
|
913
918
|
const data = this.mapImp.featureProperties(id)
|
|
914
919
|
this.checkAndCreatePopups({ feature: data })
|
|
@@ -917,31 +922,31 @@ export default {
|
|
|
917
922
|
confirmDrawnFeature: function () {
|
|
918
923
|
if (this.createdEvent) {
|
|
919
924
|
this.checkAndCreatePopups(this.createdEvent)
|
|
920
|
-
// Add
|
|
921
|
-
//
|
|
925
|
+
// Add connection if exist to annotationEntry
|
|
926
|
+
// Connection will only be added in creating new drawn feature annotation
|
|
922
927
|
// And will not be updated if move drawn features
|
|
923
|
-
if (Object.keys(this.
|
|
924
|
-
this.annotationEntry.feature.
|
|
928
|
+
if (Object.keys(this.connectionEntry).length > 0) {
|
|
929
|
+
this.annotationEntry.feature.connection = this.connectionEntry
|
|
925
930
|
}
|
|
926
931
|
this.initialiseDrawing()
|
|
927
932
|
}
|
|
928
933
|
},
|
|
929
934
|
initialiseDialog: function () {
|
|
930
|
-
this.
|
|
931
|
-
this.
|
|
935
|
+
this.connectionDisplay = false
|
|
936
|
+
this.connectionEntry = {}
|
|
932
937
|
},
|
|
933
|
-
|
|
934
|
-
const inactive = this.$el.querySelector('.
|
|
938
|
+
connectionDialogPopup: function () {
|
|
939
|
+
const inactive = this.$el.querySelector('.drawConnection').classList.contains('inactive')
|
|
935
940
|
// disable click popup if icon inactive or in drawing
|
|
936
941
|
if (!inactive && !this.inDrawing) {
|
|
937
|
-
this.closePopup()
|
|
938
|
-
this.
|
|
942
|
+
this.closePopup()
|
|
943
|
+
this.connectionDisplay = !this.connectionDisplay
|
|
939
944
|
}
|
|
940
945
|
},
|
|
941
946
|
drawingEvent: function (type) {
|
|
942
947
|
this.closePopup()
|
|
943
948
|
// disable mode icon click if any tool is active
|
|
944
|
-
if (this.drawnTypes.includes(type) && !this.activeDrawMode && !this.
|
|
949
|
+
if (this.drawnTypes.includes(type) && !this.activeDrawMode && !this.connectionDisplay) {
|
|
945
950
|
if (type === 'Point') {
|
|
946
951
|
const point = this.$el.querySelector('.mapbox-gl-draw_point')
|
|
947
952
|
this.$el.querySelector('.mapbox-gl-draw_point').click()
|
|
@@ -1034,6 +1039,10 @@ export default {
|
|
|
1034
1039
|
if (this.mapImp) {
|
|
1035
1040
|
this.annotator.annotatedItemIds(this.userToken, this.serverURL)
|
|
1036
1041
|
.then((annotatedItemIds) => {
|
|
1042
|
+
if ('resource' in annotatedItemIds) {
|
|
1043
|
+
// The annotator has `resource` and `items` fields
|
|
1044
|
+
annotatedItemIds = annotatedItemIds.items
|
|
1045
|
+
}
|
|
1037
1046
|
for (const id of annotatedItemIds) {
|
|
1038
1047
|
this.mapImp.setFeatureAnnotated(id)
|
|
1039
1048
|
}
|
|
@@ -1050,6 +1059,10 @@ export default {
|
|
|
1050
1059
|
if (!this.annotationSubmitted) this.loading = true
|
|
1051
1060
|
this.annotator.drawnFeatures(this.userToken, this.serverURL)
|
|
1052
1061
|
.then((drawnFeatures) => {
|
|
1062
|
+
if ('resource' in drawnFeatures) {
|
|
1063
|
+
// The annotator has `resource` and `features` fields
|
|
1064
|
+
drawnFeatures = drawnFeatures.features
|
|
1065
|
+
}
|
|
1053
1066
|
// Use to switch the displayed feature type
|
|
1054
1067
|
if (this.drawnType !== 'All tools') {
|
|
1055
1068
|
drawnFeatures = drawnFeatures.filter((feature) => {
|
|
@@ -1467,7 +1480,7 @@ export default {
|
|
|
1467
1480
|
this.inDrawing = true
|
|
1468
1481
|
} else if (data.feature.mode === 'simple_select' && this.inDrawing) {
|
|
1469
1482
|
if (this.createdEvent) {
|
|
1470
|
-
this.
|
|
1483
|
+
this.connectionDisplay = true
|
|
1471
1484
|
} else {
|
|
1472
1485
|
// Reset if a invalid draw
|
|
1473
1486
|
this.initialiseDrawing()
|
|
@@ -1487,8 +1500,8 @@ export default {
|
|
|
1487
1500
|
if (this.currentDrawnFeature) {
|
|
1488
1501
|
let feature = this.drawnAnnotationFeatures
|
|
1489
1502
|
.filter((feature) => feature.id === this.currentDrawnFeature.id)[0]
|
|
1490
|
-
if (feature && feature.
|
|
1491
|
-
this.
|
|
1503
|
+
if (feature && feature.connection) {
|
|
1504
|
+
this.connectionEntry = feature.connection
|
|
1492
1505
|
}
|
|
1493
1506
|
this.drawModeEvent(payload)
|
|
1494
1507
|
}
|
|
@@ -1543,12 +1556,15 @@ export default {
|
|
|
1543
1556
|
} else {
|
|
1544
1557
|
this.currentActive = data.models ? data.models : ''
|
|
1545
1558
|
// Stop adding features if dialog displayed
|
|
1546
|
-
if (this.inDrawing && !this.
|
|
1547
|
-
// Only clicked
|
|
1548
|
-
let
|
|
1549
|
-
// only the linestring will have
|
|
1550
|
-
if (
|
|
1551
|
-
this.
|
|
1559
|
+
if (this.inDrawing && !this.connectionDisplay) {
|
|
1560
|
+
// Only clicked connection data will be added
|
|
1561
|
+
let nodeLabel = data.label ? data.label : `Feature ${data.id}`
|
|
1562
|
+
// only the linestring will have connection at the current stage
|
|
1563
|
+
if (nodeLabel && this.activeDrawTool === 'LineString') {
|
|
1564
|
+
this.connectionEntry[data.featureId] = Object.assign({label: nodeLabel},
|
|
1565
|
+
Object.fromEntries(
|
|
1566
|
+
Object.entries(data)
|
|
1567
|
+
.filter(([key]) => ['featureId', 'models'].includes(key))))
|
|
1552
1568
|
}
|
|
1553
1569
|
}
|
|
1554
1570
|
}
|
|
@@ -1578,7 +1594,7 @@ export default {
|
|
|
1578
1594
|
// for dialog popup
|
|
1579
1595
|
dialogCssHacks: function () {
|
|
1580
1596
|
this.$nextTick(() => {
|
|
1581
|
-
const dialog = this.$el.querySelector('.
|
|
1597
|
+
const dialog = this.$el.querySelector('.connection-dialog')
|
|
1582
1598
|
draggable(this.$el, dialog)
|
|
1583
1599
|
// dialog popup at the click position
|
|
1584
1600
|
// slightly change x or y if close to boundary
|
|
@@ -1601,7 +1617,7 @@ export default {
|
|
|
1601
1617
|
},
|
|
1602
1618
|
drawIconCssHacks: function () {
|
|
1603
1619
|
// set tool/mode icon status
|
|
1604
|
-
if (this.$el.querySelector('.iconSelected') || !this.
|
|
1620
|
+
if (this.$el.querySelector('.iconSelected') || !this.connectionDisplay) {
|
|
1605
1621
|
this.drawnTypes.map((t) => {
|
|
1606
1622
|
const dtype = this.$el.querySelector(`.draw${t}`)
|
|
1607
1623
|
if (dtype) {
|
|
@@ -1619,7 +1635,7 @@ export default {
|
|
|
1619
1635
|
this.drawModes.map((m) => {
|
|
1620
1636
|
this.$el.querySelector(`.draw${m}`).classList.add('inactive');
|
|
1621
1637
|
})
|
|
1622
|
-
} else if (this.activeDrawMode || this.
|
|
1638
|
+
} else if (this.activeDrawMode || this.connectionDisplay) {
|
|
1623
1639
|
if (this.activeDrawMode) {
|
|
1624
1640
|
this.$el.querySelector(`.draw${this.activeDrawMode}`).classList.add('iconSelected');
|
|
1625
1641
|
}
|
|
@@ -1657,18 +1673,13 @@ export default {
|
|
|
1657
1673
|
},
|
|
1658
1674
|
// checkNeuronClicked shows a neuron path pop up if a path was recently clicked
|
|
1659
1675
|
createConnectivityBody: function () {
|
|
1660
|
-
if (Object.keys(this.
|
|
1661
|
-
const
|
|
1676
|
+
if (Object.keys(this.connectionEntry).length > 0) {
|
|
1677
|
+
const features = Object.values(this.connectionEntry)
|
|
1662
1678
|
const body = {
|
|
1663
1679
|
type: 'connectivity',
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
}
|
|
1668
|
-
if (featureIds.length > 2) {
|
|
1669
|
-
featureIds.slice(1, -1).forEach((id) => {
|
|
1670
|
-
body.intermediateIds.push(id)
|
|
1671
|
-
});
|
|
1680
|
+
source: features[0],
|
|
1681
|
+
target: features[features.length - 1],
|
|
1682
|
+
intermediates: features.slice(1, -1),
|
|
1672
1683
|
}
|
|
1673
1684
|
this.annotationEntry.body = body
|
|
1674
1685
|
}
|
|
@@ -2487,8 +2498,8 @@ export default {
|
|
|
2487
2498
|
createdEvent: undefined,
|
|
2488
2499
|
annotationSubmitted: false,
|
|
2489
2500
|
inDrawing: false,
|
|
2490
|
-
|
|
2491
|
-
|
|
2501
|
+
connectionDisplay: false,
|
|
2502
|
+
connectionEntry: {},
|
|
2492
2503
|
drawnAnnotationFeatures: undefined, // Store all exist drawn features
|
|
2493
2504
|
doubleClickedFeature: false,
|
|
2494
2505
|
activeDrawMode: undefined,
|
|
@@ -2503,8 +2514,8 @@ export default {
|
|
|
2503
2514
|
},
|
|
2504
2515
|
computed: {
|
|
2505
2516
|
...mapState(useMainStore, ['userToken']),
|
|
2506
|
-
|
|
2507
|
-
return Object.keys(this.
|
|
2517
|
+
connection: function () {
|
|
2518
|
+
return Object.keys(this.connectionEntry).length > 0
|
|
2508
2519
|
}
|
|
2509
2520
|
},
|
|
2510
2521
|
watch: {
|
|
@@ -2537,27 +2548,27 @@ export default {
|
|
|
2537
2548
|
this.drawIconCssHacks()
|
|
2538
2549
|
},
|
|
2539
2550
|
/**
|
|
2540
|
-
* hide dialog when
|
|
2551
|
+
* hide dialog when connectionEntry is empty
|
|
2541
2552
|
*/
|
|
2542
|
-
|
|
2543
|
-
const
|
|
2553
|
+
connection: function (value) {
|
|
2554
|
+
const connectionIcon = this.$el.querySelector('.drawConnection')
|
|
2544
2555
|
if (!value) {
|
|
2545
|
-
this.
|
|
2546
|
-
|
|
2556
|
+
this.connectionDisplay = false
|
|
2557
|
+
connectionIcon.classList.add('inactive')
|
|
2547
2558
|
} else {
|
|
2548
|
-
|
|
2559
|
+
connectionIcon.classList.remove('inactive')
|
|
2549
2560
|
}
|
|
2550
2561
|
},
|
|
2551
2562
|
/**
|
|
2552
2563
|
* popup dialog via click icon
|
|
2553
2564
|
*/
|
|
2554
|
-
|
|
2555
|
-
const
|
|
2565
|
+
connectionDisplay: function (display) {
|
|
2566
|
+
const connectionIcon = this.$el.querySelector('.drawConnection')
|
|
2556
2567
|
if (display) {
|
|
2557
|
-
|
|
2568
|
+
connectionIcon.classList.add('iconSelected')
|
|
2558
2569
|
this.dialogCssHacks()
|
|
2559
2570
|
} else {
|
|
2560
|
-
|
|
2571
|
+
connectionIcon.classList.remove('iconSelected')
|
|
2561
2572
|
}
|
|
2562
2573
|
this.drawIconCssHacks()
|
|
2563
2574
|
},
|
|
@@ -2871,7 +2882,7 @@ export default {
|
|
|
2871
2882
|
}
|
|
2872
2883
|
|
|
2873
2884
|
.drawPoint, .drawLineString, .drawPolygon,
|
|
2874
|
-
.drawDelete, .drawEdit, .
|
|
2885
|
+
.drawDelete, .drawEdit, .drawConnection,
|
|
2875
2886
|
.zoomIn, .zoomOut, .fitWindow {
|
|
2876
2887
|
padding: 4px;
|
|
2877
2888
|
}
|
|
@@ -3298,7 +3309,7 @@ export default {
|
|
|
3298
3309
|
}
|
|
3299
3310
|
}
|
|
3300
3311
|
|
|
3301
|
-
.
|
|
3312
|
+
.connection-dialog {
|
|
3302
3313
|
position: absolute;
|
|
3303
3314
|
z-index: 10;
|
|
3304
3315
|
cursor: move;
|
package/src/components.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export {}
|
|
|
8
8
|
declare module 'vue' {
|
|
9
9
|
export interface GlobalComponents {
|
|
10
10
|
AnnotationTool: typeof import('./components/AnnotationTool.vue')['default']
|
|
11
|
+
ConnectionDialog: typeof import('./components/ConnectionDialog.vue')['default']
|
|
11
12
|
DynamicLegends: typeof import('./components/legends/DynamicLegends.vue')['default']
|
|
12
13
|
ElButton: typeof import('element-plus/es')['ElButton']
|
|
13
14
|
ElCard: typeof import('element-plus/es')['ElCard']
|
|
@@ -38,7 +39,6 @@ declare module 'vue' {
|
|
|
38
39
|
FlatmapVuer: typeof import('./components/FlatmapVuer.vue')['default']
|
|
39
40
|
MultiFlatmapVuer: typeof import('./components/MultiFlatmapVuer.vue')['default']
|
|
40
41
|
ProvenancePopup: typeof import('./components/ProvenancePopup.vue')['default']
|
|
41
|
-
RelevanceDialog: typeof import('./components/RelevanceDialog.vue')['default']
|
|
42
42
|
SelectionsGroup: typeof import('./components/SelectionsGroup.vue')['default']
|
|
43
43
|
SvgLegends: typeof import('./components/legends/SvgLegends.vue')['default']
|
|
44
44
|
Tooltip: typeof import('./components/Tooltip.vue')['default']
|