@abi-software/flatmapvuer 1.1.0-beta.1 → 1.1.0-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/dist/flatmapvuer.js +13905 -13695
- package/dist/flatmapvuer.umd.cjs +110 -110
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/App.vue +8 -0
- package/src/components/ConnectionDialog.vue +107 -100
- package/src/components/DrawTool.vue +509 -0
- package/src/components/ExternalResourceCard.vue +2 -0
- package/src/components/FlatmapVuer.vue +241 -523
- package/src/components/MultiFlatmapVuer.vue +17 -3
- package/src/components/SelectionsGroup.vue +57 -0
- package/src/components.d.ts +1 -0
- package/src/icons/yellowstar.js +1 -1
|
@@ -141,127 +141,26 @@ Please use `const` to assign meaningful names to them...
|
|
|
141
141
|
<el-icon-arrow-down />
|
|
142
142
|
</el-icon>
|
|
143
143
|
|
|
144
|
-
<
|
|
145
|
-
v-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
</template>
|
|
165
|
-
</el-popover>
|
|
166
|
-
<el-popover
|
|
167
|
-
content="Draw Point"
|
|
168
|
-
placement="top"
|
|
169
|
-
:teleported="false"
|
|
170
|
-
trigger="manual"
|
|
171
|
-
width="80"
|
|
172
|
-
popper-class="flatmap-popper"
|
|
173
|
-
:visible="hoverVisibilities[11].value"
|
|
174
|
-
v-if="drawnType !== 'LineString' && drawnType !== 'Polygon'"
|
|
175
|
-
>
|
|
176
|
-
<template #reference>
|
|
177
|
-
<map-svg-icon
|
|
178
|
-
icon="drawPoint"
|
|
179
|
-
class="icon-button drawPoint"
|
|
180
|
-
@click="drawingEvent('Point')"
|
|
181
|
-
@mouseover="showToolitip(11)"
|
|
182
|
-
@mouseout="hideToolitip(11)"
|
|
183
|
-
/>
|
|
184
|
-
</template>
|
|
185
|
-
</el-popover>
|
|
186
|
-
<el-popover
|
|
187
|
-
content="Draw Line"
|
|
188
|
-
placement="top"
|
|
189
|
-
:teleported="false"
|
|
190
|
-
trigger="manual"
|
|
191
|
-
width="80"
|
|
192
|
-
popper-class="flatmap-popper"
|
|
193
|
-
:visible="hoverVisibilities[12].value"
|
|
194
|
-
v-if="drawnType !== 'Point' && drawnType !== 'Polygon'"
|
|
195
|
-
>
|
|
196
|
-
<template #reference>
|
|
197
|
-
<map-svg-icon
|
|
198
|
-
icon="drawLine"
|
|
199
|
-
class="icon-button drawLineString"
|
|
200
|
-
@click="drawingEvent('LineString')"
|
|
201
|
-
@mouseover="showToolitip(12)"
|
|
202
|
-
@mouseout="hideToolitip(12)"
|
|
203
|
-
/>
|
|
204
|
-
</template>
|
|
205
|
-
</el-popover>
|
|
206
|
-
<el-popover
|
|
207
|
-
content="Draw Polygon"
|
|
208
|
-
placement="top"
|
|
209
|
-
:teleported="false"
|
|
210
|
-
trigger="manual"
|
|
211
|
-
width="80"
|
|
212
|
-
popper-class="flatmap-popper"
|
|
213
|
-
:visible="hoverVisibilities[13].value"
|
|
214
|
-
v-if="drawnType !== 'Point' && drawnType !== 'LineString'"
|
|
215
|
-
>
|
|
216
|
-
<template #reference>
|
|
217
|
-
<map-svg-icon
|
|
218
|
-
icon="drawPolygon"
|
|
219
|
-
class="icon-button drawPolygon"
|
|
220
|
-
@click="drawingEvent('Polygon')"
|
|
221
|
-
@mouseover="showToolitip(13)"
|
|
222
|
-
@mouseout="hideToolitip(13)"
|
|
223
|
-
/>
|
|
224
|
-
</template>
|
|
225
|
-
</el-popover>
|
|
226
|
-
<el-popover
|
|
227
|
-
content="Delete"
|
|
228
|
-
placement="top"
|
|
229
|
-
:teleported="false"
|
|
230
|
-
trigger="manual"
|
|
231
|
-
width="80"
|
|
232
|
-
popper-class="flatmap-popper"
|
|
233
|
-
:visible="hoverVisibilities[14].value"
|
|
234
|
-
>
|
|
235
|
-
<template #reference>
|
|
236
|
-
<map-svg-icon
|
|
237
|
-
icon="drawTrash"
|
|
238
|
-
class="icon-button drawDelete"
|
|
239
|
-
@click="drawingEvent('Delete')"
|
|
240
|
-
@mouseover="showToolitip(14)"
|
|
241
|
-
@mouseout="hideToolitip(14)"
|
|
242
|
-
/>
|
|
243
|
-
</template>
|
|
244
|
-
</el-popover>
|
|
245
|
-
<el-popover
|
|
246
|
-
content="Edit"
|
|
247
|
-
placement="top"
|
|
248
|
-
:teleported="false"
|
|
249
|
-
trigger="manual"
|
|
250
|
-
width="80"
|
|
251
|
-
popper-class="flatmap-popper"
|
|
252
|
-
:visible="hoverVisibilities[15].value"
|
|
253
|
-
>
|
|
254
|
-
<template #reference>
|
|
255
|
-
<map-svg-icon
|
|
256
|
-
icon="comment"
|
|
257
|
-
class="icon-button drawEdit"
|
|
258
|
-
@click="drawingEvent('Edit')"
|
|
259
|
-
@mouseover="showToolitip(15)"
|
|
260
|
-
@mouseout="hideToolitip(15)"
|
|
261
|
-
/>
|
|
262
|
-
</template>
|
|
263
|
-
</el-popover>
|
|
264
|
-
</div>
|
|
144
|
+
<DrawTool
|
|
145
|
+
v-if="viewingMode === 'Annotation' && userInformation && !disableUI"
|
|
146
|
+
:helpMode="helpMode"
|
|
147
|
+
:flatmapCanvas="this.$el"
|
|
148
|
+
:inDrawing="inDrawing"
|
|
149
|
+
:activeDrawTool="activeDrawTool"
|
|
150
|
+
:drawnType="drawnType"
|
|
151
|
+
:drawnTypes="drawnTypes"
|
|
152
|
+
:activeDrawMode="activeDrawMode"
|
|
153
|
+
:drawModes="drawModes"
|
|
154
|
+
:connectionDisplay="connectionDisplay"
|
|
155
|
+
:connectionEntry="connectionEntry"
|
|
156
|
+
@drawToolbarEvent="drawToolbarEvent"
|
|
157
|
+
@dialogDisplay="connectionDialogDisplay"
|
|
158
|
+
@confirmDrawn="confirmDrawnFeature"
|
|
159
|
+
@cancelDrawn="cancelDrawnFeature"
|
|
160
|
+
@showFeatureTooltip="showConnectedFeatureTooltip"
|
|
161
|
+
@hideFeatureTooltip="hideConnectedFeatureTooltip"
|
|
162
|
+
@connection="(display) => connectionDisplay = display"
|
|
163
|
+
/>
|
|
265
164
|
|
|
266
165
|
<div class="bottom-right-control" v-show="!disableUI">
|
|
267
166
|
<el-popover
|
|
@@ -332,6 +231,7 @@ Please use `const` to assign meaningful names to them...
|
|
|
332
231
|
placement="right"
|
|
333
232
|
:teleported="false"
|
|
334
233
|
trigger="manual"
|
|
234
|
+
:offset="-18"
|
|
335
235
|
popper-class="flatmap-popper"
|
|
336
236
|
:visible="hoverVisibilities[4].value"
|
|
337
237
|
ref="checkBoxPopover"
|
|
@@ -352,10 +252,12 @@ Please use `const` to assign meaningful names to them...
|
|
|
352
252
|
<el-popover
|
|
353
253
|
content="Location of the featured dataset"
|
|
354
254
|
placement="right"
|
|
355
|
-
:teleported="
|
|
356
|
-
trigger="
|
|
357
|
-
|
|
358
|
-
:
|
|
255
|
+
:teleported="true"
|
|
256
|
+
trigger="manual"
|
|
257
|
+
width="max-content"
|
|
258
|
+
:offset="-10"
|
|
259
|
+
popper-class="flatmap-popper flatmap-teleport-popper"
|
|
260
|
+
:visible="hoverVisibilities[9].value && showStarInLegend"
|
|
359
261
|
ref="featuredMarkerPopover"
|
|
360
262
|
>
|
|
361
263
|
<template #reference>
|
|
@@ -364,6 +266,8 @@ Please use `const` to assign meaningful names to them...
|
|
|
364
266
|
v-popover:featuredMarkerPopover
|
|
365
267
|
class="yellow-star-legend"
|
|
366
268
|
v-html="yellowstar"
|
|
269
|
+
@mouseover="showToolitip(9)"
|
|
270
|
+
@mouseout="hideToolitip(9)"
|
|
367
271
|
></div>
|
|
368
272
|
</template>
|
|
369
273
|
</el-popover>
|
|
@@ -372,8 +276,9 @@ Please use `const` to assign meaningful names to them...
|
|
|
372
276
|
content="Find these markers for data"
|
|
373
277
|
placement="right"
|
|
374
278
|
:teleported="false"
|
|
279
|
+
width="max-content"
|
|
375
280
|
trigger="manual"
|
|
376
|
-
popper-class="flatmap-popper
|
|
281
|
+
popper-class="flatmap-popper"
|
|
377
282
|
:visible="hoverVisibilities[5].value"
|
|
378
283
|
ref="markerPopover"
|
|
379
284
|
>
|
|
@@ -404,6 +309,7 @@ Please use `const` to assign meaningful names to them...
|
|
|
404
309
|
:selections="alertOptions"
|
|
405
310
|
@changed="alertSelected"
|
|
406
311
|
@checkboxMouseEnter="alertMouseEnterEmitted"
|
|
312
|
+
@selections-data-changed="onSelectionsDataChanged"
|
|
407
313
|
ref="alertSelection"
|
|
408
314
|
key="alertSelection"
|
|
409
315
|
/>
|
|
@@ -415,6 +321,7 @@ Please use `const` to assign meaningful names to them...
|
|
|
415
321
|
identifierKey="key"
|
|
416
322
|
:selections="sckanDisplay"
|
|
417
323
|
@changed="sckanSelected"
|
|
324
|
+
@selections-data-changed="onSelectionsDataChanged"
|
|
418
325
|
@checkAll="checkAllSCKAN"
|
|
419
326
|
ref="skcanSelection"
|
|
420
327
|
key="skcanSelection"
|
|
@@ -426,6 +333,7 @@ Please use `const` to assign meaningful names to them...
|
|
|
426
333
|
identifierKey="id"
|
|
427
334
|
:selections="layers"
|
|
428
335
|
@changed="layersSelected"
|
|
336
|
+
@selections-data-changed="onSelectionsDataChanged"
|
|
429
337
|
@checkAll="checkAllLayers"
|
|
430
338
|
ref="layersSelection"
|
|
431
339
|
key="layersSelection"
|
|
@@ -439,18 +347,20 @@ Please use `const` to assign meaningful names to them...
|
|
|
439
347
|
colourStyle="line"
|
|
440
348
|
:selections="pathways"
|
|
441
349
|
@changed="pathwaysSelected"
|
|
350
|
+
@selections-data-changed="onSelectionsDataChanged"
|
|
442
351
|
@checkAll="checkAllPathways"
|
|
443
352
|
ref="pathwaysSelection"
|
|
444
353
|
key="pathwaysSelection"
|
|
445
354
|
/>
|
|
446
355
|
<selections-group
|
|
447
356
|
v-if="!isFC && taxonConnectivity && taxonConnectivity.length > 0"
|
|
448
|
-
title="
|
|
357
|
+
title="Studied in"
|
|
449
358
|
labelKey="label"
|
|
450
359
|
identifierKey="taxon"
|
|
451
360
|
:selections="taxonConnectivity"
|
|
452
361
|
@changed="taxonsSelected"
|
|
453
362
|
@checkboxMouseEnter="taxonMouseEnterEmitted"
|
|
363
|
+
@selections-data-changed="onSelectionsDataChanged"
|
|
454
364
|
@checkAll="checkAllTaxons"
|
|
455
365
|
ref="taxonSelection"
|
|
456
366
|
key="taxonSelection"
|
|
@@ -462,6 +372,7 @@ Please use `const` to assign meaningful names to them...
|
|
|
462
372
|
identifierKey="key"
|
|
463
373
|
:selections="centreLines"
|
|
464
374
|
@changed="centreLinesSelected"
|
|
375
|
+
@selections-data-changed="onSelectionsDataChanged"
|
|
465
376
|
ref="centrelinesSelection"
|
|
466
377
|
key="centrelinesSelection"
|
|
467
378
|
/>
|
|
@@ -686,18 +597,6 @@ Please use `const` to assign meaningful names to them...
|
|
|
686
597
|
:annotationDisplay="viewingMode === 'Annotation'"
|
|
687
598
|
@annotation="commitAnnotationEvent"
|
|
688
599
|
/>
|
|
689
|
-
<ConnectionDialog
|
|
690
|
-
class="connection-dialog"
|
|
691
|
-
v-show="connectionDisplay"
|
|
692
|
-
:entry="connectionEntry"
|
|
693
|
-
:drawing="inDrawing"
|
|
694
|
-
:connection="connection"
|
|
695
|
-
@display="connectionDialogPopup"
|
|
696
|
-
@confirm="confirmDrawnFeature"
|
|
697
|
-
@cancel="cancelDrawnFeature"
|
|
698
|
-
@popup="closePopup"
|
|
699
|
-
@tooltip="displayConnectedFeatureTooltip"
|
|
700
|
-
/>
|
|
701
600
|
</div>
|
|
702
601
|
</div>
|
|
703
602
|
</template>
|
|
@@ -735,59 +634,9 @@ import yellowstar from '../icons/yellowstar'
|
|
|
735
634
|
import ResizeSensor from 'css-element-queries/src/ResizeSensor'
|
|
736
635
|
import * as flatmap from '@abi-software/flatmap-viewer'
|
|
737
636
|
import { AnnotationService } from '@abi-software/sparc-annotation'
|
|
738
|
-
import ConnectionDialog from './ConnectionDialog.vue'
|
|
739
637
|
import { mapState } from 'pinia'
|
|
740
638
|
import { useMainStore } from '@/store/index'
|
|
741
|
-
|
|
742
|
-
/**
|
|
743
|
-
* @param scopeElement Draggable scope area (Optional)
|
|
744
|
-
* @param dragElement Draggable element
|
|
745
|
-
*/
|
|
746
|
-
const draggable = (scopeElement, dragElement) => {
|
|
747
|
-
let startX, startY, clickX, clickY, posX, posY
|
|
748
|
-
// reset position in case previous pupped up dialog is dragged
|
|
749
|
-
dragElement.style.left = ''
|
|
750
|
-
dragElement.style.top = ''
|
|
751
|
-
// const scopeRect = scopeElement.getBoundingClientRect()
|
|
752
|
-
// const dragRect = dragElement.getBoundingClientRect()
|
|
753
|
-
|
|
754
|
-
dragElement.addEventListener('mousedown', (e) => {
|
|
755
|
-
e.preventDefault();
|
|
756
|
-
startX = dragElement.offsetLeft
|
|
757
|
-
startY = dragElement.offsetTop
|
|
758
|
-
clickX = e.clientX
|
|
759
|
-
clickY = e.clientY
|
|
760
|
-
|
|
761
|
-
dragElement.addEventListener('mousemove', drag, false);
|
|
762
|
-
document.addEventListener('mouseup', () => {
|
|
763
|
-
dragElement.removeEventListener('mousemove', drag, false);
|
|
764
|
-
}, false);
|
|
765
|
-
}, false);
|
|
766
|
-
|
|
767
|
-
function drag(e) {
|
|
768
|
-
e.preventDefault();
|
|
769
|
-
posX = startX - (clickX - e.clientX)
|
|
770
|
-
posY = startY - (clickY - e.clientY)
|
|
771
|
-
// if (
|
|
772
|
-
// (posX > scopeRect.left && ((posX + dragRect.width) < scopeRect.right)) &&
|
|
773
|
-
// (posY > scopeRect.top && ((posY + dragRect.height) < scopeRect.bottom))
|
|
774
|
-
// ) {
|
|
775
|
-
dragElement.style.left = `${posX}px`;
|
|
776
|
-
dragElement.style.top = `${posY}px`;
|
|
777
|
-
// } else {
|
|
778
|
-
// if (posX <= scopeRect.left) {
|
|
779
|
-
// dragElement.style.left = '0px';
|
|
780
|
-
// } else if (posX + dragRect.width >= scopeRect.right) {
|
|
781
|
-
// dragElement.style.left = `${scopeRect.right - dragRect.width}px`;
|
|
782
|
-
// }
|
|
783
|
-
// if (posY <= scopeRect.top) {
|
|
784
|
-
// dragElement.style.top = '0px';
|
|
785
|
-
// } else if (posY + dragRect.height >= scopeRect.bottom) {
|
|
786
|
-
// dragElement.style.top = `${scopeRect.bottom - dragRect.height}px`;
|
|
787
|
-
// }
|
|
788
|
-
// }
|
|
789
|
-
}
|
|
790
|
-
}
|
|
639
|
+
import DrawTool from './DrawTool.vue'
|
|
791
640
|
|
|
792
641
|
const centroid = (geometry) => {
|
|
793
642
|
let featureGeometry = { lng: 0, lat: 0, }
|
|
@@ -894,6 +743,7 @@ export default {
|
|
|
894
743
|
ElIconWarningFilled,
|
|
895
744
|
ElIconArrowDown,
|
|
896
745
|
ElIconArrowLeft,
|
|
746
|
+
DrawTool
|
|
897
747
|
},
|
|
898
748
|
beforeCreate: function () {
|
|
899
749
|
this.mapManager = undefined
|
|
@@ -916,17 +766,17 @@ export default {
|
|
|
916
766
|
this.inDrawing = false
|
|
917
767
|
this.initialiseDialog()
|
|
918
768
|
this.activeDrawTool = undefined
|
|
919
|
-
this.
|
|
769
|
+
this.drawnCreatedEvent = undefined
|
|
920
770
|
},
|
|
921
771
|
/**
|
|
922
772
|
* @vuese
|
|
923
773
|
* Function to cancel a newly drawn feature.
|
|
924
774
|
*/
|
|
925
775
|
cancelDrawnFeature: function () {
|
|
926
|
-
if (this.
|
|
927
|
-
this.
|
|
776
|
+
if (this.drawnCreatedEvent) {
|
|
777
|
+
this.closeTooltip()
|
|
928
778
|
this.annotationEntry = {
|
|
929
|
-
...this.
|
|
779
|
+
...this.drawnCreatedEvent.feature,
|
|
930
780
|
resourceId: this.serverURL,
|
|
931
781
|
}
|
|
932
782
|
this.rollbackAnnotationEvent()
|
|
@@ -935,13 +785,36 @@ export default {
|
|
|
935
785
|
},
|
|
936
786
|
/**
|
|
937
787
|
* @vuese
|
|
938
|
-
* Function to
|
|
788
|
+
* Function to show connected features' tooltip for drawn connectivity.
|
|
789
|
+
* @arg id
|
|
790
|
+
*/
|
|
791
|
+
showConnectedFeatureTooltip: function (id) {
|
|
792
|
+
if (this.mapImp) {
|
|
793
|
+
if (id) {
|
|
794
|
+
const numericId = Number(id)
|
|
795
|
+
let payload = { feature: {} }
|
|
796
|
+
if (numericId) {
|
|
797
|
+
const data = this.mapImp.featureProperties(numericId)
|
|
798
|
+
payload.feature = data
|
|
799
|
+
} else {
|
|
800
|
+
const drawnFeature = this.allDrawnFeatures.filter((feature) => feature.id === id.replace(' ', ''))[0]
|
|
801
|
+
payload.feature.feature = drawnFeature
|
|
802
|
+
}
|
|
803
|
+
this.checkAndCreatePopups(payload)
|
|
804
|
+
} else {
|
|
805
|
+
this.closeTooltip()
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
},
|
|
809
|
+
/**
|
|
810
|
+
* @vuese
|
|
811
|
+
* Function to hide connected features' tooltip for drawn connectivity.
|
|
939
812
|
* @arg id
|
|
940
813
|
*/
|
|
941
|
-
|
|
814
|
+
hideConnectedFeatureTooltip: function (id) {
|
|
942
815
|
if (this.mapImp) {
|
|
943
|
-
const
|
|
944
|
-
this.
|
|
816
|
+
// const numericId = Number(id)
|
|
817
|
+
this.closeTooltip()
|
|
945
818
|
}
|
|
946
819
|
},
|
|
947
820
|
/**
|
|
@@ -949,8 +822,8 @@ export default {
|
|
|
949
822
|
* Function to confirm a newly drawn feature.
|
|
950
823
|
*/
|
|
951
824
|
confirmDrawnFeature: function () {
|
|
952
|
-
if (this.
|
|
953
|
-
this.checkAndCreatePopups(this.
|
|
825
|
+
if (this.drawnCreatedEvent) {
|
|
826
|
+
this.checkAndCreatePopups(this.drawnCreatedEvent)
|
|
954
827
|
// Add connection if exist to annotationEntry
|
|
955
828
|
// Connection will only be added in creating new drawn feature annotation
|
|
956
829
|
// And will not be updated if move drawn features
|
|
@@ -972,11 +845,11 @@ export default {
|
|
|
972
845
|
* @vuese
|
|
973
846
|
* Function to display the connection dialog after finalising a drawing.
|
|
974
847
|
*/
|
|
975
|
-
|
|
848
|
+
connectionDialogDisplay: function () {
|
|
976
849
|
const inactive = this.$el.querySelector('.drawConnection').classList.contains('inactive')
|
|
977
850
|
// disable click popup if icon inactive or in drawing
|
|
978
851
|
if (!inactive && !this.inDrawing) {
|
|
979
|
-
this.
|
|
852
|
+
this.closeTooltip()
|
|
980
853
|
this.connectionDisplay = !this.connectionDisplay
|
|
981
854
|
}
|
|
982
855
|
},
|
|
@@ -985,28 +858,14 @@ export default {
|
|
|
985
858
|
* Function to process the annotation toolbar click events.
|
|
986
859
|
* @arg type
|
|
987
860
|
*/
|
|
988
|
-
|
|
989
|
-
this.
|
|
990
|
-
// disable mode icon click if any tool is active
|
|
861
|
+
drawToolbarEvent: function (type) {
|
|
862
|
+
this.closeTooltip()
|
|
991
863
|
if (this.drawnTypes.includes(type) && !this.activeDrawMode && !this.connectionDisplay) {
|
|
992
|
-
|
|
993
|
-
const point = this.$el.querySelector('.mapbox-gl-draw_point')
|
|
994
|
-
this.$el.querySelector('.mapbox-gl-draw_point').click()
|
|
995
|
-
this.activeDrawTool = point.classList.contains('active') ? 'Point' : undefined
|
|
996
|
-
} else if (type === 'LineString') {
|
|
997
|
-
const line = this.$el.querySelector('.mapbox-gl-draw_line')
|
|
998
|
-
this.$el.querySelector('.mapbox-gl-draw_line').click()
|
|
999
|
-
this.activeDrawTool = line.classList.contains('active') ? 'LineString' : undefined
|
|
1000
|
-
} else if (type === 'Polygon') {
|
|
1001
|
-
const polygon = this.$el.querySelector('.mapbox-gl-draw_polygon')
|
|
1002
|
-
this.$el.querySelector('.mapbox-gl-draw_polygon').click()
|
|
1003
|
-
this.activeDrawTool = polygon.classList.contains('active') ? 'Polygon' : undefined
|
|
1004
|
-
}
|
|
1005
|
-
// disable tool icon click if any mode is on
|
|
864
|
+
this.activeDrawTool = type
|
|
1006
865
|
} else if (this.drawModes.includes(type) && !this.activeDrawTool) {
|
|
1007
866
|
if (type === 'Delete') {
|
|
1008
867
|
if (
|
|
1009
|
-
this.
|
|
868
|
+
this.selectedDrawnFeature &&
|
|
1010
869
|
// For either no mode is on or edit is on
|
|
1011
870
|
(!this.activeDrawMode || this.activeDrawMode === 'Edit')
|
|
1012
871
|
) {
|
|
@@ -1014,15 +873,13 @@ export default {
|
|
|
1014
873
|
this.doubleClickedFeature = false
|
|
1015
874
|
this.changeAnnotationDrawMode({
|
|
1016
875
|
mode: 'simple_select',
|
|
1017
|
-
options: { featureIds: [this.
|
|
876
|
+
options: { featureIds: [this.selectedDrawnFeature.id] }
|
|
1018
877
|
})
|
|
1019
|
-
this.
|
|
878
|
+
this.modifyAnnotationFeature()
|
|
1020
879
|
}
|
|
1021
880
|
this.activeDrawMode = this.activeDrawMode === 'Delete' ? undefined : 'Delete'
|
|
1022
|
-
// clear
|
|
1023
|
-
if (!this.activeDrawMode)
|
|
1024
|
-
this.currentDrawnFeature = undefined
|
|
1025
|
-
}
|
|
881
|
+
// clear selectedDrawnFeature when quit delete mode
|
|
882
|
+
if (!this.activeDrawMode) this.selectedDrawnFeature = undefined
|
|
1026
883
|
} else if (type === 'Edit') {
|
|
1027
884
|
this.activeDrawMode = this.activeDrawMode === 'Edit' ? undefined : 'Edit'
|
|
1028
885
|
}
|
|
@@ -1045,8 +902,8 @@ export default {
|
|
|
1045
902
|
clearAnnotationFeature: function () {
|
|
1046
903
|
if (
|
|
1047
904
|
this.mapImp &&
|
|
1048
|
-
this.
|
|
1049
|
-
this.
|
|
905
|
+
this.allDrawnFeatures &&
|
|
906
|
+
this.allDrawnFeatures.length > 0
|
|
1050
907
|
) {
|
|
1051
908
|
this.mapImp.clearAnnotationFeature()
|
|
1052
909
|
}
|
|
@@ -1056,7 +913,7 @@ export default {
|
|
|
1056
913
|
* Function to fire the ``trash`` action.
|
|
1057
914
|
* See https://github.com/mapbox/mapbox-gl-draw/blob/main/docs/API.md#trash-draw for more details.
|
|
1058
915
|
*/
|
|
1059
|
-
|
|
916
|
+
modifyAnnotationFeature: function () {
|
|
1060
917
|
if (this.mapImp) {
|
|
1061
918
|
// Fire the 'trash' button
|
|
1062
919
|
// Not only use to remove features
|
|
@@ -1089,86 +946,76 @@ export default {
|
|
|
1089
946
|
// Only when annotation comments stored successfully
|
|
1090
947
|
annotation
|
|
1091
948
|
) {
|
|
1092
|
-
this.
|
|
949
|
+
this.featureAnnotationSubmitted = true
|
|
1093
950
|
this.mapImp.commitAnnotationEvent(this.annotationEntry)
|
|
1094
|
-
if (this.annotationEntry.type === 'deleted')
|
|
1095
|
-
|
|
1096
|
-
} else {
|
|
1097
|
-
// Use to update 'this.drawnAnnotationFeatures' when created or updated
|
|
1098
|
-
this.addAnnotationFeature()
|
|
1099
|
-
}
|
|
951
|
+
if (this.annotationEntry.type === 'deleted') this.closeTooltip()
|
|
952
|
+
else this.addAnnotationFeature() // Update 'allDrawnFeatures' when created or updated event
|
|
1100
953
|
}
|
|
1101
954
|
},
|
|
955
|
+
/**
|
|
956
|
+
* @vuese
|
|
957
|
+
* Function to fetch annotated item id.
|
|
958
|
+
* @arg userId,
|
|
959
|
+
* @arg participated
|
|
960
|
+
*/
|
|
961
|
+
fetchAnnotatedItemIds: async function (userId = undefined, participated = undefined) {
|
|
962
|
+
let annotatedItemIds = await this.annotator.annotatedItemIds(this.userToken, this.serverURL, userId, participated)
|
|
963
|
+
// The annotator has `resource` and `items` fields
|
|
964
|
+
if ('resource' in annotatedItemIds) annotatedItemIds = annotatedItemIds.itemIds
|
|
965
|
+
return annotatedItemIds
|
|
966
|
+
},
|
|
1102
967
|
/**
|
|
1103
968
|
* @vuese
|
|
1104
969
|
* Function to add existing drawn annotations to flatmap.
|
|
1105
970
|
*/
|
|
1106
|
-
setFeatureAnnotated: function () {
|
|
971
|
+
setFeatureAnnotated: async function () {
|
|
1107
972
|
if (this.mapImp) {
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
annotatedItemIds = annotatedItemIds.itemIds
|
|
1113
|
-
}
|
|
1114
|
-
for (const id of annotatedItemIds) {
|
|
1115
|
-
this.mapImp.setFeatureAnnotated(id)
|
|
1116
|
-
}
|
|
1117
|
-
})
|
|
1118
|
-
.catch((reason) => {
|
|
1119
|
-
console.log(reason) // Error!
|
|
1120
|
-
})
|
|
973
|
+
const annotatedItemIds = await this.fetchAnnotatedItemIds()
|
|
974
|
+
for (const id of annotatedItemIds) {
|
|
975
|
+
this.mapImp.setFeatureAnnotated(id)
|
|
976
|
+
}
|
|
1121
977
|
}
|
|
1122
978
|
},
|
|
979
|
+
/**
|
|
980
|
+
* @vuese
|
|
981
|
+
* Function to fetch drawn features.
|
|
982
|
+
* @arg userId,
|
|
983
|
+
* @arg participated
|
|
984
|
+
*/
|
|
985
|
+
fetchDrawnFeatures: async function (userId, participated) {
|
|
986
|
+
const annotatedItemIds = await this.fetchAnnotatedItemIds(userId, participated)
|
|
987
|
+
let drawnFeatures = await this.annotator.drawnFeatures(this.userToken, this.serverURL, annotatedItemIds)
|
|
988
|
+
// The annotator has `resource` and `features` fields
|
|
989
|
+
if ('resource' in drawnFeatures) drawnFeatures = drawnFeatures.features
|
|
990
|
+
// Use to switch the displayed feature type
|
|
991
|
+
if (this.drawnType !== 'All tools') {
|
|
992
|
+
drawnFeatures = drawnFeatures.filter((feature) => {
|
|
993
|
+
return feature.geometry.type === this.drawnType
|
|
994
|
+
})
|
|
995
|
+
}
|
|
996
|
+
return drawnFeatures
|
|
997
|
+
},
|
|
1123
998
|
/**
|
|
1124
999
|
* @vuese
|
|
1125
1000
|
* Function to draw existing drawn annotations based on selector.
|
|
1126
1001
|
*/
|
|
1127
|
-
addAnnotationFeature: function () {
|
|
1002
|
+
addAnnotationFeature: async function () {
|
|
1128
1003
|
if (this.mapImp) {
|
|
1129
|
-
if (!this.
|
|
1004
|
+
if (!this.featureAnnotationSubmitted) this.clearAnnotationFeature()
|
|
1130
1005
|
if (this.drawnType !== 'None') {
|
|
1131
|
-
if (!this.
|
|
1006
|
+
if (!this.featureAnnotationSubmitted) this.loading = true
|
|
1132
1007
|
const userId = this.annotatedType === 'Anyone' ?
|
|
1133
|
-
undefined : this.userInformation.orcid ?
|
|
1134
|
-
this.userInformation.orcid : '0000-0000-0000-0000'
|
|
1008
|
+
undefined : this.userInformation.orcid ? this.userInformation.orcid : '0000-0000-0000-0000'
|
|
1135
1009
|
const participated = this.annotatedType === 'Anyone' ?
|
|
1136
|
-
undefined : this.annotatedType === 'Me' ?
|
|
1137
|
-
|
|
1138
|
-
this.
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
.then((drawnFeatures) => {
|
|
1146
|
-
if ('resource' in drawnFeatures) {
|
|
1147
|
-
// The annotator has `resource` and `features` fields
|
|
1148
|
-
drawnFeatures = drawnFeatures.features
|
|
1149
|
-
}
|
|
1150
|
-
// Use to switch the displayed feature type
|
|
1151
|
-
if (this.drawnType !== 'All tools') {
|
|
1152
|
-
drawnFeatures = drawnFeatures.filter((feature) => {
|
|
1153
|
-
return feature.geometry.type === this.drawnType
|
|
1154
|
-
})
|
|
1155
|
-
}
|
|
1156
|
-
this.drawnAnnotationFeatures = drawnFeatures
|
|
1157
|
-
this.loading = false
|
|
1158
|
-
// No need to call 'addAnnotationFeature' when a new feature created, as it is already on the map
|
|
1159
|
-
if (!this.annotationSubmitted) {
|
|
1160
|
-
for (const feature of drawnFeatures) {
|
|
1161
|
-
this.mapImp.addAnnotationFeature(feature)
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
})
|
|
1165
|
-
.catch((reason) => {
|
|
1166
|
-
console.log(reason) // Error!
|
|
1167
|
-
})
|
|
1168
|
-
})
|
|
1169
|
-
.catch((reason) => {
|
|
1170
|
-
console.log(reason) // Error!
|
|
1171
|
-
})
|
|
1010
|
+
undefined : this.annotatedType === 'Me' ? true : false
|
|
1011
|
+
const drawnFeatures = await this.fetchDrawnFeatures(userId, participated)
|
|
1012
|
+
this.allDrawnFeatures = drawnFeatures
|
|
1013
|
+
this.loading = false
|
|
1014
|
+
if (!this.featureAnnotationSubmitted) {
|
|
1015
|
+
for (const feature of drawnFeatures) {
|
|
1016
|
+
this.mapImp.addAnnotationFeature(feature)
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1172
1019
|
}
|
|
1173
1020
|
}
|
|
1174
1021
|
},
|
|
@@ -1378,6 +1225,9 @@ export default {
|
|
|
1378
1225
|
this.mapImp.enableCentrelines(payload.value)
|
|
1379
1226
|
}
|
|
1380
1227
|
},
|
|
1228
|
+
onSelectionsDataChanged: function (data) {
|
|
1229
|
+
this.$emit('pathway-selection-changed', data);
|
|
1230
|
+
},
|
|
1381
1231
|
/**
|
|
1382
1232
|
* // Currently not in use
|
|
1383
1233
|
* Function to show or hide paths valid in SCKAN
|
|
@@ -1549,7 +1399,7 @@ export default {
|
|
|
1549
1399
|
},
|
|
1550
1400
|
/**
|
|
1551
1401
|
* @vuese
|
|
1552
|
-
* Function to show or hide connectivity features
|
|
1402
|
+
* Function to show or hide connectivity features studied in particular species
|
|
1553
1403
|
* by providing ``{taxonId, true/false}`` in ``payload.key, payload.value``.
|
|
1554
1404
|
* @arg payload
|
|
1555
1405
|
*/
|
|
@@ -1576,7 +1426,7 @@ export default {
|
|
|
1576
1426
|
},
|
|
1577
1427
|
/**
|
|
1578
1428
|
* @vuese
|
|
1579
|
-
* Function to show or hide connectivity features
|
|
1429
|
+
* Function to show or hide connectivity features studied in particular species
|
|
1580
1430
|
* by providing ``payload`` with ``payload.keys`` array and ``payload.value`` flag.
|
|
1581
1431
|
* @arg payload
|
|
1582
1432
|
*/
|
|
@@ -1627,11 +1477,11 @@ export default {
|
|
|
1627
1477
|
* @arg data
|
|
1628
1478
|
*/
|
|
1629
1479
|
annotationEventCallback: function (payload, data) {
|
|
1630
|
-
// Popup closed will trigger aborted event
|
|
1480
|
+
// Popup closed will trigger aborted event this is used to control the tooltip
|
|
1631
1481
|
if (data.type === 'aborted') {
|
|
1632
1482
|
// Rollback drawing when no new annotation submitted
|
|
1633
|
-
if (!this.
|
|
1634
|
-
else this.
|
|
1483
|
+
if (!this.featureAnnotationSubmitted) this.rollbackAnnotationEvent()
|
|
1484
|
+
else this.featureAnnotationSubmitted = false
|
|
1635
1485
|
} else if (data.type === 'modeChanged') {
|
|
1636
1486
|
// 'modeChanged' event is before 'created' event
|
|
1637
1487
|
if (data.feature.mode.startsWith('draw_')) {
|
|
@@ -1639,30 +1489,22 @@ export default {
|
|
|
1639
1489
|
this.initialiseDialog()
|
|
1640
1490
|
this.inDrawing = true
|
|
1641
1491
|
} else if (data.feature.mode === 'simple_select' && this.inDrawing) {
|
|
1642
|
-
if (this.
|
|
1643
|
-
|
|
1644
|
-
} else {
|
|
1645
|
-
// Reset if a invalid draw
|
|
1646
|
-
this.initialiseDrawing()
|
|
1647
|
-
}
|
|
1492
|
+
if (this.drawnCreatedEvent) this.connectionDisplay = true
|
|
1493
|
+
else this.initialiseDrawing() // Reset if invalid linestring or polygon
|
|
1648
1494
|
} else if (data.feature.mode === 'direct_select') {
|
|
1649
1495
|
this.doubleClickedFeature = true
|
|
1650
1496
|
}
|
|
1651
1497
|
} else if (data.type === 'selectionChanged') {
|
|
1652
|
-
this.
|
|
1653
|
-
data.feature.features.length === 0 ?
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
payload.feature.feature = this.currentDrawnFeature
|
|
1657
|
-
if (!this.inDrawing) {
|
|
1498
|
+
this.selectedDrawnFeature =
|
|
1499
|
+
data.feature.features.length === 0 ? undefined : data.feature.features[0]
|
|
1500
|
+
payload.feature.feature = this.selectedDrawnFeature
|
|
1501
|
+
if (!this.inDrawing) { // Make sure dialog content doesn't change
|
|
1658
1502
|
this.initialiseDialog()
|
|
1659
1503
|
// For exist drawn annotation features
|
|
1660
|
-
if (this.
|
|
1661
|
-
let feature = this.
|
|
1662
|
-
.filter((feature) => feature.id === this.
|
|
1663
|
-
if (feature && feature.connection)
|
|
1664
|
-
this.connectionEntry = feature.connection
|
|
1665
|
-
}
|
|
1504
|
+
if (this.selectedDrawnFeature) {
|
|
1505
|
+
let feature = this.allDrawnFeatures
|
|
1506
|
+
.filter((feature) => feature.id === this.selectedDrawnFeature.id)[0]
|
|
1507
|
+
if (feature && feature.connection) this.connectionEntry = feature.connection
|
|
1666
1508
|
this.drawModeEvent(payload)
|
|
1667
1509
|
}
|
|
1668
1510
|
}
|
|
@@ -1678,11 +1520,8 @@ export default {
|
|
|
1678
1520
|
}
|
|
1679
1521
|
// Once double click mouse to confirm drawing, 'aborted' event will be triggered.
|
|
1680
1522
|
// Hence disable direct popup when 'created' event, dialog will be used instead.
|
|
1681
|
-
if (data.type === 'created')
|
|
1682
|
-
|
|
1683
|
-
} else {
|
|
1684
|
-
this.checkAndCreatePopups(payload)
|
|
1685
|
-
}
|
|
1523
|
+
if (data.type === 'created') this.drawnCreatedEvent = payload
|
|
1524
|
+
else this.checkAndCreatePopups(payload)
|
|
1686
1525
|
}
|
|
1687
1526
|
},
|
|
1688
1527
|
/**
|
|
@@ -1736,13 +1575,17 @@ export default {
|
|
|
1736
1575
|
if (this.inDrawing && !this.connectionDisplay) {
|
|
1737
1576
|
// Only clicked connection data will be added
|
|
1738
1577
|
let nodeLabel = data.label ? data.label : `Feature ${data.id}`
|
|
1578
|
+
const validDrawnFeature = data.featureId ||
|
|
1579
|
+
this.allDrawnFeatures.find((feature) => feature.id === data.id)
|
|
1739
1580
|
// only the linestring will have connection at the current stage
|
|
1740
|
-
if (this.activeDrawTool === 'LineString') {
|
|
1741
|
-
|
|
1581
|
+
if (this.activeDrawTool === 'LineString' && validDrawnFeature) {
|
|
1582
|
+
const key = data.featureId ? data.featureId : data.id
|
|
1583
|
+
// add space before key to make sure properties follows adding order
|
|
1584
|
+
this.connectionEntry[` ${key}`] = Object.assign({ label: nodeLabel },
|
|
1742
1585
|
Object.fromEntries(
|
|
1743
1586
|
Object.entries(data)
|
|
1744
|
-
|
|
1745
|
-
|
|
1587
|
+
.filter(([key]) => ['featureId', 'models'].includes(key))
|
|
1588
|
+
.map(([key, value]) => [(key === 'featureId') ? 'id' : key, value])))
|
|
1746
1589
|
}
|
|
1747
1590
|
}
|
|
1748
1591
|
}
|
|
@@ -1769,65 +1612,6 @@ export default {
|
|
|
1769
1612
|
}
|
|
1770
1613
|
}
|
|
1771
1614
|
},
|
|
1772
|
-
/**
|
|
1773
|
-
* A hack to implement connection dialog drag action and scope.
|
|
1774
|
-
*/
|
|
1775
|
-
dialogCssHacks: function () {
|
|
1776
|
-
this.$nextTick(() => {
|
|
1777
|
-
const dialog = this.$el.querySelector('.connection-dialog')
|
|
1778
|
-
draggable(this.$el, dialog)
|
|
1779
|
-
// dialog popup at the click position
|
|
1780
|
-
// slightly change x or y if close to boundary
|
|
1781
|
-
let posX, posY
|
|
1782
|
-
const containerRect = this.$el.getBoundingClientRect()
|
|
1783
|
-
const dialogRect = dialog.getBoundingClientRect()
|
|
1784
|
-
if (this.dialogPosition.x > containerRect.width / 2) {
|
|
1785
|
-
posX = this.dialogPosition.x - dialogRect.width
|
|
1786
|
-
} else {
|
|
1787
|
-
posX = this.dialogPosition.x
|
|
1788
|
-
}
|
|
1789
|
-
if (this.dialogPosition.y > containerRect.height / 2) {
|
|
1790
|
-
posY = this.dialogPosition.y - dialogRect.height
|
|
1791
|
-
} else {
|
|
1792
|
-
posY = this.dialogPosition.y
|
|
1793
|
-
}
|
|
1794
|
-
dialog.style.transform =
|
|
1795
|
-
`translate(${posX - this.dialogPosition.offsetX}px, ${posY - this.dialogPosition.offsetY}px)`
|
|
1796
|
-
})
|
|
1797
|
-
},
|
|
1798
|
-
/**
|
|
1799
|
-
* A hack to handle the status of annotation tools.
|
|
1800
|
-
*/
|
|
1801
|
-
drawIconCssHacks: function () {
|
|
1802
|
-
// set tool/mode icon status
|
|
1803
|
-
if (this.$el.querySelector('.iconSelected') || !this.connectionDisplay) {
|
|
1804
|
-
this.drawnTypes.map((t) => {
|
|
1805
|
-
const dtype = this.$el.querySelector(`.draw${t}`)
|
|
1806
|
-
if (dtype) {
|
|
1807
|
-
dtype.classList.remove('iconSelected');
|
|
1808
|
-
dtype.classList.remove('inactive');
|
|
1809
|
-
}
|
|
1810
|
-
})
|
|
1811
|
-
this.drawModes.map((m) => {
|
|
1812
|
-
this.$el.querySelector(`.draw${m}`).classList.remove('iconSelected');
|
|
1813
|
-
this.$el.querySelector(`.draw${m}`).classList.remove('inactive');
|
|
1814
|
-
})
|
|
1815
|
-
}
|
|
1816
|
-
if (this.activeDrawTool) {
|
|
1817
|
-
this.$el.querySelector(`.draw${this.activeDrawTool}`).classList.add('iconSelected');
|
|
1818
|
-
this.drawModes.map((m) => {
|
|
1819
|
-
this.$el.querySelector(`.draw${m}`).classList.add('inactive');
|
|
1820
|
-
})
|
|
1821
|
-
} else if (this.activeDrawMode || this.connectionDisplay) {
|
|
1822
|
-
if (this.activeDrawMode) {
|
|
1823
|
-
this.$el.querySelector(`.draw${this.activeDrawMode}`).classList.add('iconSelected');
|
|
1824
|
-
}
|
|
1825
|
-
this.drawnTypes.map((t) => {
|
|
1826
|
-
const dtype = this.$el.querySelector(`.draw${t}`)
|
|
1827
|
-
if (dtype) dtype.classList.add('inactive');
|
|
1828
|
-
})
|
|
1829
|
-
}
|
|
1830
|
-
},
|
|
1831
1615
|
/**
|
|
1832
1616
|
* @vuese
|
|
1833
1617
|
* Function to fire annotation event based on the provided ``data``.
|
|
@@ -1836,25 +1620,23 @@ export default {
|
|
|
1836
1620
|
*/
|
|
1837
1621
|
drawModeEvent: function (data) {
|
|
1838
1622
|
if (this.activeDrawMode) {
|
|
1839
|
-
// double click fires 'updated' callback
|
|
1840
|
-
if (this.doubleClickedFeature) {
|
|
1623
|
+
if (this.doubleClickedFeature) { // double click fires 'updated' callback
|
|
1841
1624
|
if (data.feature.feature.geometry.type !== 'Point') {
|
|
1842
1625
|
// show tooltip and enter edit mode
|
|
1843
1626
|
this.changeAnnotationDrawMode({
|
|
1844
1627
|
mode: 'direct_select',
|
|
1845
1628
|
options: { featureId: data.feature.feature.id }
|
|
1846
1629
|
})
|
|
1847
|
-
this.
|
|
1630
|
+
this.modifyAnnotationFeature()
|
|
1848
1631
|
}
|
|
1849
1632
|
this.doubleClickedFeature = false
|
|
1850
|
-
} else {
|
|
1851
|
-
// single click fires delete
|
|
1633
|
+
} else { // single click fires delete
|
|
1852
1634
|
if (this.activeDrawMode === 'Delete') {
|
|
1853
1635
|
this.changeAnnotationDrawMode({
|
|
1854
1636
|
mode: 'simple_select',
|
|
1855
1637
|
options: { featureIds: [data.feature.feature.id] }
|
|
1856
1638
|
})
|
|
1857
|
-
this.
|
|
1639
|
+
this.modifyAnnotationFeature()
|
|
1858
1640
|
}
|
|
1859
1641
|
}
|
|
1860
1642
|
}
|
|
@@ -1901,24 +1683,22 @@ export default {
|
|
|
1901
1683
|
if (data.feature.featureId && data.feature.models) {
|
|
1902
1684
|
this.displayTooltip(data.feature.models)
|
|
1903
1685
|
} else if (data.feature.feature) {
|
|
1904
|
-
if (this.inDrawing || this.activeDrawMode) {
|
|
1905
|
-
this.
|
|
1686
|
+
if (this.inDrawing || this.activeDrawMode || this.connectionDisplay) {
|
|
1687
|
+
this.featureAnnotationSubmitted = false
|
|
1906
1688
|
this.annotationEntry.featureId = data.feature.feature.id
|
|
1907
|
-
this.createConnectivityBody()
|
|
1689
|
+
if (this.inDrawing) this.createConnectivityBody()
|
|
1908
1690
|
this.displayTooltip(
|
|
1909
1691
|
data.feature.feature.id,
|
|
1910
1692
|
centroid(data.feature.feature.geometry)
|
|
1911
1693
|
)
|
|
1694
|
+
// Hide dialog when updated or deleted event is fired and tooltip is displayed
|
|
1695
|
+
if (this.activeDrawMode) this.initialiseDialog()
|
|
1912
1696
|
} else {
|
|
1913
1697
|
// Not allowed to update feature if not on edit mode
|
|
1914
1698
|
if (data.feature.type === 'updated') {
|
|
1915
1699
|
this.rollbackAnnotationEvent()
|
|
1916
1700
|
}
|
|
1917
1701
|
}
|
|
1918
|
-
// Hide dialog when updated or deleted event is fired and tooltip is displayed
|
|
1919
|
-
if (data.feature.type === 'updated' || data.feature.type === 'deleted') {
|
|
1920
|
-
this.initialiseDialog()
|
|
1921
|
-
}
|
|
1922
1702
|
}
|
|
1923
1703
|
} else {
|
|
1924
1704
|
this.annotation = {}
|
|
@@ -1953,14 +1733,6 @@ export default {
|
|
|
1953
1733
|
if (ftooltip) ftooltip.style.display = 'block'
|
|
1954
1734
|
}
|
|
1955
1735
|
},
|
|
1956
|
-
/**
|
|
1957
|
-
* @vuese
|
|
1958
|
-
* Function to close popup.
|
|
1959
|
-
*/
|
|
1960
|
-
closePopup: function () {
|
|
1961
|
-
let cbutton = document.querySelector('.maplibregl-popup-close-button')
|
|
1962
|
-
if (cbutton) cbutton.click()
|
|
1963
|
-
},
|
|
1964
1736
|
/**
|
|
1965
1737
|
* @vuese
|
|
1966
1738
|
* Function to close tooltip.
|
|
@@ -2054,11 +1826,16 @@ export default {
|
|
|
2054
1826
|
*/
|
|
2055
1827
|
setHelpMode: function (helpMode) {
|
|
2056
1828
|
if (helpMode) {
|
|
2057
|
-
|
|
2058
|
-
this.
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
1829
|
+
// because some tooltips are inside drawer
|
|
1830
|
+
this.drawerOpen = true;
|
|
1831
|
+
// wait for CSS transition
|
|
1832
|
+
setTimeout(() => {
|
|
1833
|
+
this.inHelp = true;
|
|
1834
|
+
this.hoverVisibilities.forEach((item) => {
|
|
1835
|
+
item.value = true;
|
|
1836
|
+
});
|
|
1837
|
+
this.openFlatmapHelpPopup();
|
|
1838
|
+
}, 300);
|
|
2062
1839
|
} else {
|
|
2063
1840
|
this.inHelp = false
|
|
2064
1841
|
this.hoverVisibilities.forEach((item) => {
|
|
@@ -2663,12 +2440,6 @@ export default {
|
|
|
2663
2440
|
{ value: false },
|
|
2664
2441
|
{ value: false },
|
|
2665
2442
|
{ value: false },
|
|
2666
|
-
{ value: false },
|
|
2667
|
-
{ value: false },
|
|
2668
|
-
{ value: false },
|
|
2669
|
-
{ value: false },
|
|
2670
|
-
{ value: false },
|
|
2671
|
-
{ value: false },
|
|
2672
2443
|
],
|
|
2673
2444
|
yellowstar: yellowstar,
|
|
2674
2445
|
isFC: false,
|
|
@@ -2688,7 +2459,7 @@ export default {
|
|
|
2688
2459
|
minimapResizeShow: false,
|
|
2689
2460
|
minimapSmall: false,
|
|
2690
2461
|
currentActive: '',
|
|
2691
|
-
|
|
2462
|
+
selectedDrawnFeature: undefined, // Clicked drawn annotation
|
|
2692
2463
|
currentHover: '',
|
|
2693
2464
|
viewingMode: 'Exploration',
|
|
2694
2465
|
viewingModes: ['Annotation', 'Exploration', 'Network Discovery'],
|
|
@@ -2702,21 +2473,15 @@ export default {
|
|
|
2702
2473
|
userInformation: undefined,
|
|
2703
2474
|
activeDrawTool: undefined,
|
|
2704
2475
|
drawnAnnotationEvent: ['created', 'updated', 'deleted'],
|
|
2705
|
-
|
|
2706
|
-
|
|
2476
|
+
drawnCreatedEvent: undefined,
|
|
2477
|
+
featureAnnotationSubmitted: false,
|
|
2707
2478
|
inDrawing: false,
|
|
2708
2479
|
connectionDisplay: false,
|
|
2709
2480
|
connectionEntry: {},
|
|
2710
|
-
|
|
2481
|
+
allDrawnFeatures: undefined, // Store all exist drawn features
|
|
2711
2482
|
doubleClickedFeature: false,
|
|
2712
2483
|
activeDrawMode: undefined,
|
|
2713
2484
|
drawModes: ['Delete', 'Edit'],
|
|
2714
|
-
dialogPosition: {
|
|
2715
|
-
offsetX: 0,
|
|
2716
|
-
offsetY: 0,
|
|
2717
|
-
x: undefined,
|
|
2718
|
-
y: undefined
|
|
2719
|
-
},
|
|
2720
2485
|
containsAlert: false,
|
|
2721
2486
|
alertOptions: [
|
|
2722
2487
|
{
|
|
@@ -2739,7 +2504,7 @@ export default {
|
|
|
2739
2504
|
},
|
|
2740
2505
|
helpMode: function (newVal, oldVal) {
|
|
2741
2506
|
if (newVal !== oldVal) {
|
|
2742
|
-
this.setHelpMode(
|
|
2507
|
+
this.setHelpMode(newVal)
|
|
2743
2508
|
}
|
|
2744
2509
|
},
|
|
2745
2510
|
state: {
|
|
@@ -2756,67 +2521,15 @@ export default {
|
|
|
2756
2521
|
immediate: true,
|
|
2757
2522
|
deep: true,
|
|
2758
2523
|
},
|
|
2759
|
-
activeDrawTool: function () {
|
|
2760
|
-
this.drawIconCssHacks()
|
|
2761
|
-
},
|
|
2762
|
-
activeDrawMode: function () {
|
|
2763
|
-
this.drawIconCssHacks()
|
|
2764
|
-
},
|
|
2765
|
-
/**
|
|
2766
|
-
* hide dialog when connectionEntry is empty
|
|
2767
|
-
*/
|
|
2768
|
-
connection: function (value) {
|
|
2769
|
-
const connectionIcon = this.$el.querySelector('.drawConnection')
|
|
2770
|
-
if (!value) {
|
|
2771
|
-
this.connectionDisplay = false
|
|
2772
|
-
connectionIcon.classList.add('inactive')
|
|
2773
|
-
} else {
|
|
2774
|
-
connectionIcon.classList.remove('inactive')
|
|
2775
|
-
}
|
|
2776
|
-
},
|
|
2777
|
-
/**
|
|
2778
|
-
* popup dialog via click icon
|
|
2779
|
-
*/
|
|
2780
|
-
connectionDisplay: function (display) {
|
|
2781
|
-
const connectionIcon = this.$el.querySelector('.drawConnection')
|
|
2782
|
-
if (display) {
|
|
2783
|
-
connectionIcon.classList.add('iconSelected')
|
|
2784
|
-
this.dialogCssHacks()
|
|
2785
|
-
} else {
|
|
2786
|
-
connectionIcon.classList.remove('iconSelected')
|
|
2787
|
-
}
|
|
2788
|
-
this.drawIconCssHacks()
|
|
2789
|
-
},
|
|
2790
|
-
/**
|
|
2791
|
-
* Set dialog offset when flatmap annotator used
|
|
2792
|
-
*/
|
|
2793
|
-
dialogPosition: {
|
|
2794
|
-
handler: function () {
|
|
2795
|
-
const containerRect = this.$el.getBoundingClientRect()
|
|
2796
|
-
this.dialogPosition.offsetX = containerRect.x
|
|
2797
|
-
this.dialogPosition.offsetY = containerRect.y
|
|
2798
|
-
},
|
|
2799
|
-
deep: true,
|
|
2800
|
-
once: true,
|
|
2801
|
-
},
|
|
2802
2524
|
viewingMode: function (mode) {
|
|
2803
2525
|
if (mode === 'Annotation') {
|
|
2804
|
-
this.$el.querySelector('.maplibregl-canvas').addEventListener('click', (e) => {
|
|
2805
|
-
e.preventDefault();
|
|
2806
|
-
this.dialogPosition.x = e.clientX
|
|
2807
|
-
this.dialogPosition.y = e.clientY
|
|
2808
|
-
// use to fix the draw point pop up position issue
|
|
2809
|
-
if (this.activeDrawTool === 'Point') {
|
|
2810
|
-
this.dialogCssHacks()
|
|
2811
|
-
}
|
|
2812
|
-
}, false)
|
|
2813
2526
|
this.loading = true
|
|
2814
2527
|
this.annotator.authenticate(this.userToken).then((userData) => {
|
|
2815
2528
|
if (userData.name && userData.email) {
|
|
2816
2529
|
this.showAnnotator(true)
|
|
2817
2530
|
this.userInformation = userData
|
|
2818
2531
|
this.setFeatureAnnotated()
|
|
2819
|
-
if (!this.
|
|
2532
|
+
if (!this.allDrawnFeatures) {
|
|
2820
2533
|
this.addAnnotationFeature()
|
|
2821
2534
|
}
|
|
2822
2535
|
}
|
|
@@ -2860,6 +2573,14 @@ export default {
|
|
|
2860
2573
|
font-size: 25px;
|
|
2861
2574
|
}
|
|
2862
2575
|
|
|
2576
|
+
.warning-icon,
|
|
2577
|
+
.latest-changesicon {
|
|
2578
|
+
display: flex;
|
|
2579
|
+
width: max-content;
|
|
2580
|
+
align-items: center;
|
|
2581
|
+
gap: 5px;
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2863
2584
|
.warning-icon {
|
|
2864
2585
|
color: $warning;
|
|
2865
2586
|
|
|
@@ -2884,6 +2605,7 @@ export default {
|
|
|
2884
2605
|
}
|
|
2885
2606
|
|
|
2886
2607
|
.latest-changesicon {
|
|
2608
|
+
margin-top: 5px;
|
|
2887
2609
|
color: $success;
|
|
2888
2610
|
|
|
2889
2611
|
&:hover {
|
|
@@ -2905,8 +2627,7 @@ export default {
|
|
|
2905
2627
|
.pathway-location {
|
|
2906
2628
|
position: absolute;
|
|
2907
2629
|
bottom: 0px;
|
|
2908
|
-
transition: all
|
|
2909
|
-
z-index: 8;
|
|
2630
|
+
transition: all var(--el-transition-duration);
|
|
2910
2631
|
&.open {
|
|
2911
2632
|
left: 0px;
|
|
2912
2633
|
}
|
|
@@ -2933,8 +2654,7 @@ export default {
|
|
|
2933
2654
|
background: #ffffff;
|
|
2934
2655
|
overflow-x: hidden;
|
|
2935
2656
|
scrollbar-width: thin;
|
|
2936
|
-
|
|
2937
|
-
transition: all 1s ease;
|
|
2657
|
+
transition: all var(--el-transition-duration);
|
|
2938
2658
|
&.open {
|
|
2939
2659
|
opacity: 1;
|
|
2940
2660
|
position: relative;
|
|
@@ -2955,11 +2675,15 @@ export default {
|
|
|
2955
2675
|
}
|
|
2956
2676
|
|
|
2957
2677
|
.flatmap-marker-help {
|
|
2958
|
-
display:
|
|
2959
|
-
|
|
2678
|
+
display: block;
|
|
2679
|
+
width: max-content;
|
|
2680
|
+
margin: 0.5rem;
|
|
2960
2681
|
|
|
2961
|
-
:deep(.
|
|
2962
|
-
|
|
2682
|
+
:deep(.flatmap-marker svg) {
|
|
2683
|
+
display: block;
|
|
2684
|
+
width: 28px;
|
|
2685
|
+
height: 28px;
|
|
2686
|
+
}
|
|
2963
2687
|
}
|
|
2964
2688
|
|
|
2965
2689
|
.el-dropdown-link {
|
|
@@ -3154,31 +2878,24 @@ export default {
|
|
|
3154
2878
|
}
|
|
3155
2879
|
}
|
|
3156
2880
|
|
|
3157
|
-
.drawPoint, .drawLineString, .drawPolygon,
|
|
3158
|
-
.drawDelete, .drawEdit, .drawConnection,
|
|
3159
2881
|
.zoomIn, .zoomOut, .fitWindow {
|
|
3160
2882
|
padding: 4px;
|
|
3161
2883
|
}
|
|
3162
2884
|
|
|
3163
|
-
.iconSelected {
|
|
3164
|
-
color: var(--el-color-primary-light-5) !important;
|
|
3165
|
-
}
|
|
3166
|
-
|
|
3167
|
-
.inactive {
|
|
3168
|
-
color: #DDDDDD !important;
|
|
3169
|
-
cursor: not-allowed !important;
|
|
3170
|
-
}
|
|
3171
|
-
|
|
3172
2885
|
.yellow-star-legend {
|
|
3173
|
-
|
|
3174
|
-
|
|
2886
|
+
display: block;
|
|
2887
|
+
width: max-content;
|
|
2888
|
+
cursor: default;
|
|
2889
|
+
|
|
2890
|
+
:deep(svg) {
|
|
2891
|
+
display: block;
|
|
2892
|
+
}
|
|
3175
2893
|
}
|
|
3176
2894
|
|
|
3177
2895
|
.settings-group {
|
|
3178
2896
|
bottom: 16px;
|
|
3179
2897
|
position: absolute;
|
|
3180
|
-
transition: all
|
|
3181
|
-
z-index: 10;
|
|
2898
|
+
transition: all var(--el-transition-duration);
|
|
3182
2899
|
&.open {
|
|
3183
2900
|
left: 322px;
|
|
3184
2901
|
}
|
|
@@ -3298,7 +3015,7 @@ export default {
|
|
|
3298
3015
|
width: 300px !important;
|
|
3299
3016
|
}
|
|
3300
3017
|
}
|
|
3301
|
-
transition: all
|
|
3018
|
+
transition: all var(--el-transition-duration);
|
|
3302
3019
|
&.shrink {
|
|
3303
3020
|
transform: scale(0.5);
|
|
3304
3021
|
transform: scale(0.5);
|
|
@@ -3315,7 +3032,7 @@ export default {
|
|
|
3315
3032
|
width: 20px;
|
|
3316
3033
|
height: 14px;
|
|
3317
3034
|
z-index: 9;
|
|
3318
|
-
transition: all
|
|
3035
|
+
transition: all var(--el-transition-duration);
|
|
3319
3036
|
&.shrink {
|
|
3320
3037
|
transform: rotate(0deg);
|
|
3321
3038
|
}
|
|
@@ -3379,18 +3096,6 @@ export default {
|
|
|
3379
3096
|
padding: 0px;
|
|
3380
3097
|
}
|
|
3381
3098
|
|
|
3382
|
-
.bottom-draw-control {
|
|
3383
|
-
background-color: var(--el-color-primary-light-9);
|
|
3384
|
-
padding: 4px 4px 2px 4px;
|
|
3385
|
-
border-style: solid;
|
|
3386
|
-
border-color: var(--el-color-primary-light-5);
|
|
3387
|
-
border-radius: 1rem;
|
|
3388
|
-
position: absolute;
|
|
3389
|
-
right: calc(50vw - 100px);;
|
|
3390
|
-
bottom: 16px;
|
|
3391
|
-
z-index: 10;
|
|
3392
|
-
}
|
|
3393
|
-
|
|
3394
3099
|
.bottom-right-control {
|
|
3395
3100
|
position: absolute;
|
|
3396
3101
|
right: 16px;
|
|
@@ -3437,7 +3142,6 @@ export default {
|
|
|
3437
3142
|
font-weight: 600;
|
|
3438
3143
|
margin-top: 12px;
|
|
3439
3144
|
color: $app-primary-color;
|
|
3440
|
-
transition-delay: 0.9s;
|
|
3441
3145
|
}
|
|
3442
3146
|
&.open {
|
|
3443
3147
|
i {
|
|
@@ -3581,12 +3285,6 @@ export default {
|
|
|
3581
3285
|
}
|
|
3582
3286
|
}
|
|
3583
3287
|
}
|
|
3584
|
-
|
|
3585
|
-
.connection-dialog {
|
|
3586
|
-
position: absolute;
|
|
3587
|
-
z-index: 10;
|
|
3588
|
-
cursor: move;
|
|
3589
|
-
}
|
|
3590
3288
|
</style>
|
|
3591
3289
|
|
|
3592
3290
|
<style lang="scss">
|
|
@@ -3598,4 +3296,24 @@ export default {
|
|
|
3598
3296
|
--el-color-primary-dark-2: var(--el-color-primary);
|
|
3599
3297
|
}
|
|
3600
3298
|
|
|
3601
|
-
|
|
3299
|
+
.flatmap-teleport-popper {
|
|
3300
|
+
&.flatmap-popper.el-popper {
|
|
3301
|
+
padding: 6px 4px;
|
|
3302
|
+
font-family: Asap, sans-serif;
|
|
3303
|
+
font-size: 12px;
|
|
3304
|
+
color: rgb(48, 49, 51);
|
|
3305
|
+
background-color: #f3ecf6;
|
|
3306
|
+
border: 1px solid $app-primary-color;
|
|
3307
|
+
white-space: nowrap;
|
|
3308
|
+
min-width: unset;
|
|
3309
|
+
|
|
3310
|
+
.el-popper__arrow {
|
|
3311
|
+
&:before {
|
|
3312
|
+
border-color: $app-primary-color;
|
|
3313
|
+
background-color: #f3ecf6;
|
|
3314
|
+
}
|
|
3315
|
+
}
|
|
3316
|
+
}
|
|
3317
|
+
}
|
|
3318
|
+
|
|
3319
|
+
</style>
|