@abi-software/scaffoldvuer 1.13.0 → 1.13.1-beta.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.13.0",
3
+ "version": "1.13.1-beta.1",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -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.2"
56
+ "zincjs": "^1.16.3"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@babel/eslint-parser": "^7.28.0",
package/src/App.vue CHANGED
@@ -150,7 +150,7 @@
150
150
  id="annotations-upload"
151
151
  type="file"
152
152
  accept="application/json"
153
- @change="importOfflineAnnotations"
153
+ @change="importOfflineAnnotations"
154
154
  />
155
155
  </el-button>
156
156
  </el-col>
@@ -357,7 +357,7 @@ const writeTextFile = (filename, data) => {
357
357
  hrefElement.href = dataStr;
358
358
  hrefElement.click();
359
359
  hrefElement.remove();
360
- }
360
+ }
361
361
 
362
362
  export default {
363
363
  name: "app",
@@ -231,6 +231,11 @@ export default {
231
231
  color:black;
232
232
  opacity:0.5;
233
233
  top: 50%;
234
+ text-shadow:
235
+ -1px -1px 0 white,
236
+ 1px -1px 0 white,
237
+ -1px 1px 0 white,
238
+ 1px 1px 0 white; /* White outline */
234
239
  }
235
240
  }
236
241
 
@@ -440,6 +440,7 @@ import {
440
440
  getClickedObjects,
441
441
  getDeletableObjects,
442
442
  getDrawnAnnotations,
443
+ getEditablePoint,
443
444
  getEditableLines,
444
445
  getObjectsFromAnnotations,
445
446
  findObjectsWithNames,
@@ -1175,6 +1176,9 @@ export default {
1175
1176
  }
1176
1177
  }
1177
1178
  }
1179
+ //Recalculate the following if module is ready
1180
+ this.calculateBoundingBox();
1181
+
1178
1182
  /**
1179
1183
  * Emit when a new object is added to the scene
1180
1184
  * @arg {Object} "The object added to the sceene"
@@ -1298,7 +1302,17 @@ export default {
1298
1302
  }
1299
1303
  annotation.region = regionPath;
1300
1304
  this.offlineAnnotations = JSON.parse(sessionStorage.getItem('anonymous-annotation')) || [];
1301
- this.offlineAnnotations.push(annotation);
1305
+ const found = this.offlineAnnotations.find((element) => {
1306
+ return element.group === annotation.group &&
1307
+ element.region === annotation.region &&
1308
+ element.resource === annotation.resource &&
1309
+ element.feature.geometry.type === annotation.feature.geometry.type;
1310
+ });
1311
+ if (found) {
1312
+ Object.assign(found, annotation);
1313
+ } else {
1314
+ this.offlineAnnotations.push(annotation);
1315
+ }
1302
1316
  sessionStorage.setItem('anonymous-annotation', JSON.stringify(this.offlineAnnotations));
1303
1317
  }
1304
1318
  this.$emit('userPrimitivesUpdated', {region, group, zincObject});
@@ -1341,7 +1355,15 @@ export default {
1341
1355
  );
1342
1356
  } else if (payload.editingIndex > -1) {
1343
1357
  if (this._editingZincObject) {
1344
- this._editingZincObject.editVertices([this.createData.points[1]],
1358
+ let editedPoint = undefined;
1359
+ if (payload.editingIndex > -1) {
1360
+ if (this.createData.faceIndex > -1) {
1361
+ editedPoint = this.createData.points[1];
1362
+ } else {
1363
+ editedPoint = this.createData.points[0];
1364
+ }
1365
+ }
1366
+ this._editingZincObject.editVertices([editedPoint],
1345
1367
  payload.editingIndex);
1346
1368
  const region = this._editingZincObject.region.getFullPath() + "/";
1347
1369
  const group = this._editingZincObject.groupName;
@@ -1363,6 +1385,7 @@ export default {
1363
1385
  * Cancel create workflows. Reset all relevant UIs and data.
1364
1386
  */
1365
1387
  cancelCreate: function() {
1388
+ this.changeActiveByName(undefined);
1366
1389
  this.createData.points.length = 0;
1367
1390
  this.createData.toBeConfirmed = false;
1368
1391
  this._editingZincObject = undefined;
@@ -1603,10 +1626,31 @@ export default {
1603
1626
  }
1604
1627
  }
1605
1628
  },
1629
+ createEditTemporaryPoint: function(identifiers) {
1630
+ const worldCoords = identifiers[0].extraData.worldCoords;
1631
+ if (worldCoords) {
1632
+ if (this.createData.shape === "Point" || this.createData.editingIndex > -1) {
1633
+ if (this.createData.points.length === 0) {
1634
+ this.showRegionTooltipWithAnnotations(identifiers, true, false);
1635
+ this.tData.x = 50;
1636
+ this.tData.y = 200;
1637
+ if (this._tempPoint) {
1638
+ const positionAttribute = this._tempPoint.geometry.getAttribute( 'position' );
1639
+ positionAttribute.setXYZ(0, worldCoords[0], worldCoords[1], worldCoords[2]);
1640
+ positionAttribute.needsUpdate = true;
1641
+ } else {
1642
+ this._tempPoint = this.$module.scene.addTemporaryPoints(
1643
+ [worldCoords], 0x00ffff);
1644
+ }
1645
+ }
1646
+ }
1647
+ }
1648
+ },
1606
1649
  createEditTemporaryLines: function(identifiers) {
1607
1650
  const worldCoords = identifiers[0].extraData.worldCoords;
1608
1651
  if (worldCoords) {
1609
- if (this.createData.shape === "LineString" || this.createData.editingIndex > -1) {
1652
+ if (this.createData.shape === "LineString" ||
1653
+ (this.createData.editingIndex > -1 && this.createData.faceIndex > -1)) {
1610
1654
  if (this.createData.points.length === 1) {
1611
1655
  this.showRegionTooltipWithAnnotations(identifiers, true, false);
1612
1656
  this.tData.x = 50;
@@ -1623,14 +1667,26 @@ export default {
1623
1667
  }
1624
1668
  }
1625
1669
  },
1670
+ createEditTemporaryPrimitive: function(identifiers) {
1671
+ if (this.createData.shape === "LineString" ||
1672
+ (this.createData.editingIndex > -1 &&
1673
+ this.createData.faceIndex > -1)) {
1674
+ this.createEditTemporaryLines(identifiers);
1675
+ } else {
1676
+ if (this.createData.shape === "Point" || this.createData.editingIndex > -1) {
1677
+ this.createEditTemporaryPoint(identifiers);
1678
+ }
1679
+ }
1680
+ },
1626
1681
  draw: function(data) {
1627
1682
  if (data && data.length > 0 && data[0].data.group) {
1628
1683
  if (data[0].extraData.worldCoords) {
1629
- if (this.createData.shape === "Point") {
1630
- this.drawPoint(data[0].extraData.worldCoords, data);
1631
- } else if (this.createData.shape === "LineString" ||
1632
- this.createData.editingIndex > -1) {
1684
+ if (this.createData.shape === "LineString" ||
1685
+ (this.createData.editingIndex > -1 && this.createData.faceIndex > -1)) {
1633
1686
  this.drawLine(data[0].extraData.worldCoords, data);
1687
+ } else if (this.createData.shape === "Point" ||
1688
+ (this.createData.editingIndex > -1 && this.createData.faceIndex === -1)) {
1689
+ this.drawPoint(data[0].extraData.worldCoords, data);
1634
1690
  }
1635
1691
  }
1636
1692
  }
@@ -1643,7 +1699,9 @@ export default {
1643
1699
  this.showRegionTooltipWithAnnotations(data, true, false);
1644
1700
  this.tData.x = 50;
1645
1701
  this.tData.y = 200;
1646
- this._tempPoint = this.$module.scene.addTemporaryPoints([coords], 0xffff00);
1702
+ if (!this._tempPoint) {
1703
+ this._tempPoint = this.$module.scene.addTemporaryPoints([coords], 0xffff00);
1704
+ }
1647
1705
  }
1648
1706
  },
1649
1707
  drawLine: function(coords, data) {
@@ -1686,6 +1744,19 @@ export default {
1686
1744
  setTimeout(this.stopFreeSpin, 4000);
1687
1745
  }
1688
1746
  },
1747
+ activateEditingMode: function(eventIdentifiers) {
1748
+ let editing = getEditablePoint(eventIdentifiers);
1749
+ if (editing) {
1750
+ this.activatePointEditingMode(editing.zincObject, editing.index,
1751
+ editing.point);
1752
+ } else {
1753
+ editing = getEditableLines(eventIdentifiers);
1754
+ if (editing) {
1755
+ this.activateLineEditingMode(editing.zincObject, editing.faceIndex,
1756
+ editing.vertexIndex, editing.point);
1757
+ }
1758
+ }
1759
+ },
1689
1760
  activateAnnotationMode: function(names, event) {
1690
1761
  if (this.authorisedUser || this.offlineAnnotationEnabled) {
1691
1762
  this.createData.toBeDeleted = false;
@@ -1701,11 +1772,7 @@ export default {
1701
1772
  } else {
1702
1773
  //Make sure the tooltip is displayed with annotaion mode
1703
1774
  if (this.activeDrawMode === "Edit") {
1704
- const editing = getEditableLines(event);
1705
- if (editing) {
1706
- this.activateEditingMode(editing.zincObject, editing.faceIndex,
1707
- editing.vertexIndex, editing.point);
1708
- }
1775
+ this.activateEditingMode(event.identifiers);
1709
1776
  } else if (this.activeDrawMode === "Delete") {
1710
1777
  const zincObject = getDeletableObjects(event);
1711
1778
  if (zincObject) {
@@ -1723,7 +1790,13 @@ export default {
1723
1790
  this.showRegionTooltipWithAnnotations(event.identifiers, true, true);
1724
1791
  }
1725
1792
  },
1726
- activateEditingMode: function(zincObject, faceIndex, vertexIndex, point) {
1793
+ activatePointEditingMode: function(zincObject, index, point) {
1794
+ this._editingZincObject = zincObject;
1795
+ this.createData.faceIndex = -1;
1796
+ this.createData.editingIndex = index;
1797
+ //this.drawPoint(point, undefined);
1798
+ },
1799
+ activateLineEditingMode: function(zincObject, faceIndex, vertexIndex, point) {
1727
1800
  this._editingZincObject = zincObject;
1728
1801
  this.createData.faceIndex = faceIndex;
1729
1802
  this.createData.editingIndex = vertexIndex;
@@ -1769,7 +1842,9 @@ export default {
1769
1842
  this.tData.label = id;
1770
1843
  this.tData.region = regionPath;
1771
1844
  const zincObject = getClickedObjects(event);
1772
- this._editingZincObject = zincObject;
1845
+ if (this.createData.editingIndex === -1 ) {
1846
+ this._editingZincObject = zincObject;
1847
+ }
1773
1848
  if (zincObject) {
1774
1849
  const regionPath = this._editingZincObject.region.getFullPath() + "/";
1775
1850
  const group = this._editingZincObject.groupName;
@@ -1828,7 +1903,7 @@ export default {
1828
1903
  this.tData.region = regionPath;
1829
1904
  this.tData.x = event.identifiers[0].coords.x;
1830
1905
  this.tData.y = event.identifiers[0].coords.y;
1831
- this.createEditTemporaryLines(event.identifiers);
1906
+ this.createEditTemporaryPrimitive(event.identifiers);
1832
1907
  }
1833
1908
  }
1834
1909
  /**
@@ -1845,7 +1920,7 @@ export default {
1845
1920
  this.tData.x = event.identifiers[0].coords.x - offsets.left;
1846
1921
  this.tData.y = event.identifiers[0].coords.y - offsets.top;
1847
1922
  }
1848
- this.createEditTemporaryLines(event.identifiers);
1923
+ this.createEditTemporaryPrimitive(event.identifiers);
1849
1924
  }
1850
1925
  }
1851
1926
  }
@@ -2062,6 +2137,7 @@ export default {
2062
2137
  this.$module.zincRenderer.removePostRenderCallbackFunction(
2063
2138
  this.$_regionTooltipCallback
2064
2139
  );
2140
+ this.$module.$_regionTooltipCallback = undefined;
2065
2141
  }
2066
2142
  this.$_regionTooltipCallback =
2067
2143
  this.$module.zincRenderer.addPostRenderCallbackFunction(
@@ -2089,6 +2165,7 @@ export default {
2089
2165
  this.$module.zincRenderer.removePostRenderCallbackFunction(
2090
2166
  this.$_liveCoordinatesUpdated
2091
2167
  );
2168
+ this.$_liveCoordinatesUpdated = undefined;
2092
2169
  }
2093
2170
  if (liveUpdates) {
2094
2171
  this.$module.setupLiveCoordinates(objects);
@@ -2160,6 +2237,10 @@ export default {
2160
2237
  showRegionTooltipWithAnnotations: function (annotations, resetView, liveUpdates) {
2161
2238
  if (this.$module.scene) {
2162
2239
  const result = getObjectsFromAnnotations(this.$module.scene, annotations);
2240
+ if (this._editingZincObject) {
2241
+ result.regionPath = this._editingZincObject.region.getFullPath() + "/";
2242
+ result.label = this._editingZincObject.groupName;
2243
+ }
2163
2244
  if (result && result.objects.length > 0) {
2164
2245
  if (!this.annotationSidebar) {
2165
2246
  return this.showRegionTooltipWithObjects(
@@ -2300,6 +2381,7 @@ export default {
2300
2381
  );
2301
2382
  //Unset the tracking
2302
2383
  this.$module.setupLiveCoordinates(undefined);
2384
+ this.$_liveCoordinatesUpdated = undefined;
2303
2385
  }
2304
2386
  this.tData.active = false;
2305
2387
  this.tData.visible = false;
@@ -2560,6 +2642,13 @@ export default {
2560
2642
  }
2561
2643
  }
2562
2644
  },
2645
+ calculateBoundingBox: function() {
2646
+ if (this.isReady) {
2647
+ const {centre, size} = this.$module.getCentreAndSize();
2648
+ this.boundingDims.centre = centre;
2649
+ this.boundingDims.size = size;
2650
+ }
2651
+ },
2563
2652
  downloadErrorCallback: function() {
2564
2653
  return (error) => {
2565
2654
  this.$emit('on-error', error);
@@ -2584,9 +2673,7 @@ export default {
2584
2673
  this._slides = this.$module.scene.addSlicesPrimitive(
2585
2674
  "_helper", ["x-plane", "y-plane", "z-plane"], [0xFF5555, 0x55FF55, 0x5555FF],
2586
2675
  0.5);
2587
- const {centre, size} = this.$module.getCentreAndSize();
2588
- this.boundingDims.centre = centre;
2589
- this.boundingDims.size = size;
2676
+ this.calculateBoundingBox();
2590
2677
  //this.$module.scene.createAxisDisplay(false);
2591
2678
  //this.$module.scene.enableAxisDisplay(true, true);
2592
2679
  this.isReady = true;
@@ -23,7 +23,7 @@
23
23
  <el-slider
24
24
  v-model="slide.value"
25
25
  class="my-slider"
26
- :step="0.01"
26
+ :step="0.005"
27
27
  :min="0"
28
28
  :max="1"
29
29
  :show-tooltip="false"
@@ -149,24 +149,30 @@ export default {
149
149
  watch: {
150
150
  boundingDims: {
151
151
  handler: function (value) {
152
- const centre = value.centre;
153
- const size = value.size;
154
- this.min = [
155
- centre[0] - size[0],
156
- centre[1] - size[1],
157
- centre[2] - size[2]
158
- ];
159
- this.max = [
160
- centre[0] + size[0],
161
- centre[1] + size[1],
162
- centre[2] + size[2]
163
- ];
152
+ this.calculateMinAndMax();
164
153
  },
165
154
  immediate: true,
166
155
  deep: true,
167
156
  },
168
157
  },
169
158
  methods: {
159
+ calculateMinAndMax: function() {
160
+ if (this.zincObject) {
161
+ const originalPos = this.zincObject?.userData?.originalPos;
162
+ if (originalPos && this.boundingDims) {
163
+ this.min = [
164
+ originalPos[0] - this.boundingDims.size[0],
165
+ originalPos[1] - this.boundingDims.size[1],
166
+ originalPos[2] - this.boundingDims.size[2]
167
+ ];
168
+ this.max = [
169
+ originalPos[0] + this.boundingDims.size[0],
170
+ originalPos[1] + this.boundingDims.size[1],
171
+ originalPos[2] + this.boundingDims.size[2]
172
+ ];
173
+ }
174
+ }
175
+ },
170
176
  setObject: function (object) {
171
177
  if (object.isZincObject) {
172
178
  this.zincObject = markRaw(object);
@@ -182,18 +188,7 @@ export default {
182
188
  this.scale = morph.scale.x;
183
189
  }
184
190
  this.enableScaling = this.zincObject.isTextureSlides ? false : true;
185
- if (originalPos && this.boundingDims) {
186
- this.min = [
187
- originalPos[0] - this.boundingDims.size[0],
188
- originalPos[1] - this.boundingDims.size[1],
189
- originalPos[2] - this.boundingDims.size[2]
190
- ];
191
- this.max = [
192
- originalPos[0] + this.boundingDims.size[0],
193
- originalPos[1] + this.boundingDims.size[1],
194
- originalPos[2] + this.boundingDims.size[2]
195
- ];
196
- }
191
+ this.calculateMinAndMax();
197
192
  }
198
193
  } else {
199
194
  this.zincObject = undefined;
@@ -19,7 +19,7 @@ const OrgansSceneData = function() {
19
19
  /**
20
20
  * Viewer of 3D-organs models. Users can toggle on/off different views. Data is
21
21
  * displayed instead if models are not available.
22
- *
22
+ *
23
23
  * @class
24
24
  * @param {PJP.ModelsLoader}
25
25
  * ModelsLoaderIn - defined in modelsLoade.js, providing locations of
@@ -49,7 +49,7 @@ const OrgansSceneData = function() {
49
49
  this.isIgnorePicking = function() {
50
50
  return ignorePicking;
51
51
  }
52
-
52
+
53
53
  this.setIgnorePicking = function(value) {
54
54
  ignorePicking = value;
55
55
  }
@@ -74,7 +74,7 @@ const OrgansSceneData = function() {
74
74
  }
75
75
  _this.sceneData.currentTime = value;
76
76
  }
77
-
77
+
78
78
  /**
79
79
  * Update the time slider and other renderers/scenes when time has changed.
80
80
  */
@@ -89,7 +89,7 @@ const OrgansSceneData = function() {
89
89
  if (!_this.sceneData.nerveMapIsActive && pickerScene)
90
90
  pickerScene.setMorphsTime(currentTime);
91
91
  if (_this.sceneData.nerveMap && _this.sceneData.nerveMap.additionalReader)
92
- _this.sceneData.nerveMap.additionalReader.setTime(currentTime /
92
+ _this.sceneData.nerveMap.additionalReader.setTime(currentTime /
93
93
  duration);
94
94
  _this.sceneData.currentTime = currentTime / duration * 100.0;
95
95
  }
@@ -132,7 +132,7 @@ const OrgansSceneData = function() {
132
132
  this.NDCCameraControl.setCenterZoom(center, zoom);
133
133
  }
134
134
  }
135
-
135
+
136
136
  const postRenderSelectedCoordinatesUpdate = function() {
137
137
  //It is animating, the coordinates may have been updated
138
138
  if (_this.zincRenderer.playAnimation && _this.liveUpdatesObjects) {
@@ -146,19 +146,19 @@ const OrgansSceneData = function() {
146
146
  _this.selectedScreenCoordinates.y = coord.y;
147
147
  }
148
148
  }
149
-
149
+
150
150
  const preRenderUpdateCallback = function() {
151
151
  return function() {
152
152
  preRenderTimeUpdate();
153
153
  }
154
154
  }
155
-
155
+
156
156
  const postRenderUpdateCallback = function() {
157
157
  return function() {
158
158
  postRenderSelectedCoordinatesUpdate();
159
159
  }
160
160
  }
161
-
161
+
162
162
  /**
163
163
  * Add a callback which will be called when time has changed
164
164
  */
@@ -166,7 +166,7 @@ const OrgansSceneData = function() {
166
166
  if (typeof(callback === "function"))
167
167
  timeChangedCallbacks.push(callback);
168
168
  }
169
-
169
+
170
170
  this.setTexturePos = function(value) {
171
171
  if (_this.sceneData.nerveMap && _this.sceneData.nerveMap.additionalReader)
172
172
  _this.sceneData.nerveMap.additionalReader.setSliderPos(value);
@@ -177,7 +177,7 @@ const OrgansSceneData = function() {
177
177
  sceneChangedCallbacks.push(callback);
178
178
  }
179
179
  }
180
-
180
+
181
181
  this.addOrganPartAddedCallback = function(callback) {
182
182
  if (typeof(callback === "function"))
183
183
  organPartAddedCallbacks.push(callback);
@@ -223,7 +223,7 @@ const OrgansSceneData = function() {
223
223
  let intersectedObject = undefined;
224
224
  if (intersected !== undefined) {
225
225
  let marker = false;
226
- if (intersected.object.userData &&
226
+ if (intersected.object.userData &&
227
227
  intersected.object.userData.isMarker) {
228
228
  marker = true;
229
229
  intersectedObject = intersected.object.userData.parent.getMorph();
@@ -247,12 +247,12 @@ const OrgansSceneData = function() {
247
247
  }
248
248
  return {"id":id, "object":intersectedObject};
249
249
  }
250
-
250
+
251
251
  /**
252
252
  * Callback function when a pickable object has been picked. It will then
253
253
  * call functions in tissueViewer and cellPanel to show corresponding
254
254
  * informations.
255
- *
255
+ *
256
256
  * @callback
257
257
  */
258
258
  const _pickingCallback = function() {
@@ -271,7 +271,7 @@ const OrgansSceneData = function() {
271
271
  const coords = { x: window_x, y: window_y };
272
272
  if (idObject.id) {
273
273
  extraData.threeID = idObject.object?.id;
274
- if (idObject.object.userData.isGlyph) {
274
+ if (idObject.object.userData.isGlyph) {
275
275
  if (idObject.object.name) {
276
276
  _this.setSelectedByObjects([idObject.object], coords,
277
277
  extraData, true);
@@ -289,10 +289,10 @@ const OrgansSceneData = function() {
289
289
  }
290
290
  }
291
291
  };
292
-
292
+
293
293
  /**
294
294
  * Callback function when a pickable object has been hovered over.
295
- *
295
+ *
296
296
  * @callback
297
297
  */
298
298
  const _hoverCallback = function() {
@@ -382,7 +382,7 @@ const OrgansSceneData = function() {
382
382
  if (pickerScene)
383
383
  changeOrganPartsVisibilityForScene(pickerScene, name, value, 'pointsets');
384
384
  }
385
-
385
+
386
386
  /**
387
387
  * Change visibility for parts of the current scene.
388
388
  */
@@ -394,13 +394,13 @@ const OrgansSceneData = function() {
394
394
  if (pickerScene)
395
395
  changeOrganPartsVisibilityForScene(pickerScene, name, value, type);
396
396
  }
397
-
397
+
398
398
  this.changeOrganPartsVisibilityCallback = function(name) {
399
399
  return function(value) {
400
400
  _this.changeOrganPartsVisibility(name, value);
401
401
  }
402
402
  }
403
-
403
+
404
404
  this.changeBackgroundColour = function(backgroundColourString) {
405
405
  const colour = new THREE.Color(backgroundColourString);
406
406
  if (_this.zincRenderer) {
@@ -447,7 +447,7 @@ const OrgansSceneData = function() {
447
447
  removeOrganPart(systemName, partName, useDefautColour, zincObject);
448
448
  }
449
449
  }
450
-
450
+
451
451
  const downloadCompletedCallback = function() {
452
452
  return function() {
453
453
  _this.settingsChanged();
@@ -459,7 +459,7 @@ const OrgansSceneData = function() {
459
459
 
460
460
  //The payload can either be a zinc object when the loading is successful or
461
461
  //an object containg the details of error message on failure.
462
- //We only use it to handle an error
462
+ //We only use it to handle an error
463
463
  const singleItemFinishCallback = function() {
464
464
  return function(payload) {
465
465
 
@@ -474,7 +474,7 @@ const OrgansSceneData = function() {
474
474
  }
475
475
  }
476
476
  }
477
-
477
+
478
478
  /**
479
479
  * Toggle data field displays. Data fields displays flow/pressure and <button @click="play">Play</button>
480
480
  * other activities of the organs.
@@ -499,11 +499,11 @@ const OrgansSceneData = function() {
499
499
  }
500
500
  }
501
501
  }
502
-
502
+
503
503
  /**
504
504
  * Return an array containing name(s) of species that also contains the
505
505
  * currently displayed organs.
506
- *
506
+ *
507
507
  * @returns {Array} containing species name
508
508
  */
509
509
  this.getAvailableSpecies = function(currentSpecies, currentSystem, currentPart) {
@@ -534,7 +534,7 @@ const OrgansSceneData = function() {
534
534
  const size = [vector.x, vector.y, vector.z];
535
535
  return {centre, size};
536
536
  }
537
-
537
+
538
538
  const setSceneData = function(speciesName, systemName, partName, organsDetails) {
539
539
  _this.sceneData.nerveMapIsActive = false;
540
540
  _this.sceneData.nerveMap = undefined;
@@ -623,14 +623,14 @@ const OrgansSceneData = function() {
623
623
  }
624
624
  }
625
625
  }
626
-
626
+
627
627
  this.alignCameraWithSelectedObject = function(transitionTime) {
628
628
  const objects = _this.graphicsHighlight.getSelected();
629
629
  if (objects && objects[0] && objects[0].userData) {
630
630
  _this.scene.alignObjectToCameraView(objects[0].userData, transitionTime);
631
631
  }
632
632
  }
633
-
633
+
634
634
  this.exportSettings = function() {
635
635
  const settings = {};
636
636
  settings.name = _this.instanceName;
@@ -646,7 +646,7 @@ const OrgansSceneData = function() {
646
646
  settings.dialog = "Organ Viewer";
647
647
  return settings;
648
648
  }
649
-
649
+
650
650
  this.importSettings = function(settings) {
651
651
  if (settings && (settings.dialog == this.typeName)) {
652
652
  _this.setName(settings.name);
@@ -660,11 +660,11 @@ const OrgansSceneData = function() {
660
660
  }
661
661
  return false;
662
662
  }
663
-
663
+
664
664
  /**
665
665
  * initialise loading of the html layout for the organs panel, this is
666
666
  * called when the {@link PJP.OrgansViewer} is created.
667
- *
667
+ *
668
668
  * @async
669
669
  */
670
670
  const initialise = function() {
@@ -674,7 +674,7 @@ const OrgansSceneData = function() {
674
674
  _this.zincRenderer.addPostRenderCallbackFunction(postRenderUpdateCallback());
675
675
  }
676
676
  }
677
-
677
+
678
678
  initialise();
679
679
 
680
680
  }
@@ -33,15 +33,31 @@ const getDistance = (point1, point2) => {
33
33
  return Math.sqrt(dist0 * dist0 + dist1 * dist1 + dist2 * dist2);
34
34
  }
35
35
 
36
- export const getEditableLines = (event) => {
37
- const zincObjects = event.zincObjects;
38
- if (zincObjects.length > 0 && zincObjects[0]) {
39
- const zincObject = zincObjects[0];
36
+ export const getEditablePoint = (eventIdentifiers) => {
37
+ //const zincObjects = event.zincObjects;
38
+ const zincObject = eventIdentifiers[0].data?.zincObject;
39
+ if (zincObject) {
40
+ if (zincObject.isEditable && zincObject.isPointset) {
41
+ const info = eventIdentifiers[0].extraData.intersected;
42
+ if (info && info.index > -1) {
43
+ const v = zincObject.getVerticesByIndex(info.index);
44
+ if (v) {
45
+ return { zincObject, index: info.index, point: v};
46
+ }
47
+ }
48
+ }
49
+ }
50
+ return undefined;
51
+ }
52
+
53
+ export const getEditableLines = (eventIdentifiers) => {
54
+ const zincObject = eventIdentifiers[0].data?.zincObject;
55
+ if (zincObject) {
40
56
  if (zincObject.isEditable && zincObject.isLines2) {
41
- const info = event.identifiers[0].extraData.intersected;
57
+ const info = eventIdentifiers[0].extraData.intersected;
42
58
  if (info && info.faceIndex > -1) {
43
59
  const v = zincObject.getVerticesByFaceIndex(info.faceIndex);
44
- const p = event.identifiers[0].extraData.intersected.pointOnLine;
60
+ const p = eventIdentifiers[0].extraData.intersected.pointOnLine;
45
61
  if (v.length > 1) {
46
62
  const dist0 = getDistance(v[0], [p.x, p.y, p.z]);
47
63
  const dist1 = getDistance(v[1], [p.x, p.y, p.z]);
@@ -111,7 +127,7 @@ export const getLineDistance = (zincObject, faceIndex) => {
111
127
  }
112
128
  return 0;
113
129
  }
114
-
130
+
115
131
  //Move or extend a line
116
132
  export const moveAndExtendLine = (zincObject, faceIndex, unit, extendOnly) => {
117
133
  if (zincObject && unit !== 0.0) {
@@ -218,7 +234,7 @@ export const convertUUIDsToFullPaths = (rootRegion, IDs) => {
218
234
  let region = undefined;
219
235
  let primitive = undefined;
220
236
  let regionID = undefined;
221
-
237
+
222
238
  IDs.forEach(id => {
223
239
  const uuids = id.split("/");
224
240
  regionID = uuids[0];