@abi-software/scaffoldvuer 1.13.1-beta.2 → 1.13.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/scaffoldvuer",
3
- "version": "1.13.1-beta.2",
3
+ "version": "1.13.1-beta.4",
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.7.8-beta.0",
44
+ "@abi-software/map-utilities": "^1.7.8-beta.2",
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.4"
56
+ "zincjs": "^1.16.6"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@babel/eslint-parser": "^7.28.0",
@@ -13,12 +13,16 @@
13
13
  >
14
14
  <template #default>
15
15
  <div class="tooltip-text">{{ label }}</div>
16
- <div class="tooltip-text" v-if="region">Region: {{ region }}</div>
16
+ <div class="tooltip-text" v-if="region && region != '/'">
17
+ Region: {{ region }}
18
+ </div>
17
19
  <CreateTooltipContent
18
20
  v-show="createData.toBeConfirmed"
19
21
  :createData="createData"
20
22
  @confirm-create="$emit('confirm-create', $event)"
21
23
  @cancel-create="$emit('cancel-create')"
24
+ @create-region-suggestions="$emit('create-region-suggestions', $event)"
25
+ @create-group-suggestions="$emit('create-group-suggestions', $event)"
22
26
  />
23
27
  <Tooltip
24
28
  class="p-tooltip"
@@ -210,21 +210,29 @@ export default {
210
210
  }
211
211
  }
212
212
  },
213
+ removeGroupFromRegionTreeData: function(region, groupName) {
214
+ const paths = region.getFullSeparatedPath();
215
+ const regionData = this.findOrCreateRegion(this.treeData[0], paths, "");
216
+ for (let i = 0; i < regionData.children.length; i++) {
217
+ if (regionData.children[i].label === groupName) {
218
+ regionData.children.splice(i, 1);
219
+ this.nodeNumbers--;
220
+ return;
221
+ }
222
+ }
223
+ },
224
+ zincObjectRenamed: function(zincObject, oldName) {
225
+ const objects = zincObject.region.findObjectsWithGroupName(oldName, false);
226
+ if (objects.length < 1) {
227
+ this.removeGroupFromRegionTreeData(zincObject.region, oldName);
228
+ }
229
+ this.zincObjectAdded(zincObject);
230
+ },
213
231
  zincObjectRemoved: function(zincObject) {
214
232
  const group = zincObject.groupName;
215
233
  const objects = zincObject.region.findObjectsWithGroupName(group, false);
216
234
  if (objects.length === 0) {
217
- const paths = zincObject.region.getFullSeparatedPath();
218
- const regionData = this.findOrCreateRegion(this.treeData[0], paths, "");
219
- if (regionData.children) {
220
- for (let i = 0; i < regionData.children.length; i++) {
221
- if (regionData.children[i].label === group) {
222
- regionData.children.splice(i, 1);
223
- this.nodeNumbers--;
224
- return;
225
- }
226
- }
227
- }
235
+ this.removeGroupFromRegionTreeData(zincObject.region, group);
228
236
  }
229
237
  },
230
238
  checkChanged: function (node, data) {
@@ -24,6 +24,8 @@
24
24
  @confirm-comment="confirmComment($event)"
25
25
  @confirm-delete="confirmDelete()"
26
26
  @tooltip-hide="onTooltipHide()"
27
+ @create-group-suggestions="$emit('create-group-suggestions', $event)"
28
+ @create-region-suggestions="$emit('create-region-suggestions', $event)"
27
29
  />
28
30
  <div
29
31
  id="organsDisplayArea"
@@ -815,15 +817,17 @@ export default {
815
817
  colourRadio: true,
816
818
  createData: {
817
819
  drawingBox: false,
820
+ renaming: false,
818
821
  toBeConfirmed: false,
819
822
  points: [],
820
- tempGroupName: "",
823
+ tempGroupName: undefined,
821
824
  shape: "",
822
825
  x: 0,
823
826
  y: 0,
824
827
  editingIndex: -1,
825
828
  faceIndex: -1,
826
829
  toBeDeleted: false,
830
+ regionPrefix: "__annotation"
827
831
  },
828
832
  currentTime: 0.0,
829
833
  timeVarying: false,
@@ -1201,6 +1205,18 @@ export default {
1201
1205
  }
1202
1206
  }
1203
1207
  },
1208
+ /**
1209
+ * Rename Zinc Object
1210
+ */
1211
+ renameZincObject: function (zincObject, newName) {
1212
+ if (this.$module.scene) {
1213
+ const scaffoldTreeControls = this.$refs.scaffoldTreeControls;
1214
+ const oldName = zincObject.groupName;
1215
+ zincObject.setName(newName);
1216
+ scaffoldTreeControls.zincObjectRenamed(zincObject, oldName);
1217
+ this.$_searchIndex.updateZincObject(zincObject, zincObject.uuid);
1218
+ }
1219
+ },
1204
1220
  /**
1205
1221
  * Internal only.
1206
1222
  * This is called when a zinc object is removed.
@@ -1318,6 +1334,45 @@ export default {
1318
1334
  }
1319
1335
  this.$emit('userPrimitivesUpdated', {region, group, zincObject});
1320
1336
  },
1337
+ /**
1338
+ * @public
1339
+ * Rename group in annotations, only support local annotations at this moment.
1340
+ * @arg `region`,
1341
+ * @arg `group`,
1342
+ * @arg `zincObject`,
1343
+ * @arg `oldName`
1344
+ */
1345
+ renameAnnotations: function (region, group, zincObject, oldName) {
1346
+ //Pending support for online annotation
1347
+ let regionPath = region.slice(-1) === "/" ? region : region + "/";
1348
+ const oldFeatureID = regionPath + oldName;
1349
+ const annotation = addUserAnnotationWithFeature(this.annotator, this.userToken, zincObject,
1350
+ region, group, this.url, `Rename from ${oldFeatureID}`);
1351
+ this.existDrawnFeatures = markRaw(this.existDrawnFeatures.filter(feature => feature.id !== oldFeatureID));
1352
+ this.existDrawnFeatures.push(annotation.feature);
1353
+ if (this.offlineAnnotationEnabled) {
1354
+ annotation.group = group;
1355
+ regionPath = region;
1356
+ if (regionPath.slice(-1) === "/") {
1357
+ regionPath = regionPath.slice(0, -1);
1358
+ }
1359
+ annotation.region = regionPath;
1360
+ //console.log(annotation, "oldName", oldName);
1361
+ this.offlineAnnotations = JSON.parse(sessionStorage.getItem('anonymous-annotation')) || [];
1362
+ const found = this.offlineAnnotations.find((element) => {
1363
+ return element.group === oldName &&
1364
+ element.region === annotation.region &&
1365
+ element.resource === annotation.resource &&
1366
+ element.feature.geometry.type === annotation.feature.geometry.type;
1367
+ });
1368
+ if (found) {
1369
+ //console.log('found', found)
1370
+ Object.assign(found, annotation);
1371
+ }
1372
+ sessionStorage.setItem('anonymous-annotation', JSON.stringify(this.offlineAnnotations));
1373
+ }
1374
+ this.$emit('userPrimitivesUpdated', {region, group, zincObject, renamedFrom: oldName});
1375
+ },
1321
1376
  /**
1322
1377
  * @public
1323
1378
  * Callback for when primitives have been update using primitive controls.
@@ -1370,6 +1425,11 @@ export default {
1370
1425
  const group = this._editingZincObject.groupName;
1371
1426
  this.addAndEditAnnotations(region, group, this._editingZincObject, "Position Updated");
1372
1427
  }
1428
+ } else if (payload.renaming) {
1429
+ const oldGroupName = this._editingZincObject.groupName;
1430
+ this.renameZincObject(this._editingZincObject, payload.group);
1431
+ this.renameAnnotations(payload.region, payload.group,
1432
+ this._editingZincObject, oldGroupName);
1373
1433
  }
1374
1434
  if (object) {
1375
1435
  this.addAndEditAnnotations(payload.region, payload.group, object.zincObject, "Create");
@@ -1388,10 +1448,12 @@ export default {
1388
1448
  cancelCreate: function() {
1389
1449
  this.changeActiveByName(undefined);
1390
1450
  this.createData.points.length = 0;
1451
+ this.createData.renaming = false;
1391
1452
  this.createData.toBeConfirmed = false;
1392
1453
  this._editingZincObject = undefined;
1393
1454
  this.createData.editingIndex = -1;
1394
1455
  this.createData.faceIndex = -1;
1456
+ this.createData.tempGroupName = undefined;
1395
1457
  this.tData.visible = false;
1396
1458
  this.createData.toBeDeleted = false;
1397
1459
  if (this._tempLine) {
@@ -1561,6 +1623,7 @@ export default {
1561
1623
  this.$module.selectObjectOnPick = true;
1562
1624
  } else if (type === 'tool') {
1563
1625
  this.activeDrawTool = icon;
1626
+ this.createData.renaming = false;
1564
1627
  this.createData.shape = this.activeDrawTool ? this.activeDrawTool : '';
1565
1628
  this.$module.selectObjectOnPick = false;
1566
1629
  }
@@ -1696,6 +1759,9 @@ export default {
1696
1759
  if (this.createData.toBeConfirmed === false) {
1697
1760
  this.createData.points.length = 0;
1698
1761
  this.createData.points.push(coords);
1762
+ if (this.createData.editingIndex === -1 && !this.createData.renaming) {
1763
+ this.createData.tempGroupName = undefined;
1764
+ }
1699
1765
  this.createData.toBeConfirmed = true;
1700
1766
  this.showRegionTooltipWithAnnotations(data, true, false);
1701
1767
  this.tData.x = 50;
@@ -1709,6 +1775,9 @@ export default {
1709
1775
  if (this.createData.toBeConfirmed === false) {
1710
1776
  if (this.createData.points.length === 1) {
1711
1777
  this.createData.points.push(coords);
1778
+ if (this.createData.editingIndex === -1 && !this.createData.renaming) {
1779
+ this.createData.tempGroupName = undefined;
1780
+ }
1712
1781
  this.createData.toBeConfirmed = true;
1713
1782
  this.showRegionTooltipWithAnnotations(data, true, false);
1714
1783
  this.tData.x = 50;
@@ -1758,6 +1827,23 @@ export default {
1758
1827
  }
1759
1828
  }
1760
1829
  },
1830
+ activateRenamingMode: function(eventIdentifiers) {
1831
+ let editing = getEditablePoint(eventIdentifiers);
1832
+ if (!editing) {
1833
+ editing = getEditableLines(eventIdentifiers);
1834
+ }
1835
+ if (editing) {
1836
+ this._editingZincObject = editing.zincObject;
1837
+ this.createData.faceIndex = -1;
1838
+ this.createData.editingIndex = -1;
1839
+ this.createData.renaming = true;
1840
+ this.createData.tempGroupName = this._editingZincObject.groupName;
1841
+ this.createData.toBeConfirmed = true;
1842
+ this.showRegionTooltipWithAnnotations(eventIdentifiers, true, false);
1843
+ this.tData.x = 50;
1844
+ this.tData.y = 200;
1845
+ }
1846
+ },
1761
1847
  activateAnnotationMode: function(names, event) {
1762
1848
  if (this.authorisedUser || this.offlineAnnotationEnabled) {
1763
1849
  this.createData.toBeDeleted = false;
@@ -1765,8 +1851,6 @@ export default {
1765
1851
  // Create new shape bsaed on current settings
1766
1852
  if (names.length > 0) {
1767
1853
  if (event.identifiers[0].coords) {
1768
- this.createData.x = event.identifiers[0].coords.x;
1769
- this.createData.y = event.identifiers[0].coords.y;
1770
1854
  this.draw(event.identifiers);
1771
1855
  }
1772
1856
  }
@@ -1794,6 +1878,7 @@ export default {
1794
1878
  activatePointEditingMode: function(zincObject, index, point) {
1795
1879
  this._editingZincObject = zincObject;
1796
1880
  this.createData.faceIndex = -1;
1881
+ this.createData.renaming = false;
1797
1882
  this.createData.editingIndex = index;
1798
1883
  this.createData.tempGroupName = this._editingZincObject.groupName;
1799
1884
  //this.drawPoint(point, undefined);
@@ -1801,6 +1886,7 @@ export default {
1801
1886
  activateLineEditingMode: function(zincObject, faceIndex, vertexIndex, point) {
1802
1887
  this._editingZincObject = zincObject;
1803
1888
  this.createData.faceIndex = faceIndex;
1889
+ this.createData.renaming = false;
1804
1890
  this.createData.editingIndex = vertexIndex;
1805
1891
  this.createData.tempGroupName = this._editingZincObject.groupName;
1806
1892
  this.drawLine(point, undefined);
@@ -49,6 +49,19 @@ export class SearchIndex
49
49
  this.idMaps = {};
50
50
  }
51
51
 
52
+ updateZincObject(zincObject, id)
53
+ //=======================
54
+ {
55
+ const path = zincObject.getRegion().getFullPath();
56
+ let groupName = zincObject.groupName;
57
+ let fullPath = path ? `${path}/${zincObject.groupName}` : zincObject.groupName;
58
+ groupName = groupName.replaceAll('"', '');
59
+ fullPath = fullPath.replaceAll('"', '');
60
+ const item = { path: fullPath, name: groupName, id };
61
+ this._searchEngine.replace(item);
62
+ this.idMaps[id] = { path: fullPath, zincObject };
63
+ }
64
+
52
65
  addZincObject(zincObject, id)
53
66
  //=======================
54
67
  {
@@ -169,7 +182,7 @@ export class SearchIndex
169
182
  const result = this.search(term);
170
183
  results.push(...result);
171
184
  });
172
-
185
+
173
186
  return results;
174
187
  }
175
188
 
File without changes