@abi-software/scaffoldvuer 1.14.0 → 1.14.1

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/scaffoldvuer",
3
- "version": "1.14.0",
3
+ "version": "1.14.1",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -41,7 +41,7 @@
41
41
  "*.js"
42
42
  ],
43
43
  "dependencies": {
44
- "@abi-software/map-utilities": "1.8.0",
44
+ "@abi-software/map-utilities": "1.8.1",
45
45
  "@abi-software/sparc-annotation": "^0.3.2",
46
46
  "@abi-software/svg-sprite": "1.0.3",
47
47
  "@element-plus/icons-vue": "^2.3.1",
@@ -53,7 +53,7 @@
53
53
  "unplugin-vue-components": "^0.26.0",
54
54
  "vue": "^3.4.21",
55
55
  "vue-router": "^4.2.5",
56
- "zincjs": "^1.16.10"
56
+ "zincjs": "^1.17.0"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@babel/eslint-parser": "^7.28.0",
@@ -67,13 +67,20 @@ export default {
67
67
  props: {
68
68
  createData: {
69
69
  type: Object,
70
- default: {
70
+ default:{
71
+ drawingBox: false,
72
+ renaming: false,
71
73
  toBeConfirmed: false,
72
74
  points: [],
75
+ tempGroupName: undefined,
73
76
  shape: "",
74
77
  x: 0,
75
78
  y: 0,
76
- }
79
+ editingIndex: -1,
80
+ faceIndex: -1,
81
+ toBeDeleted: false,
82
+ regionPrefix: "__annotation"
83
+ },
77
84
  },
78
85
  label: {
79
86
  type: String,
@@ -22,7 +22,6 @@
22
22
  @confirm-create="confirmCreate($event)"
23
23
  @cancel-create="cancelCreate()"
24
24
  @confirm-comment="confirmComment($event)"
25
- @confirm-delete="confirmDelete()"
26
25
  @tooltip-hide="onTooltipHide()"
27
26
  @create-group-suggestions="$emit('create-group-suggestions', $event)"
28
27
  @create-region-suggestions="$emit('create-region-suggestions', $event)"
@@ -1348,9 +1347,9 @@ export default {
1348
1347
  this.offlineAnnotations = JSON.parse(sessionStorage.getItem('anonymous-annotation')) || [];
1349
1348
  const found = this.offlineAnnotations.find((element) => {
1350
1349
  return element.group === annotation.group &&
1351
- element.region === annotation.region &&
1352
- element.resource === annotation.resource &&
1353
- element.feature.geometry.type === annotation.feature.geometry.type;
1350
+ element.region === annotation.region &&
1351
+ element.resource === annotation.resource &&
1352
+ element.feature.geometry.type === annotation.feature.geometry.type;
1354
1353
  });
1355
1354
  if (found) {
1356
1355
  Object.assign(found, annotation);
@@ -1392,7 +1391,6 @@ export default {
1392
1391
  element.feature.geometry.type === annotation.feature.geometry.type;
1393
1392
  });
1394
1393
  if (found) {
1395
- //console.log('found', found)
1396
1394
  Object.assign(found, annotation);
1397
1395
  }
1398
1396
  sessionStorage.setItem('anonymous-annotation', JSON.stringify(this.offlineAnnotations));
@@ -1435,6 +1433,8 @@ export default {
1435
1433
  [this.createData.points[0], this.createData.points[1]],
1436
1434
  0x00ee22,
1437
1435
  );
1436
+ } else if (payload.deleting) {
1437
+ this.confirmDelete(payload);
1438
1438
  } else if (payload.editingIndex > -1) {
1439
1439
  if (this._editingZincObject) {
1440
1440
  let editedPoint = undefined;
@@ -1457,9 +1457,6 @@ export default {
1457
1457
  this.renameAnnotations(payload.region, payload.group,
1458
1458
  this._editingZincObject, oldGroupName);
1459
1459
  }
1460
- else if (payload.deleting) {
1461
- this.confirmDelete();
1462
- }
1463
1460
  if (object) {
1464
1461
  this.addAndEditAnnotations(payload.region, payload.group, object.zincObject, "Create");
1465
1462
  object.zincObject.isEditable = true;
@@ -1523,19 +1520,45 @@ export default {
1523
1520
  * Confirm delete of user created primitive.
1524
1521
  * This is only called from callback.
1525
1522
  */
1526
- confirmDelete: function () {
1523
+ confirmDelete: function (payload) {
1527
1524
  if (this._editingZincObject?.isEditable) {
1528
1525
  const regionPath = this._editingZincObject.region.getFullPath() + "/";
1529
1526
  const group = this._editingZincObject.groupName;
1527
+ let toBeDeleted = true;
1528
+ if (payload.editingIndex > -1 && this._editingZincObject.isPointset) {
1529
+ toBeDeleted = 1 > this._editingZincObject.deleteVertices(payload.editingIndex);
1530
+ }
1531
+ const message = toBeDeleted ? "Deleted" : "Removed a vertex";
1532
+
1530
1533
  const annotation = addUserAnnotationWithFeature(this.annotator, this.userToken,
1531
- this._editingZincObject, regionPath, group, this.url, "Deleted");
1534
+ this._editingZincObject, regionPath, group, this.url, message);
1532
1535
  if (annotation) {
1533
1536
  this.existDrawnFeatures = markRaw(this.existDrawnFeatures.filter(feature => feature.id !== annotation.item.id));
1534
- const childRegion = this.$module.scene.getRootRegion().findChildFromPath(regionPath);
1535
- childRegion.removeZincObject(this._editingZincObject);
1537
+ if (toBeDeleted) {
1538
+ const childRegion = this.$module.scene.getRootRegion().findChildFromPath(regionPath);
1539
+ childRegion.removeZincObject(this._editingZincObject);
1540
+ }
1536
1541
  if (this.offlineAnnotationEnabled) {
1542
+ annotation.group = group;
1543
+ let regionPath = payload.region;
1544
+ if (regionPath.slice(-1) === "/") {
1545
+ regionPath = regionPath.slice(0, -1);
1546
+ }
1547
+ annotation.region = regionPath;
1537
1548
  this.offlineAnnotations = JSON.parse(sessionStorage.getItem('anonymous-annotation')) || [];
1538
- this.offlineAnnotations = this.offlineAnnotations.filter(offline => offline.item.id !== annotation.item.id);
1549
+ if (toBeDeleted) {
1550
+ this.offlineAnnotations = this.offlineAnnotations.filter(offline => offline.item.id !== annotation.item.id);
1551
+ } else {
1552
+ //Do not remove completely if there is primitive left
1553
+ const found = this.offlineAnnotations.find((element) => {
1554
+ return element.group === group &&
1555
+ element.region === annotation.region &&
1556
+ element.resource === annotation.resource &&
1557
+ element.feature.geometry.type === annotation.feature.geometry.type;
1558
+ });
1559
+ Object.assign(found, annotation);
1560
+ this.existDrawnFeatures.push(annotation.feature);
1561
+ }
1539
1562
  sessionStorage.setItem('anonymous-annotation', JSON.stringify(this.offlineAnnotations));
1540
1563
  }
1541
1564
  this.$emit('userPrimitivesUpdated', {
@@ -1852,9 +1875,11 @@ export default {
1852
1875
  activateDeleteMode: function(eventIdentifiers) {
1853
1876
  const zincObject = getDeletableObjects(eventIdentifiers);
1854
1877
  if (zincObject) {
1878
+ const editing = getEditablePoint(eventIdentifiers);
1879
+ const editingIndex = editing?.index !== undefined ? editing.index : -1;
1855
1880
  this._editingZincObject = zincObject;
1856
1881
  this.createData.faceIndex = -1;
1857
- this.createData.editingIndex = -1;
1882
+ this.createData.editingIndex = editingIndex;
1858
1883
  this.createData.renaming = false;
1859
1884
  this.createData.tempGroupName = this._editingZincObject.groupName;
1860
1885
  this.createData.regionPrefix = this._editingZincObject.region.getFullPath();