@abi-software/scaffoldvuer 1.3.3 → 1.4.0-beta.0

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.3.3",
3
+ "version": "1.4.0-beta.0",
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.0.0",
44
+ "@abi-software/map-utilities": "^1.1.0-beta.2",
45
45
  "@abi-software/sparc-annotation": "^0.3.1",
46
46
  "@abi-software/svg-sprite": "^1.0.0",
47
47
  "@element-plus/icons-vue": "^2.3.1",
@@ -55,12 +55,12 @@
55
55
  "vue": "^3.4.15",
56
56
  "vue-router": "^4.2.5",
57
57
  "vue3-component-svg-sprite": "^0.0.1",
58
- "zincjs": "^1.10.2"
58
+ "zincjs": "^1.11.3"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@vitejs/plugin-vue": "^4.6.2",
62
62
  "@vuese/markdown-render": "^2.11.3",
63
- "@vuese/parser": "^2.10.3",
63
+ "@vuese/parser": "^2.9.1",
64
64
  "auto-changelog": "^2.4.0",
65
65
  "babel-eslint": "^10.1.0",
66
66
  "babel-plugin-component": "^1.1.1",
package/src/App.vue CHANGED
@@ -28,6 +28,7 @@
28
28
  :format="format"
29
29
  :marker-labels="markerLabels"
30
30
  :enableLocalAnnotations="false"
31
+ :sparcAPI="sparcAPI"
31
32
  @open-map="openMap"
32
33
  @on-ready="onReady"
33
34
  @scaffold-selected="onSelected"
@@ -321,6 +322,9 @@ import {
321
322
  import { useRoute, useRouter } from 'vue-router'
322
323
  import { HelpModeDialog } from '@abi-software/map-utilities'
323
324
  import '@abi-software/map-utilities/dist/style.css'
325
+ import { mapStores } from 'pinia';
326
+ import { useSettingsStore } from '@/stores/settings';
327
+ import { getOrganCuries } from '@/services/scicrunchQueries'
324
328
 
325
329
  let texture_prefix = undefined;
326
330
 
@@ -358,7 +362,7 @@ export default {
358
362
  },
359
363
  data: function () {
360
364
  return {
361
- consoleOn: true,
365
+ consoleOn: false,
362
366
  createLinesWithNormal: false,
363
367
  url: undefined,
364
368
  input: undefined,
@@ -406,9 +410,14 @@ export default {
406
410
  router: useRouter(),
407
411
  ElIconSetting: shallowRef(ElIconSetting),
408
412
  ElIconFolderOpened: shallowRef(ElIconFolderOpened),
409
- auto: NaN
413
+ auto: NaN,
414
+ sparcAPI: import.meta.env.VITE_SPARC_API,
415
+ // sparcAPI: "http://localhost:8000/",
410
416
  };
411
417
  },
418
+ computed: {
419
+ ...mapStores(useSettingsStore),
420
+ },
412
421
  watch: {
413
422
  input: function () {
414
423
  this.parseInput();
@@ -454,6 +463,7 @@ export default {
454
463
  },
455
464
  mounted: function () {
456
465
  this._objects = [];
466
+ getOrganCuries(this.sparcAPI).then((organCuries) => this.settingsStore.updateOrganCuries(organCuries))
457
467
  },
458
468
  created: function () {
459
469
  texture_prefix = import.meta.env.VITE_TEXTURE_FOOT_PREFIX;
@@ -646,6 +656,7 @@ export default {
646
656
  }
647
657
  }
648
658
  this.scaffoldRef = this.$refs.scaffold;
659
+ // this.scaffoldRef.changeViewingMode('Annotation')
649
660
  },
650
661
  addLinesWithNormal: function (coord, normal) {
651
662
  if (coord && normal) {
@@ -97,7 +97,7 @@
97
97
  /* eslint-disable no-alert, no-console */
98
98
  // This is not in use at this moment, due to
99
99
  // limited support to line width
100
- import { shallowRef } from 'vue';
100
+ import { markRaw, shallowRef } from 'vue';
101
101
  import {
102
102
  getLineDistance,
103
103
  moveAndExtendLine,
@@ -146,26 +146,24 @@ export default {
146
146
  ElIconArrowLeft: shallowRef(ElIconArrowLeft),
147
147
  ElIconArrowRight: shallowRef(ElIconArrowRight),
148
148
  edited: false,
149
+ zincObject: undefined,
149
150
  };
150
151
  },
151
152
  watch: {
152
153
  "createData.faceIndex": {
153
154
  handler: function (value) {
154
- if (this._zincObject?.isLines2) {
155
+ if (this.zincObject?.isLines2) {
155
156
  this.currentIndex = value;
156
- this.distance = getLineDistance(this._zincObject, this.currentIndex);
157
+ this.distance = getLineDistance(this.zincObject, this.currentIndex);
157
158
  }
158
159
  },
159
160
  immediate: true,
160
161
  },
161
162
  },
162
- mounted: function () {
163
- this._zincObject = undefined;
164
- },
165
163
  methods: {
166
164
  changeIndex: function(increment) {
167
165
  if (increment) {
168
- const dist = getLineDistance(this._zincObject, this.currentIndex + 1);
166
+ const dist = getLineDistance(this.zincObject, this.currentIndex + 1);
169
167
  if (dist > 0) {
170
168
  this.currentIndex++;
171
169
  this.reset();
@@ -179,7 +177,7 @@ export default {
179
177
  if (this.newDistance !== 0) {
180
178
  this.distance = this.newDistance;
181
179
  this.edited = moveAndExtendLine(
182
- this._zincObject, this.currentIndex, this.newDistance, true) || this.edited;
180
+ this.zincObject, this.currentIndex, this.newDistance, true) || this.edited;
183
181
  } else {
184
182
  this.newDistance = this.distance;
185
183
  }
@@ -187,22 +185,22 @@ export default {
187
185
  onLengthSliding: function() {
188
186
  this.newDistance = Math.pow(10, this.lengthScale) * this.distance;
189
187
  this.edited = moveAndExtendLine(
190
- this._zincObject, this.currentIndex, this.newDistance, true) || this.edited;
188
+ this.zincObject, this.currentIndex, this.newDistance, true) || this.edited;
191
189
  },
192
190
  onMoveSliding: function() {
193
191
  const diff = (this.adjust - this.pAdjust) * this.distance;
194
192
  this.edited = moveAndExtendLine(
195
- this._zincObject, this.currentIndex, diff, false) || this.edited;
193
+ this.zincObject, this.currentIndex, diff, false) || this.edited;
196
194
  this.pAdjust = this.adjust;
197
195
  },
198
196
  reset: function() {
199
197
  this.adjust = 0;
200
198
  this.pAdjust = 0;
201
199
  this.lengthScale = 0;
202
- this.distance = getLineDistance(this._zincObject, this.currentIndex);
200
+ this.distance = getLineDistance(this.zincObject, this.currentIndex);
203
201
  this.newDistance = this.distance;
204
202
  if (this.edited) {
205
- this.$emit("primitivesUpdated", this._zincObject);
203
+ this.$emit("primitivesUpdated", this.zincObject);
206
204
  this.edited = false;
207
205
  }
208
206
  },
@@ -210,19 +208,19 @@ export default {
210
208
  this.currentIndex = -1;
211
209
  this.distance = 0;
212
210
  if (object.isLines2) {
213
- this._zincObject = object;
214
- this.width = this._zincObject.getMorph().material.linewidth;
211
+ this.zincObject = markRaw(object);
212
+ this.width = this.zincObject.getMorph().material.linewidth;
215
213
  if (object.isEditable) {
216
214
  this.currentIndex = 0;
217
215
  this.distance = getLineDistance(object, this.currentIndex);
218
216
  }
219
217
  } else {
220
- this._zincObject = undefined;
221
- this.linewidth = 10;
218
+ this.zincObject = undefined;
219
+ this.width = 10;
222
220
  }
223
221
  },
224
222
  modifyWidth: function () {
225
- this._zincObject.setWidth(this.width);
223
+ this.zincObject.setWidth(this.width);
226
224
  },
227
225
  },
228
226
  };
@@ -125,7 +125,7 @@
125
125
 
126
126
  <script>
127
127
  /* eslint-disable no-alert, no-console */
128
- import { shallowRef } from 'vue';
128
+ import { markRaw, shallowRef } from 'vue';
129
129
  import {
130
130
  movePoint,
131
131
  } from "../scripts/Utilities.js";
@@ -184,11 +184,9 @@ export default {
184
184
  ElIconArrowLeft: shallowRef(ElIconArrowLeft),
185
185
  ElIconArrowRight: shallowRef(ElIconArrowRight),
186
186
  edited: false,
187
+ zincObject: undefined,
187
188
  };
188
189
  },
189
- mounted: function () {
190
- this._zincObject = undefined;
191
- },
192
190
  watch: {
193
191
  boundingDims: {
194
192
  handler: function (value) {
@@ -211,7 +209,7 @@ export default {
211
209
  methods: {
212
210
  changeIndex: function(increment) {
213
211
  if (increment) {
214
- if (this._zincObject.drawRange > this.currentIndex + 1) {
212
+ if (this.zincObject.drawRange > this.currentIndex + 1) {
215
213
  this.currentIndex++;
216
214
  this.reset();
217
215
  }
@@ -226,7 +224,7 @@ export default {
226
224
  this.translation[1] - this.pTranslation[1],
227
225
  this.translation[2] - this.pTranslation[2],
228
226
  ];
229
- this.edited = movePoint(this._zincObject, this.currentIndex, diff) || this.edited;
227
+ this.edited = movePoint(this.zincObject, this.currentIndex, diff) || this.edited;
230
228
  for (let i = 0; i < 3; i++) {
231
229
  this.pTranslation[i] = this.translation[i];
232
230
  }
@@ -235,33 +233,33 @@ export default {
235
233
  this.translation = [0, 0, 0];
236
234
  this.pTranslation = [0, 0, 0];
237
235
  if (this.edited) {
238
- this.$emit("primitivesUpdated", this._zincObject);
236
+ this.$emit("primitivesUpdated", this.zincObject);
239
237
  this.edited = false;
240
238
  }
241
239
  },
242
240
  setObject: function (object) {
243
241
  this.currentIndex = -1;
244
242
  if (object.isPointset) {
245
- this._zincObject = object;
246
- this.size = this._zincObject.morph.material.size;
247
- this.attenuation = this._zincObject.morph.material.sizeAttenuation;
243
+ this.zincObject = markRaw(object);
244
+ this.size = this.zincObject.morph.material.size;
245
+ this.attenuation = this.zincObject.morph.material.sizeAttenuation;
248
246
  if (object.isEditable) {
249
- if (this._zincObject.drawRange > 0) {
247
+ if (this.zincObject.drawRange > 0) {
250
248
  this.currentIndex = 0;
251
249
  }
252
250
  }
253
251
  } else {
254
- this._zincObject = undefined;
252
+ this.zincObject = undefined;
255
253
  this.size = 10;
256
254
  this.attenuation = false;
257
255
  }
258
256
  },
259
257
  modifyAttenuation: function(flag) {
260
258
  this.attenuation = flag;
261
- this._zincObject.setSizeAttenuation(flag);
259
+ this.zincObject.setSizeAttenuation(flag);
262
260
  },
263
261
  modifySize: function () {
264
- this._zincObject.setSize(this.size);
262
+ this.zincObject.setSize(this.size);
265
263
  },
266
264
  },
267
265
  };
@@ -51,7 +51,7 @@
51
51
 
52
52
  <script>
53
53
  /* eslint-disable no-alert, no-console */
54
- import { ref, shallowRef } from 'vue';
54
+ import { markRaw } from 'vue';
55
55
  import {
56
56
  ArrowRight as ElIconArrowRight,
57
57
  } from '@element-plus/icons-vue';
@@ -96,6 +96,7 @@ export default {
96
96
  drawerOpen: true,
97
97
  zincObject: undefined,
98
98
  isEditable: false,
99
+ displayString: "100%"
99
100
  };
100
101
  },
101
102
  methods: {
@@ -108,7 +109,7 @@ export default {
108
109
  },
109
110
  setObject: function(object) {
110
111
  if (object) {
111
- this.zincObject = shallowRef(object);
112
+ this.zincObject = markRaw(object);
112
113
  } else {
113
114
  this.zincObject = undefined;
114
115
  }
@@ -136,7 +137,7 @@ export default {
136
137
  }
137
138
  }
138
139
  if (object && object.getMorph()) {
139
- this.material = ref(object.getMorph().material);
140
+ this.material = object.getMorph().material;
140
141
  } else {
141
142
  this.material = undefined;
142
143
  }
@@ -14,7 +14,7 @@
14
14
  <template #default>
15
15
  <div class="tooltip-text">{{ label }}</div>
16
16
  <div class="tooltip-text" v-if="region">Region: {{ region }}</div>
17
- <CreateTooltiipContent
17
+ <CreateTooltipContent
18
18
  v-show="createData.toBeConfirmed"
19
19
  :createData="createData"
20
20
  @confirm-create="$emit('confirm-create', $event)"
@@ -22,10 +22,14 @@
22
22
  />
23
23
  <Tooltip
24
24
  class="p-tooltip"
25
- v-show="annotationDisplay && !createData.toBeConfirmed"
26
- ref="annotationTooltip"
27
- :annotationDisplay="true"
25
+ v-show="
26
+ (annotationDisplay && !createData.toBeConfirmed) ||
27
+ imageEntry.length
28
+ "
29
+ ref="tooltip"
30
+ :tooltipType="annotationDisplay ? 'annotation' : 'image'"
28
31
  :annotationEntry="annotationEntry"
32
+ :imageEntry="imageEntry"
29
33
  />
30
34
  <div v-if="createData.toBeDeleted" class="delete-container">
31
35
  <el-row>
@@ -66,9 +70,9 @@ import {
66
70
  import {
67
71
  Delete as ElIconDelete,
68
72
  } from '@element-plus/icons-vue'
69
- import CreateTooltiipContent from "./CreateTooltipContent.vue";
70
73
  import { mapState } from 'pinia';
71
- import { useMainStore } from "@/store/index";
74
+ import { useMainStore } from "@/stores/index";
75
+ import CreateTooltipContent from "./CreateTooltipContent.vue";
72
76
  import { Tooltip } from '@abi-software/map-utilities'
73
77
  import '@abi-software/map-utilities/dist/style.css'
74
78
 
@@ -79,7 +83,7 @@ export default {
79
83
  name: "ScaffoldTooltip",
80
84
  components: {
81
85
  Col,
82
- CreateTooltiipContent,
86
+ CreateTooltipContent,
83
87
  ElIconDelete,
84
88
  Icon,
85
89
  Popover,
@@ -121,6 +125,14 @@ export default {
121
125
  type: Number,
122
126
  default: 200,
123
127
  },
128
+ imageThumbnails: {
129
+ type: Object,
130
+ default: {},
131
+ },
132
+ imageThumbnailSidebar: {
133
+ type: Boolean,
134
+ default: false,
135
+ },
124
136
  },
125
137
  inject: ['scaffoldUrl'],
126
138
  provide() {
@@ -130,7 +142,6 @@ export default {
130
142
  },
131
143
  data: function () {
132
144
  return {
133
- display: false,
134
145
  annotationEntry: { },
135
146
  ElIconDelete: shallowRef(ElIconDelete),
136
147
  };
@@ -145,11 +156,26 @@ export default {
145
156
  const x = this.x - 40;
146
157
  return { left: x + "px", top: this.y - yOffset + "px" };
147
158
  },
159
+ imageEntry: function () {
160
+ let imageEntries = []
161
+ const imageThumbnailsEntries = Object.assign({},
162
+ Object.fromEntries(
163
+ Object.entries(this.imageThumbnails)
164
+ .filter(([key, value]) => value.length > 0)
165
+ .map(([key, value]) => [key.toLowerCase(), value])))
166
+ if (this.label in imageThumbnailsEntries) {
167
+ imageEntries = imageThumbnailsEntries[this.label];
168
+ }
169
+ if (this.imageThumbnailSidebar) {
170
+ this.$emit('image-thumbnail-open', imageEntries)
171
+ return [];
172
+ }
173
+ return imageEntries;
174
+ },
148
175
  },
149
176
  methods: {
150
177
  checkForDisplay: function () {
151
178
  if (this.visible && this.label && this.label !== "") {
152
- this.display = true;
153
179
  if (this.annotationDisplay) {
154
180
  const region = this.region ? this.region +"/" : "";
155
181
  this.annotationEntry = {
@@ -158,9 +184,7 @@ export default {
158
184
  "resource": encodeURIComponent(this.scaffoldUrl),
159
185
  };
160
186
  }
161
- }
162
- else {
163
- this.display = false;
187
+ } else {
164
188
  this.annotationEntry = { };
165
189
  }
166
190
  },
@@ -37,6 +37,7 @@ import {
37
37
  } from "../scripts/Utilities.js";
38
38
  import { TreeControls } from "@abi-software/map-utilities";
39
39
  import "@abi-software/map-utilities/dist/style.css";
40
+ import { markRaw } from "vue";
40
41
 
41
42
  const nameSorting = (a, b) => {
42
43
  const labelA = a.label.toUpperCase();
@@ -74,6 +75,8 @@ export default {
74
75
  active: [],
75
76
  hover: [],
76
77
  drawerOpen: true,
78
+ nodeNumbers: 0,
79
+ module: undefined,
77
80
  };
78
81
  },
79
82
  computed: {
@@ -104,7 +107,7 @@ export default {
104
107
  parentContainer.sort((a, b) => {
105
108
  return nameSorting(a, b);
106
109
  });
107
- this.__nodeNumbers++;
110
+ this.nodeNumbers++;
108
111
  this.$nextTick(() => {
109
112
  const checked =
110
113
  this.$refs.treeControls.$refs.regionTree.getCheckedKeys();
@@ -117,8 +120,8 @@ export default {
117
120
  // '__r/'
118
121
  findOrCreateRegion: function (data, paths, prefix) {
119
122
  //check if root region has been set
120
- if (this.rootID === undefined && this.$module && this.$module.scene) {
121
- this.treeData[0].id = this.$module.scene.getRootRegion().uuid;
123
+ if (this.module && this.module.scene) {
124
+ this.treeData[0].id = this.module.scene.getRootRegion().uuid;
122
125
  this.treeData[0].isRegion = true;
123
126
  }
124
127
  if (paths.length > 0) {
@@ -127,7 +130,7 @@ export default {
127
130
  (child) => child.label == _paths[0]
128
131
  );
129
132
  const path = prefix + "/" + paths[0];
130
- const region = this.$module.scene
133
+ const region = this.module.scene
131
134
  .getRootRegion()
132
135
  .findChildFromPath(path);
133
136
  if (!childRegionItem) {
@@ -185,7 +188,7 @@ export default {
185
188
  for (let i = 0; i < regionData.children.length; i++) {
186
189
  if (regionData.children[i].label === group) {
187
190
  regionData.children.splice(i, 1);
188
- this.__nodeNumbers--;
191
+ this.nodeNumbers--;
189
192
  return;
190
193
  }
191
194
  }
@@ -196,7 +199,7 @@ export default {
196
199
  const isRegion = node.isRegion;
197
200
  const isPrimitives = node.isPrimitives;
198
201
  const isChecked = data.checkedKeys.includes(node.id);
199
- const region = this.$module.scene
202
+ const region = this.module.scene
200
203
  .getRootRegion()
201
204
  .findChildFromPath(node.regionPath);
202
205
  if (isRegion) {
@@ -238,7 +241,7 @@ export default {
238
241
  * Select a region by its name.
239
242
  */
240
243
  changeActiveByNames: function (names, regionPath, propagate) {
241
- const rootRegion = this.$module.scene.getRootRegion();
244
+ const rootRegion = this.module.scene.getRootRegion();
242
245
  const targetObjects = findObjectsWithNames(
243
246
  rootRegion,
244
247
  names,
@@ -251,7 +254,7 @@ export default {
251
254
  * Hover a region by its name.
252
255
  */
253
256
  changeHoverByNames: function (names, regionPath, propagate) {
254
- const rootRegion = this.$module.scene.getRootRegion();
257
+ const rootRegion = this.module.scene.getRootRegion();
255
258
  const targetObjects = findObjectsWithNames(
256
259
  rootRegion,
257
260
  names,
@@ -293,7 +296,7 @@ export default {
293
296
  clear: function () {
294
297
  this.active.length = 0;
295
298
  this.hover.length = 0;
296
- this.__nodeNumbers = 0;
299
+ this.nodeNumbers = 0;
297
300
  this.$refs.treeControls.$refs.regionTree.updateKeyChildren(
298
301
  this.treeData[0].id,
299
302
  []
@@ -315,7 +318,7 @@ export default {
315
318
  return "#FFFFFF";
316
319
  },
317
320
  getZincObjectsFromNode: function (node, transverse) {
318
- const rootRegion = this.$module.scene.getRootRegion();
321
+ const rootRegion = this.module.scene.getRootRegion();
319
322
  if (node.isPrimitives) {
320
323
  return findObjectsWithNames(
321
324
  rootRegion,
@@ -335,14 +338,14 @@ export default {
335
338
  },
336
339
  //Set this right at the beginning.
337
340
  setModule: function (moduleIn) {
338
- this.$module = moduleIn;
339
- this.__nodeNumbers = 0;
340
- const objects = this.$module.scene.getRootRegion().getAllObjects(true);
341
+ this.module = markRaw(moduleIn);
342
+ this.nodeNumbers = 0;
343
+ const objects = this.module.scene.getRootRegion().getAllObjects(true);
341
344
  objects.forEach((zincObject) => {
342
345
  this.zincObjectAdded(zincObject);
343
346
  });
344
- this.$module.addOrganPartAddedCallback(this.zincObjectAdded);
345
- this.$module.addOrganPartRemovedCallback(this.zincObjectRemoved);
347
+ this.module.addOrganPartAddedCallback(this.zincObjectAdded);
348
+ this.module.addOrganPartRemovedCallback(this.zincObjectRemoved);
346
349
  },
347
350
  setColourField: function (treeData, nodeData = undefined) {
348
351
  treeData
@@ -382,7 +385,7 @@ export default {
382
385
  }
383
386
  },
384
387
  visibilityToggle: function (item, event) {
385
- this.$module.changeOrganPartsVisibility(item, event);
388
+ this.module.changeOrganPartsVisibility(item, event);
386
389
  if (event == false) {
387
390
  if (this.activeRegion === item) {
388
391
  this.removeActive(true);
@@ -414,7 +417,7 @@ export default {
414
417
  list.splice(index, 1);
415
418
  ids.push(node.id);
416
419
  }
417
- const region = this.$module.scene
420
+ const region = this.module.scene
418
421
  .getRootRegion()
419
422
  .findChildFromPath(node.regionPath);
420
423
  if (nodeName && nodeName !== "__r") {
@@ -444,13 +447,13 @@ export default {
444
447
  getState: function () {
445
448
  let checkedItems =
446
449
  this.$refs.treeControls.$refs.regionTree.getCheckedKeys();
447
- if (checkedItems.length === this.__nodeNumbers) {
450
+ if (checkedItems.length === this.nodeNumbers) {
448
451
  return { checkAll: true, version: "2.0" };
449
452
  } else {
450
453
  //We cannot use the generated uuid as the identifier for permastate,
451
454
  //convert it back to paths
452
455
  let paths = convertUUIDsToFullPaths(
453
- this.$module.scene.getRootRegion(),
456
+ this.module.scene.getRootRegion(),
454
457
  checkedItems
455
458
  );
456
459
  return { checkedItems: paths, version: "2.0" };