@abi-software/scaffoldvuer 1.8.1-beta.3 → 1.8.1-beta.4
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/scaffoldvuer.js +5848 -5825
- package/dist/scaffoldvuer.umd.cjs +29 -32
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/ScaffoldVuer.vue +20 -13
- package/src/scripts/Utilities.js +16 -3
package/package.json
CHANGED
|
@@ -405,7 +405,8 @@ import {
|
|
|
405
405
|
createNewAnnotationsWithFeatures,
|
|
406
406
|
addUserAnnotationWithFeature,
|
|
407
407
|
annotationFeaturesToPrimitives,
|
|
408
|
-
|
|
408
|
+
getClickedObjects,
|
|
409
|
+
getDeletableObjects,
|
|
409
410
|
getDrawnAnnotations,
|
|
410
411
|
getEditableLines,
|
|
411
412
|
getObjectsFromAnnotations,
|
|
@@ -1210,10 +1211,12 @@ export default {
|
|
|
1210
1211
|
* This is only called from callback.
|
|
1211
1212
|
*/
|
|
1212
1213
|
confirmComment: function (payload) {
|
|
1213
|
-
if (this._editingZincObject
|
|
1214
|
+
if (this._editingZincObject) {
|
|
1214
1215
|
let annotation = payload
|
|
1215
|
-
|
|
1216
|
-
|
|
1216
|
+
if (this._editingZincObject.isEditable) {
|
|
1217
|
+
this.existDrawnFeatures = markRaw(this.existDrawnFeatures.filter(feature => feature.id !== annotation.item.id));
|
|
1218
|
+
this.existDrawnFeatures.push(payload.feature);
|
|
1219
|
+
}
|
|
1217
1220
|
if (this.offlineAnnotationEnabled) {
|
|
1218
1221
|
annotation.group = this._editingZincObject.groupName;;
|
|
1219
1222
|
annotation.region = this._editingZincObject.region.getFullPath();
|
|
@@ -1513,14 +1516,6 @@ export default {
|
|
|
1513
1516
|
}
|
|
1514
1517
|
}
|
|
1515
1518
|
} else {
|
|
1516
|
-
const zincObject = getEditableObjects(event);
|
|
1517
|
-
this._editingZincObject = zincObject;
|
|
1518
|
-
if (zincObject) {
|
|
1519
|
-
const regionPath = this._editingZincObject.region.getFullPath() + "/";
|
|
1520
|
-
const group = this._editingZincObject.groupName;
|
|
1521
|
-
this.annotationFeature = createNewAnnotationsWithFeatures(this._editingZincObject,
|
|
1522
|
-
regionPath, group, this.url, '').feature;
|
|
1523
|
-
}
|
|
1524
1519
|
//Make sure the tooltip is displayed with annotaion mode
|
|
1525
1520
|
if (this.activeDrawMode === "Edit") {
|
|
1526
1521
|
const editing = getEditableLines(event);
|
|
@@ -1529,8 +1524,10 @@ export default {
|
|
|
1529
1524
|
editing.vertexIndex, editing.point);
|
|
1530
1525
|
}
|
|
1531
1526
|
} else if (this.activeDrawMode === "Delete") {
|
|
1527
|
+
const zincObject = getDeletableObjects(event);
|
|
1532
1528
|
if (zincObject) {
|
|
1533
1529
|
this.createData.toBeDeleted = true;
|
|
1530
|
+
this._editingZincObject = zincObject;
|
|
1534
1531
|
}
|
|
1535
1532
|
}
|
|
1536
1533
|
if (this.activeDrawMode !== "Point" && this.activeDrawMode !== "LineString") {
|
|
@@ -1588,6 +1585,14 @@ export default {
|
|
|
1588
1585
|
if (this.viewingMode === 'Annotation') {
|
|
1589
1586
|
this.tData.label = id;
|
|
1590
1587
|
this.tData.region = regionPath;
|
|
1588
|
+
const zincObject = getClickedObjects(event);
|
|
1589
|
+
this._editingZincObject = zincObject;
|
|
1590
|
+
if (zincObject) {
|
|
1591
|
+
const regionPath = this._editingZincObject.region.getFullPath() + "/";
|
|
1592
|
+
const group = this._editingZincObject.groupName;
|
|
1593
|
+
this.annotationFeature = createNewAnnotationsWithFeatures(this._editingZincObject,
|
|
1594
|
+
regionPath, group, this.url, '').feature;
|
|
1595
|
+
}
|
|
1591
1596
|
this.activateAnnotationMode(names, event);
|
|
1592
1597
|
} else {
|
|
1593
1598
|
if (this.$refs.scaffoldTreeControls) {
|
|
@@ -2019,7 +2024,9 @@ export default {
|
|
|
2019
2024
|
let drawnFeatures;
|
|
2020
2025
|
if (this.offlineAnnotationEnabled) {
|
|
2021
2026
|
this.offlineAnnotations = JSON.parse(sessionStorage.getItem('offline-annotation')) || [];
|
|
2022
|
-
drawnFeatures = this.offlineAnnotations.filter((offline) =>
|
|
2027
|
+
drawnFeatures = this.offlineAnnotations.filter((offline) => {
|
|
2028
|
+
return offline.resource === this.url && offline.feature.properties.drawn;
|
|
2029
|
+
}).map(offline => offline.feature);
|
|
2023
2030
|
} else {
|
|
2024
2031
|
drawnFeatures = [];
|
|
2025
2032
|
const drawn = await getDrawnAnnotations(this.annotator, this.userToken, this.url);
|
package/src/scripts/Utilities.js
CHANGED
|
@@ -47,7 +47,16 @@ export const getEditableLines = (event) => {
|
|
|
47
47
|
return undefined;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
export const
|
|
50
|
+
export const getClickedObjects = (event) => {
|
|
51
|
+
const zincObjects = event.zincObjects;
|
|
52
|
+
if (zincObjects.length > 0 && zincObjects[0]) {
|
|
53
|
+
const zincObject = zincObjects[0];
|
|
54
|
+
return zincObject;
|
|
55
|
+
}
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const getDeletableObjects = (event) => {
|
|
51
60
|
const zincObjects = event.zincObjects;
|
|
52
61
|
if (zincObjects.length > 0 && zincObjects[0]) {
|
|
53
62
|
const zincObject = zincObjects[0];
|
|
@@ -295,7 +304,11 @@ export const createNewAnnotationsWithFeatures = (zincObject, region, group, scaf
|
|
|
295
304
|
type = "MultiPoint";
|
|
296
305
|
} else if (zincObject.isLines2) {
|
|
297
306
|
type = "MultiLineString";
|
|
307
|
+
} else {
|
|
308
|
+
type = "Feature";
|
|
298
309
|
}
|
|
310
|
+
const drawn = type === "Feature" ? false : true;
|
|
311
|
+
const label = type === "Feature" ? "Feature annotation" : "Drawn annotation";
|
|
299
312
|
if (type) {
|
|
300
313
|
const coords = getCoordinatesForAnnotationFeature(zincObject);
|
|
301
314
|
//Check if region ends with a slash
|
|
@@ -314,8 +327,8 @@ export const createNewAnnotationsWithFeatures = (zincObject, region, group, scaf
|
|
|
314
327
|
feature: {
|
|
315
328
|
"id": featureID,
|
|
316
329
|
"properties": {
|
|
317
|
-
"drawn":
|
|
318
|
-
"label":
|
|
330
|
+
"drawn": drawn,
|
|
331
|
+
"label": label
|
|
319
332
|
},
|
|
320
333
|
"geometry": {
|
|
321
334
|
"coordinates": coords,
|