@abi-software/scaffoldvuer 1.11.0-beta.4 → 1.11.0-beta.5
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 +5165 -4999
- package/dist/scaffoldvuer.umd.cjs +168 -168
- package/dist/style.css +1 -1
- package/mapped_fma_nerves.json +10914 -0
- package/nerve_mapping.js +10917 -0
- package/package.json +1 -1
- package/src/components/LinesControls.vue +100 -27
- package/src/components/PrimitiveControls.vue +1 -1
- package/src/components/ScaffoldTreeControls.vue +13 -0
- package/src/components/ScaffoldVuer.vue +104 -42
- package/src/scripts/GraphicsHighlight.js +16 -0
- package/src/scripts/RendererModule.js +3 -20
- package/src/scripts/Utilities.js +17 -0
- package/vite.web-component.js +36 -0
package/package.json
CHANGED
|
@@ -1,32 +1,90 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<el-container class="lines-container">
|
|
3
3
|
<el-main class="slides-block">
|
|
4
|
-
<
|
|
5
|
-
<el-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<el-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<el-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
4
|
+
<template v-if="isTubeLines">
|
|
5
|
+
<el-row>
|
|
6
|
+
<el-col :offset="0" :span="6">
|
|
7
|
+
Radius:
|
|
8
|
+
</el-col>
|
|
9
|
+
<el-col :offset="0" :span="12">
|
|
10
|
+
<el-slider
|
|
11
|
+
v-model="radius"
|
|
12
|
+
class="my-slider"
|
|
13
|
+
:step="1"
|
|
14
|
+
:min="1"
|
|
15
|
+
:max="32"
|
|
16
|
+
:show-tooltip="false"
|
|
17
|
+
@input="modifyTubeLines"
|
|
18
|
+
/>
|
|
19
|
+
</el-col>
|
|
20
|
+
<el-col :offset="0" :span="4">
|
|
21
|
+
<el-input-number
|
|
22
|
+
v-model="radius"
|
|
23
|
+
:step="1"
|
|
24
|
+
:min="1"
|
|
25
|
+
:max="32"
|
|
26
|
+
:controls="false"
|
|
27
|
+
@change="modifyTubeLines"
|
|
28
|
+
class="input-box number-input"
|
|
29
|
+
/>
|
|
30
|
+
</el-col>
|
|
31
|
+
</el-row>
|
|
32
|
+
<el-row>
|
|
33
|
+
<el-col :offset="0" :span="6">
|
|
34
|
+
Radial Segments:
|
|
35
|
+
</el-col>
|
|
36
|
+
<el-col :offset="0" :span="12">
|
|
37
|
+
<el-slider
|
|
38
|
+
v-model="radialSegments"
|
|
39
|
+
class="my-slider"
|
|
40
|
+
:step="1"
|
|
41
|
+
:min="8"
|
|
42
|
+
:max="32"
|
|
43
|
+
:show-tooltip="false"
|
|
44
|
+
@input="modifyTubeLines"
|
|
45
|
+
/>
|
|
46
|
+
</el-col>
|
|
47
|
+
<el-col :offset="0" :span="4">
|
|
48
|
+
<el-input-number
|
|
49
|
+
v-model="radialSegments"
|
|
50
|
+
:step="1"
|
|
51
|
+
:min="8"
|
|
52
|
+
:max="32"
|
|
53
|
+
:controls="false"
|
|
54
|
+
@change="modifyTubeLines"
|
|
55
|
+
class="input-box number-input"
|
|
56
|
+
/>
|
|
57
|
+
</el-col>
|
|
58
|
+
</el-row>
|
|
59
|
+
</template>
|
|
60
|
+
<template v-else>
|
|
61
|
+
<el-row>
|
|
62
|
+
<el-col :offset="0" :span="6">
|
|
63
|
+
Width:
|
|
64
|
+
</el-col>
|
|
65
|
+
<el-col :offset="0" :span="12">
|
|
66
|
+
<el-slider
|
|
67
|
+
v-model="width"
|
|
68
|
+
class="my-slider"
|
|
69
|
+
:step="1"
|
|
70
|
+
:min="1"
|
|
71
|
+
:max="100"
|
|
72
|
+
:show-tooltip="false"
|
|
73
|
+
@input="modifyWidth"
|
|
74
|
+
/>
|
|
75
|
+
</el-col>
|
|
76
|
+
<el-col :offset="0" :span="4">
|
|
77
|
+
<el-input-number
|
|
78
|
+
v-model="width"
|
|
79
|
+
:step="1"
|
|
80
|
+
:min="1"
|
|
81
|
+
:max="100"
|
|
82
|
+
:controls="false"
|
|
83
|
+
class="input-box number-input"
|
|
84
|
+
/>
|
|
85
|
+
</el-col>
|
|
86
|
+
</el-row>
|
|
87
|
+
</template>
|
|
30
88
|
<template v-if="currentIndex > -1 && distance > 0">
|
|
31
89
|
<el-row>
|
|
32
90
|
<el-col :offset="0" :span="4">
|
|
@@ -114,6 +172,13 @@ import{
|
|
|
114
172
|
ArrowLeft as ElIconArrowLeft,
|
|
115
173
|
ArrowRight as ElIconArrowRight,
|
|
116
174
|
} from '@element-plus/icons-vue';
|
|
175
|
+
|
|
176
|
+
const NERVE_CONFIG = {
|
|
177
|
+
COLOUR: '#FE0000',
|
|
178
|
+
RADIUS: 8,
|
|
179
|
+
RADIAL_SEGMENTS: 32,
|
|
180
|
+
}
|
|
181
|
+
|
|
117
182
|
/**
|
|
118
183
|
* A component to control the opacity of the target object.
|
|
119
184
|
*/
|
|
@@ -142,11 +207,14 @@ export default {
|
|
|
142
207
|
distance: 0,
|
|
143
208
|
newDistance: 0,
|
|
144
209
|
width: 1,
|
|
210
|
+
radius: NERVE_CONFIG.RADIUS,
|
|
211
|
+
radialSegments: NERVE_CONFIG.RADIAL_SEGMENTS,
|
|
145
212
|
currentIndex: 0,
|
|
146
213
|
ElIconArrowLeft: shallowRef(ElIconArrowLeft),
|
|
147
214
|
ElIconArrowRight: shallowRef(ElIconArrowRight),
|
|
148
215
|
edited: false,
|
|
149
216
|
zincObject: undefined,
|
|
217
|
+
isTubeLines: false,
|
|
150
218
|
};
|
|
151
219
|
},
|
|
152
220
|
watch: {
|
|
@@ -207,9 +275,11 @@ export default {
|
|
|
207
275
|
setObject: function (object) {
|
|
208
276
|
this.currentIndex = -1;
|
|
209
277
|
this.distance = 0;
|
|
210
|
-
|
|
278
|
+
this.radius = NERVE_CONFIG.RADIUS;
|
|
279
|
+
if (object.isLines2 || object.isTubeLines) {
|
|
211
280
|
this.zincObject = markRaw(object);
|
|
212
281
|
this.width = this.zincObject.getMorph().material.linewidth;
|
|
282
|
+
this.isTubeLines = object.isTubeLines;
|
|
213
283
|
if (object.isEditable) {
|
|
214
284
|
this.currentIndex = 0;
|
|
215
285
|
this.distance = getLineDistance(object, this.currentIndex);
|
|
@@ -222,6 +292,9 @@ export default {
|
|
|
222
292
|
modifyWidth: function () {
|
|
223
293
|
this.zincObject.setWidth(this.width);
|
|
224
294
|
},
|
|
295
|
+
modifyTubeLines: function () {
|
|
296
|
+
this.zincObject.setTubeLines(this.radius, this.radius * this.radialSegments);
|
|
297
|
+
},
|
|
225
298
|
},
|
|
226
299
|
};
|
|
227
300
|
</script>
|
|
@@ -139,7 +139,7 @@ export default {
|
|
|
139
139
|
this.isPointset = true;
|
|
140
140
|
this.$refs.pointsetControls.setObject(object);
|
|
141
141
|
this.activeName = "pControls";
|
|
142
|
-
} else if (object.isLines2) {
|
|
142
|
+
} else if (object.isLines2 || object.isTubeLines) {
|
|
143
143
|
this.isLines = true;
|
|
144
144
|
this.$refs.linesControls.setObject(object);
|
|
145
145
|
this.activeName = "lControls";
|
|
@@ -368,6 +368,19 @@ export default {
|
|
|
368
368
|
}
|
|
369
369
|
return "#FFFFFF";
|
|
370
370
|
},
|
|
371
|
+
getNodeDataByRegionAndGroup: function (regin, group) {
|
|
372
|
+
for (const treeRegion of this.treeDataEntry) {
|
|
373
|
+
if (treeRegion.isRegion && treeRegion.label === regin) {
|
|
374
|
+
const treeGroups = treeRegion.children;
|
|
375
|
+
for (const treeGroup of treeGroups) {
|
|
376
|
+
if (treeGroup.isPrimitives && treeGroup.label === group) {
|
|
377
|
+
return treeGroup;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
return undefined;
|
|
383
|
+
},
|
|
371
384
|
getZincObjectsFromNode: function (node, transverse) {
|
|
372
385
|
const rootRegion = this.module.scene.getRootRegion();
|
|
373
386
|
if (node.isPrimitives) {
|
|
@@ -462,6 +462,20 @@ import { getNerveMaps } from "../scripts/MappedNerves.js";
|
|
|
462
462
|
const nervesMap = getNerveMaps();
|
|
463
463
|
let totalNerves = 0, foundNerves = 0;
|
|
464
464
|
|
|
465
|
+
// This will be the config for selected nerves
|
|
466
|
+
const NERVE_CONFIG = {
|
|
467
|
+
COLOUR: '#FE0000',
|
|
468
|
+
RADIUS: 8,
|
|
469
|
+
RADIAL_SEGMENTS: 32,
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
const haveSameElements = (arr1, arr2) => {
|
|
473
|
+
if (arr1.length !== arr2.length) return false;
|
|
474
|
+
return arr1.sort().every((value, index) => {
|
|
475
|
+
return value === arr2.sort()[index]
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
|
|
465
479
|
/**
|
|
466
480
|
* A vue component of the scaffold viewer.
|
|
467
481
|
*
|
|
@@ -891,6 +905,8 @@ export default {
|
|
|
891
905
|
isSearch: false,
|
|
892
906
|
}),
|
|
893
907
|
//checkedRegions: []
|
|
908
|
+
previousNerves: [],
|
|
909
|
+
sidebarSearch: false
|
|
894
910
|
};
|
|
895
911
|
},
|
|
896
912
|
watch: {
|
|
@@ -981,6 +997,17 @@ export default {
|
|
|
981
997
|
}
|
|
982
998
|
this.previousMarkerLabels = markRaw({...labels});
|
|
983
999
|
},
|
|
1000
|
+
previousNerves: {
|
|
1001
|
+
handler: function (newVal, oldVal) {
|
|
1002
|
+
if (!this.sidebarSearch) {
|
|
1003
|
+
const pre = oldVal.map((nerve) => nerve.groupName);
|
|
1004
|
+
const cur = newVal.map((nerve) => nerve.groupName);
|
|
1005
|
+
if (haveSameElements(pre, cur)) return;
|
|
1006
|
+
this.handleNervesDisplay(oldVal)
|
|
1007
|
+
this.handleNervesDisplay(newVal, NERVE_CONFIG.COLOUR)
|
|
1008
|
+
}
|
|
1009
|
+
},
|
|
1010
|
+
},
|
|
984
1011
|
},
|
|
985
1012
|
beforeCreate: function () {
|
|
986
1013
|
this.$module = new OrgansViewer();
|
|
@@ -1038,45 +1065,68 @@ export default {
|
|
|
1038
1065
|
},
|
|
1039
1066
|
},
|
|
1040
1067
|
methods: {
|
|
1068
|
+
/**
|
|
1069
|
+
*
|
|
1070
|
+
* @param nerves list of nerves to be selected
|
|
1071
|
+
* @param colour with colour to modify the nerves display, if not provided, reset to default
|
|
1072
|
+
*/
|
|
1073
|
+
handleNervesDisplay: function (nerves, colour) {
|
|
1074
|
+
nerves.forEach((nerve) => {
|
|
1075
|
+
if (nerve.isTubeLines) {
|
|
1076
|
+
const regionName = nerve.region.getName();
|
|
1077
|
+
const groupName = nerve.groupName;
|
|
1078
|
+
const nodeData = this.$refs.scaffoldTreeControls.getNodeDataByRegionAndGroup(regionName, groupName)
|
|
1079
|
+
const activeColour = nodeData.activeColour.toLowerCase();
|
|
1080
|
+
const defaultColour = nodeData.defaultColour.toLowerCase();
|
|
1081
|
+
const configColour = NERVE_CONFIG.COLOUR.toLowerCase();
|
|
1082
|
+
// if the active colour is the default or config colour
|
|
1083
|
+
// use the provided colour or default depends on whether the colour is provided
|
|
1084
|
+
// otherwise, use the active colour
|
|
1085
|
+
const usedColour =
|
|
1086
|
+
activeColour === defaultColour || activeColour === configColour
|
|
1087
|
+
? colour || defaultColour
|
|
1088
|
+
: activeColour;
|
|
1089
|
+
this.$refs.scaffoldTreeControls.setColour(nodeData, usedColour)
|
|
1090
|
+
const radius = colour ? NERVE_CONFIG.RADIUS : 1;
|
|
1091
|
+
const radialSegments = NERVE_CONFIG.RADIAL_SEGMENTS;
|
|
1092
|
+
nerve.setTubeLines(radius, radialSegments);
|
|
1093
|
+
}
|
|
1094
|
+
})
|
|
1095
|
+
},
|
|
1041
1096
|
/*
|
|
1042
1097
|
setCheckedRegions: function (data) {
|
|
1043
1098
|
this.checkedRegions = data;
|
|
1044
1099
|
},
|
|
1045
1100
|
*/
|
|
1046
1101
|
/**
|
|
1047
|
-
*
|
|
1102
|
+
*
|
|
1048
1103
|
* @param nerves array of nerve names, show all nerves if empty
|
|
1049
1104
|
* @param processed boolean, whether unselect all checkboxes
|
|
1050
1105
|
*/
|
|
1051
1106
|
zoomToNerves: function (nerves, processed = false) {
|
|
1052
1107
|
if (this.$module.scene) {
|
|
1108
|
+
this.sidebarSearch = processed;
|
|
1053
1109
|
const nervesList = [];
|
|
1054
|
-
let nervesUUID = undefined;
|
|
1055
1110
|
const regions = this.$module.scene.getRootRegion().getChildRegions();
|
|
1056
1111
|
regions.forEach((region) => {
|
|
1057
1112
|
const regionName = region.getName();
|
|
1058
|
-
if (
|
|
1059
|
-
if (
|
|
1060
|
-
|
|
1061
|
-
const
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
primitives.forEach((primitive) => {
|
|
1065
|
-
primitive.setVisibility(true);
|
|
1066
|
-
nervesList.push(primitive);
|
|
1067
|
-
if (!nervesUUID) nervesUUID = primitive.region.uuid;
|
|
1068
|
-
});
|
|
1069
|
-
});
|
|
1070
|
-
}
|
|
1113
|
+
if (regionName === 'Nerves') {
|
|
1114
|
+
if (processed) {
|
|
1115
|
+
nerves.forEach((nerve) => {
|
|
1116
|
+
const primitives = this.findObjectsWithGroupName(nerve);
|
|
1117
|
+
nervesList.push(...primitives);
|
|
1118
|
+
});
|
|
1071
1119
|
}
|
|
1072
1120
|
}
|
|
1073
1121
|
});
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1122
|
+
const box = nervesList.length ?
|
|
1123
|
+
this.$module.scene.getBoundingBoxOfZincObjects(nervesList) :
|
|
1124
|
+
this.$module.scene.getBoundingBox();
|
|
1125
|
+
this.handleNervesDisplay(this.previousNerves);
|
|
1126
|
+
this.handleNervesDisplay(nervesList, NERVE_CONFIG.COLOUR);
|
|
1127
|
+
this.previousNerves = nervesList;
|
|
1128
|
+
if (box) {
|
|
1129
|
+
this.$module.scene.viewAllWithBoundingBox(box);
|
|
1080
1130
|
}
|
|
1081
1131
|
}
|
|
1082
1132
|
|
|
@@ -1114,7 +1164,7 @@ export default {
|
|
|
1114
1164
|
idsList.push(region.uuid);
|
|
1115
1165
|
}
|
|
1116
1166
|
}
|
|
1117
|
-
|
|
1167
|
+
|
|
1118
1168
|
});
|
|
1119
1169
|
if (nerves.length) {
|
|
1120
1170
|
this.fitWindow();
|
|
@@ -1780,16 +1830,23 @@ export default {
|
|
|
1780
1830
|
this.$refs.scaffoldTreeControls.removeActive(false);
|
|
1781
1831
|
}
|
|
1782
1832
|
}
|
|
1833
|
+
if (!this.sidebarSearch) {
|
|
1834
|
+
this.previousNerves = zincObjects;
|
|
1835
|
+
}
|
|
1783
1836
|
//Store the following for state saving. Search will handle the case with more than 1
|
|
1784
1837
|
//identifiers.
|
|
1785
1838
|
if (event.identifiers.length === 1) {
|
|
1786
|
-
this.lastSelected
|
|
1787
|
-
|
|
1788
|
-
|
|
1839
|
+
this.lastSelected = {
|
|
1840
|
+
isSearch: false,
|
|
1841
|
+
region: regionPath,
|
|
1842
|
+
group: event.identifiers[0].data.group,
|
|
1843
|
+
}
|
|
1789
1844
|
} else if (event.identifiers.length === 0) {
|
|
1790
|
-
this.lastSelected
|
|
1791
|
-
|
|
1792
|
-
|
|
1845
|
+
this.lastSelected = {
|
|
1846
|
+
isSearch: false,
|
|
1847
|
+
region: "",
|
|
1848
|
+
group: "",
|
|
1849
|
+
}
|
|
1793
1850
|
}
|
|
1794
1851
|
/**
|
|
1795
1852
|
* Emit when an object is selected
|
|
@@ -1893,6 +1950,9 @@ export default {
|
|
|
1893
1950
|
* is made
|
|
1894
1951
|
*/
|
|
1895
1952
|
objectSelected: function (objects, propagate) {
|
|
1953
|
+
if (!this.sidebarSearch) {
|
|
1954
|
+
this.previousNerves = objects;
|
|
1955
|
+
}
|
|
1896
1956
|
this.updatePrimitiveControls(objects);
|
|
1897
1957
|
this.$module.setSelectedByZincObjects(objects, undefined, {}, propagate);
|
|
1898
1958
|
},
|
|
@@ -2249,9 +2309,7 @@ export default {
|
|
|
2249
2309
|
this.activeDrawMode = undefined;
|
|
2250
2310
|
this.createData.shape = "";
|
|
2251
2311
|
} else if (this.viewingMode === "Neuron Connection") {
|
|
2252
|
-
|
|
2253
|
-
// enable to make organs and nerves clickable and searchable for neuron connection mode
|
|
2254
|
-
// nonNervesIsPickable = false;
|
|
2312
|
+
nonNervesIsPickable = false;
|
|
2255
2313
|
}
|
|
2256
2314
|
if ((this.viewingMode === "Exploration") ||
|
|
2257
2315
|
(this.viewingMode === "Annotation") &&
|
|
@@ -2299,7 +2357,7 @@ export default {
|
|
|
2299
2357
|
});
|
|
2300
2358
|
},
|
|
2301
2359
|
/**
|
|
2302
|
-
*
|
|
2360
|
+
*
|
|
2303
2361
|
* @param flag boolean
|
|
2304
2362
|
* @param nerves array of nerve names
|
|
2305
2363
|
*/
|
|
@@ -2325,7 +2383,7 @@ export default {
|
|
|
2325
2383
|
*/
|
|
2326
2384
|
setColour: function (flag, forced = false) {
|
|
2327
2385
|
if (this.isReady && this.$module.scene &&
|
|
2328
|
-
typeof flag === "boolean" &&
|
|
2386
|
+
typeof flag === "boolean" &&
|
|
2329
2387
|
(forced || flag !== this.colourRadio)) {
|
|
2330
2388
|
this.loading = true;
|
|
2331
2389
|
//This can take sometime to finish , nextTick does not bring out
|
|
@@ -2336,7 +2394,7 @@ export default {
|
|
|
2336
2394
|
this.colourRadio = flag;
|
|
2337
2395
|
}, 100);
|
|
2338
2396
|
}
|
|
2339
|
-
},
|
|
2397
|
+
},
|
|
2340
2398
|
/**
|
|
2341
2399
|
* @public
|
|
2342
2400
|
* Function to toggle lines graphics.
|
|
@@ -2345,7 +2403,7 @@ export default {
|
|
|
2345
2403
|
*/
|
|
2346
2404
|
setOutlines: function (flag, forced = false) {
|
|
2347
2405
|
if (this.isReady && this.$module.scene &&
|
|
2348
|
-
typeof flag === "boolean" &&
|
|
2406
|
+
typeof flag === "boolean" &&
|
|
2349
2407
|
(forced || flag !== this.outlinesRadio)) {
|
|
2350
2408
|
this.outlinesRadio = flag;
|
|
2351
2409
|
this.$nextTick(() => this.$refs.scaffoldTreeControls.setOutlines(flag));
|
|
@@ -2422,15 +2480,19 @@ export default {
|
|
|
2422
2480
|
if (text === undefined || text === "" ||
|
|
2423
2481
|
((Array.isArray(text) && text.length === 0))
|
|
2424
2482
|
) {
|
|
2425
|
-
this.lastSelected
|
|
2426
|
-
|
|
2427
|
-
|
|
2483
|
+
this.lastSelected = {
|
|
2484
|
+
region: "",
|
|
2485
|
+
group: "",
|
|
2486
|
+
isSearch: true,
|
|
2487
|
+
}
|
|
2428
2488
|
this.objectSelected([], true);
|
|
2429
2489
|
return false;
|
|
2430
2490
|
} else {
|
|
2431
|
-
this.lastSelected
|
|
2432
|
-
|
|
2433
|
-
|
|
2491
|
+
this.lastSelected = {
|
|
2492
|
+
region: "",
|
|
2493
|
+
group: text,
|
|
2494
|
+
isSearch: true,
|
|
2495
|
+
}
|
|
2434
2496
|
const result = this.$_searchIndex.searchAndProcessResult(text);
|
|
2435
2497
|
const zincObjects = result.zincObjects;
|
|
2436
2498
|
if (zincObjects.length > 0) {
|
|
@@ -2517,7 +2579,7 @@ export default {
|
|
|
2517
2579
|
if (options.offlineAnnotations) {
|
|
2518
2580
|
sessionStorage.setItem('anonymous-annotation', options.offlineAnnotations);
|
|
2519
2581
|
}
|
|
2520
|
-
if ("outlines" in options) {
|
|
2582
|
+
if ("outlines" in options) {
|
|
2521
2583
|
this.setOutlines(options.outlines);
|
|
2522
2584
|
}
|
|
2523
2585
|
if (options.viewingMode) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { THREE } from 'zincjs';
|
|
2
|
+
import { objectsToZincObjects } from "./Utilities";
|
|
2
3
|
|
|
3
4
|
const setEmissiveColour = (fullList, colour, setDepthFunc) => {
|
|
4
5
|
for (let i = 0; i < fullList.length; i++) {
|
|
@@ -118,10 +119,12 @@ const GraphicsHighlight = function() {
|
|
|
118
119
|
|
|
119
120
|
this.setHighlighted = function(objects) {
|
|
120
121
|
const previousHighlightedObjects = [...currentHighlightedObjects];
|
|
122
|
+
this.setNervesRadius(previousHighlightedObjects, 1, 4);
|
|
121
123
|
_this.resetHighlighted();
|
|
122
124
|
// Selected object cannot be highlighted
|
|
123
125
|
const array = getUnmatchingObjects(objects, currentSelectedObjects);
|
|
124
126
|
const fullList = getFullListOfObjects(array);
|
|
127
|
+
this.setNervesRadius(array, 6, 24);
|
|
125
128
|
setEmissiveColour(fullList, _this.highlightColour, false);
|
|
126
129
|
currentHighlightedObjects = array;
|
|
127
130
|
return isDifferent(currentHighlightedObjects, previousHighlightedObjects);
|
|
@@ -147,10 +150,23 @@ const GraphicsHighlight = function() {
|
|
|
147
150
|
}
|
|
148
151
|
return _temp2;
|
|
149
152
|
}
|
|
153
|
+
|
|
154
|
+
this.setNervesRadius = function(target, radius, radialSegments) {
|
|
155
|
+
const currentObjects = objectsToZincObjects(target);
|
|
156
|
+
if (currentObjects && currentObjects.length) {
|
|
157
|
+
currentObjects.forEach((currentObject) => {
|
|
158
|
+
console.log(currentObject)
|
|
159
|
+
if (currentObject.isTubeLines && currentObject.userData?.isNerves) {
|
|
160
|
+
currentObject.setTubeLines(radius, radialSegments);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
150
165
|
|
|
151
166
|
this.resetHighlighted = function() {
|
|
152
167
|
const fullList = getFullListOfObjects(currentHighlightedObjects);
|
|
153
168
|
setEmissiveColour(fullList, _this.originalColour, true);
|
|
169
|
+
this.setNervesRadius(currentHighlightedObjects, 1, 4);
|
|
154
170
|
currentHighlightedObjects = [];
|
|
155
171
|
}
|
|
156
172
|
|
|
@@ -4,6 +4,7 @@ const THREE = Zinc.THREE;
|
|
|
4
4
|
import { BaseModule } from './BaseModule';
|
|
5
5
|
import { EVENT_TYPE } from "./EventNotifier";
|
|
6
6
|
import GraphicsHighlight from "./GraphicsHighlight";
|
|
7
|
+
import { objectsToZincObjects } from "./Utilities";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Create a {@link Zinc.Renderer} on the dom element with corresponding elementID.
|
|
@@ -112,8 +113,8 @@ RendererModule.prototype.getAnnotationsFromObjects = function(objects) {
|
|
|
112
113
|
|
|
113
114
|
RendererModule.prototype.setHighlightedByObjects = function(
|
|
114
115
|
objects, coords, extraData, propagateChanges) {
|
|
116
|
+
const zincObjects = objectsToZincObjects(objects);
|
|
115
117
|
const changed = this.graphicsHighlight.setHighlighted(objects);
|
|
116
|
-
const zincObjects = this.objectsToZincObjects(objects);
|
|
117
118
|
if (propagateChanges) {
|
|
118
119
|
let eventType = EVENT_TYPE.MOVE;
|
|
119
120
|
if (changed)
|
|
@@ -162,24 +163,6 @@ RendererModule.prototype.setupLiveCoordinates = function(zincObjects) {
|
|
|
162
163
|
}
|
|
163
164
|
}
|
|
164
165
|
|
|
165
|
-
RendererModule.prototype.objectsToZincObjects = function(objects) {
|
|
166
|
-
const zincObjects = [];
|
|
167
|
-
for (let i = 0; i < objects.length; i++) {
|
|
168
|
-
let zincObject = objects[i].userData;
|
|
169
|
-
if (zincObject) {
|
|
170
|
-
if (zincObject.isGlyph || zincObject.isGlyphset) {
|
|
171
|
-
let glyphset = zincObject;
|
|
172
|
-
if (zincObject.isGlyph)
|
|
173
|
-
glyphset = zincObject.getGlyphset();
|
|
174
|
-
zincObjects.push(glyphset);
|
|
175
|
-
} else {
|
|
176
|
-
zincObjects.push(zincObject);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
return zincObjects;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
166
|
|
|
184
167
|
RendererModule.prototype.setSelectedByObjects = function(
|
|
185
168
|
objects, coords, extraData, propagateChanges) {
|
|
@@ -190,7 +173,7 @@ RendererModule.prototype.setSelectedByObjects = function(
|
|
|
190
173
|
changed = true;
|
|
191
174
|
}
|
|
192
175
|
if (changed || this.ignorePreviousSelected) {
|
|
193
|
-
const zincObjects =
|
|
176
|
+
const zincObjects = objectsToZincObjects(objects);
|
|
194
177
|
if (this.selectObjectOnPick) {
|
|
195
178
|
this.setupLiveCoordinates(zincObjects);
|
|
196
179
|
}
|
package/src/scripts/Utilities.js
CHANGED
|
@@ -409,3 +409,20 @@ export const annotationFeaturesToPrimitives = (scene, features) => {
|
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
411
|
|
|
412
|
+
export const objectsToZincObjects = function(objects) {
|
|
413
|
+
const zincObjects = [];
|
|
414
|
+
for (let i = 0; i < objects.length; i++) {
|
|
415
|
+
let zincObject = objects[i].userData;
|
|
416
|
+
if (zincObject) {
|
|
417
|
+
if (zincObject.isGlyph || zincObject.isGlyphset) {
|
|
418
|
+
let glyphset = zincObject;
|
|
419
|
+
if (zincObject.isGlyph)
|
|
420
|
+
glyphset = zincObject.getGlyphset();
|
|
421
|
+
zincObjects.push(glyphset);
|
|
422
|
+
} else {
|
|
423
|
+
zincObjects.push(zincObject);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
return zincObjects;
|
|
428
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import rootConfig from './vite.config.js'
|
|
3
|
+
import { nodePolyfills } from 'vite-plugin-node-polyfills'
|
|
4
|
+
import vue from '@vitejs/plugin-vue'
|
|
5
|
+
|
|
6
|
+
// defineWorkspace provides a nice type hinting DX
|
|
7
|
+
export default defineConfig((configEnv) => {
|
|
8
|
+
const config = rootConfig(configEnv);
|
|
9
|
+
config.css.extract = false
|
|
10
|
+
config.plugins.push(
|
|
11
|
+
nodePolyfills({
|
|
12
|
+
// To add only specific polyfills, add them here. If no option is passed, adds all polyfills
|
|
13
|
+
include: ['path']
|
|
14
|
+
})
|
|
15
|
+
);
|
|
16
|
+
// config.plugins.push(
|
|
17
|
+
// cssInjectedByJsPlugin()
|
|
18
|
+
// );
|
|
19
|
+
config.plugins[0] = vue({
|
|
20
|
+
template: {
|
|
21
|
+
compilerOptions: {
|
|
22
|
+
isCustomElement: (tag) => tag.includes('scaffoldvuer-wc')
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}),
|
|
26
|
+
config.build = {
|
|
27
|
+
lib: {
|
|
28
|
+
entry: './src/ScaffoldVuer-wc.js',
|
|
29
|
+
name: 'scaffoldvuer-wc',
|
|
30
|
+
// the proper extensions will be added
|
|
31
|
+
fileName: 'scaffoldvuer-wc'
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return config;
|
|
36
|
+
})
|