@abi-software/scaffoldvuer 1.11.0-demo.0 → 1.11.0-demo.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/dist/scaffoldvuer.js +97 -51
- package/dist/scaffoldvuer.umd.cjs +3 -3
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/components/ScaffoldTooltip.vue +7 -16
- package/src/components/ScaffoldTreeControls.vue +35 -3
- package/src/components/ScaffoldVuer.vue +71 -20
- package/src/scripts/MappedNerves.js +59 -7
- package/mapped_fma_nerves.json +0 -10914
- package/nerve_mapping.js +0 -10917
- package/vite.web-component.js +0 -36
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/scaffoldvuer",
|
|
3
|
-
"version": "1.11.0-demo.
|
|
3
|
+
"version": "1.11.0-demo.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"vue": "^3.4.21",
|
|
55
55
|
"vue-router": "^4.2.5",
|
|
56
56
|
"vue3-component-svg-sprite": "^0.0.1",
|
|
57
|
-
"zincjs": "^1.14.
|
|
57
|
+
"zincjs": "^1.14.2"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@vitejs/plugin-vue": "^4.6.2",
|
|
@@ -87,10 +87,6 @@ export default {
|
|
|
87
87
|
Tooltip,
|
|
88
88
|
},
|
|
89
89
|
props: {
|
|
90
|
-
clientHeight: {
|
|
91
|
-
type: Number,
|
|
92
|
-
default: 200,
|
|
93
|
-
},
|
|
94
90
|
createData: {
|
|
95
91
|
type: Object,
|
|
96
92
|
default: {
|
|
@@ -150,14 +146,12 @@ export default {
|
|
|
150
146
|
computed: {
|
|
151
147
|
...mapState(useMainStore, ['userToken']),
|
|
152
148
|
position: function () {
|
|
153
|
-
let yOffset =
|
|
149
|
+
let yOffset = 40;
|
|
154
150
|
if (this.region) {
|
|
155
|
-
yOffset =
|
|
151
|
+
yOffset = 55;
|
|
156
152
|
}
|
|
157
|
-
const x = this.x -
|
|
158
|
-
|
|
159
|
-
return { left: x + "px", bottom: (bottom >= 0) ? `${bottom}px` : '0px'
|
|
160
|
-
};
|
|
153
|
+
const x = this.x - 40;
|
|
154
|
+
return { left: x + "px", top: this.y - yOffset + "px" };
|
|
161
155
|
},
|
|
162
156
|
},
|
|
163
157
|
methods: {
|
|
@@ -222,8 +216,9 @@ export default {
|
|
|
222
216
|
background-color: #fff;
|
|
223
217
|
border: 1px solid $app-primary-color;
|
|
224
218
|
border-radius: 4px;
|
|
225
|
-
|
|
226
|
-
|
|
219
|
+
white-space: nowrap;
|
|
220
|
+
min-width: unset!important;
|
|
221
|
+
max-width:fit-content;
|
|
227
222
|
width:unset!important;
|
|
228
223
|
pointer-events: none;
|
|
229
224
|
top: -15px !important;
|
|
@@ -235,13 +230,9 @@ export default {
|
|
|
235
230
|
}
|
|
236
231
|
|
|
237
232
|
.tooltip-text {
|
|
238
|
-
word-wrap: normal;
|
|
239
233
|
text-align: center;
|
|
240
234
|
color: $app-primary-color;
|
|
241
235
|
}
|
|
242
|
-
.tooltip-text + .tooltip-text {
|
|
243
|
-
border-top: 1px solid $app-primary-color;
|
|
244
|
-
}
|
|
245
236
|
|
|
246
237
|
:deep(.non-selectable) {
|
|
247
238
|
user-select: none;
|
|
@@ -77,6 +77,7 @@ export default {
|
|
|
77
77
|
drawerOpen: true,
|
|
78
78
|
nodeNumbers: 0,
|
|
79
79
|
module: undefined,
|
|
80
|
+
checkedRegions: [],
|
|
80
81
|
};
|
|
81
82
|
},
|
|
82
83
|
computed: {
|
|
@@ -91,6 +92,16 @@ export default {
|
|
|
91
92
|
if (this.isReady) {
|
|
92
93
|
// Updated colour when scaffold is ready
|
|
93
94
|
this.setColourField(data);
|
|
95
|
+
// _helper is unchecked by default
|
|
96
|
+
this.checkedRegions = data.filter(region => region.label !== '_helper');
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
checkedRegions: {
|
|
101
|
+
deep: true,
|
|
102
|
+
handler: function (data) {
|
|
103
|
+
if (this.isReady) {
|
|
104
|
+
this.$emit('checked-regions', data)
|
|
94
105
|
}
|
|
95
106
|
},
|
|
96
107
|
},
|
|
@@ -221,7 +232,13 @@ export default {
|
|
|
221
232
|
.getRootRegion()
|
|
222
233
|
.findChildFromPath(node.regionPath);
|
|
223
234
|
if (isRegion) {
|
|
224
|
-
|
|
235
|
+
if (isChecked) {
|
|
236
|
+
region.showAllPrimitives();
|
|
237
|
+
this.checkedRegions.push(node);
|
|
238
|
+
} else {
|
|
239
|
+
region.hideAllPrimitives();
|
|
240
|
+
this.checkedRegions = this.checkedRegions.filter(region => region.label !== node.label);
|
|
241
|
+
}
|
|
225
242
|
}
|
|
226
243
|
if (isPrimitives) {
|
|
227
244
|
const primitives = region.findObjectsWithGroupName(node.label);
|
|
@@ -514,13 +531,28 @@ export default {
|
|
|
514
531
|
});
|
|
515
532
|
}
|
|
516
533
|
},
|
|
517
|
-
|
|
534
|
+
setCheckedKeys: function (ids, clear) {
|
|
535
|
+
this.$nextTick(() => {
|
|
536
|
+
if (clear) {
|
|
537
|
+
this.$refs.treeControls.$refs.regionTree.setCheckedKeys([]); // Clear previous checked keys
|
|
538
|
+
}
|
|
539
|
+
// this will be faster as it only requires region node ids only
|
|
540
|
+
// the number will be much less than all node ids
|
|
541
|
+
ids.forEach((id) => {
|
|
542
|
+
this.$refs.treeControls.$refs.regionTree.setChecked(id, true, true); // Set new checked keys
|
|
543
|
+
})
|
|
544
|
+
});
|
|
545
|
+
},
|
|
546
|
+
checkAllKeys: function (ignore = []) {
|
|
518
547
|
const keysList = [];
|
|
519
548
|
const ids = [];
|
|
520
549
|
extractAllFullPaths(this.treeData[0], keysList);
|
|
550
|
+
const modifiedKeysList = keysList.filter((key) => {
|
|
551
|
+
return !ignore.some(item => key.includes(item));
|
|
552
|
+
});
|
|
521
553
|
this.setTreeVisibilityWithFullPaths(
|
|
522
554
|
this.treeData[0],
|
|
523
|
-
|
|
555
|
+
modifiedKeysList,
|
|
524
556
|
ids,
|
|
525
557
|
true
|
|
526
558
|
);
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
>
|
|
9
9
|
<map-svg-sprite-color />
|
|
10
10
|
<scaffold-tooltip
|
|
11
|
-
:clientHeight="clientHeight"
|
|
12
11
|
:createData="createData"
|
|
13
12
|
:label="tData.label"
|
|
14
13
|
:region="tData.region"
|
|
@@ -105,11 +104,13 @@
|
|
|
105
104
|
@object-selected="objectSelected"
|
|
106
105
|
@object-hovered="objectHovered"
|
|
107
106
|
@drawer-toggled="drawerToggled"
|
|
107
|
+
@checked-regions="setCheckedRegions"
|
|
108
108
|
/>
|
|
109
109
|
</template>
|
|
110
110
|
</el-popover>
|
|
111
111
|
<div class="primitive-controls-box">
|
|
112
112
|
<primitive-controls
|
|
113
|
+
v-if="viewingMode === 'Exploration'"
|
|
113
114
|
ref="primitiveControls"
|
|
114
115
|
:createData="createData"
|
|
115
116
|
@primitivesUpdated="primitivesUpdated"
|
|
@@ -680,7 +681,7 @@ export default {
|
|
|
680
681
|
isNerves: {
|
|
681
682
|
type: Object,
|
|
682
683
|
default: {
|
|
683
|
-
regions: ["nerves"
|
|
684
|
+
regions: ["nerves"]
|
|
684
685
|
},
|
|
685
686
|
},
|
|
686
687
|
/**
|
|
@@ -772,7 +773,6 @@ export default {
|
|
|
772
773
|
data: function () {
|
|
773
774
|
return {
|
|
774
775
|
annotator: undefined,
|
|
775
|
-
clientHeight: 200,
|
|
776
776
|
colourRadio: true,
|
|
777
777
|
createData: {
|
|
778
778
|
drawingBox: false,
|
|
@@ -889,7 +889,8 @@ export default {
|
|
|
889
889
|
region: "",
|
|
890
890
|
group: "",
|
|
891
891
|
isSearch: false,
|
|
892
|
-
})
|
|
892
|
+
}),
|
|
893
|
+
checkedRegions: []
|
|
893
894
|
};
|
|
894
895
|
},
|
|
895
896
|
watch: {
|
|
@@ -1037,6 +1038,43 @@ export default {
|
|
|
1037
1038
|
},
|
|
1038
1039
|
},
|
|
1039
1040
|
methods: {
|
|
1041
|
+
setCheckedRegions: function (data) {
|
|
1042
|
+
this.checkedRegions = data;
|
|
1043
|
+
},
|
|
1044
|
+
zoomToNerves: function (nerves, processed = false) {
|
|
1045
|
+
if (this.$module.scene) {
|
|
1046
|
+
const idsList = [];
|
|
1047
|
+
const regions = this.$module.scene.getRootRegion().getChildRegions();
|
|
1048
|
+
regions.forEach((region) => {
|
|
1049
|
+
const regionName = region.getName();
|
|
1050
|
+
if (processed) {
|
|
1051
|
+
region.hideAllPrimitives();
|
|
1052
|
+
if (regionName === 'Nerves') {
|
|
1053
|
+
const ids = nerves.reduce((acc, nerve) => {
|
|
1054
|
+
const primitive = this.findObjectsWithGroupName(nerve)
|
|
1055
|
+
const ids = primitive.map((object) => {
|
|
1056
|
+
object.setVisibility(true);
|
|
1057
|
+
return `${object.region.uuid}/${object.uuid}`;
|
|
1058
|
+
});
|
|
1059
|
+
acc.push(...ids);
|
|
1060
|
+
return acc;
|
|
1061
|
+
}, []);
|
|
1062
|
+
idsList.push(...ids)
|
|
1063
|
+
}
|
|
1064
|
+
} else {
|
|
1065
|
+
// if the checkboxes are checked previously, restore them
|
|
1066
|
+
const isChecked = this.checkedRegions.find(item => item.label === regionName);
|
|
1067
|
+
if (isChecked) {
|
|
1068
|
+
region.showAllPrimitives();
|
|
1069
|
+
const zincObjects = region.getAllObjects();
|
|
1070
|
+
const ids = zincObjects.map(object => object.region.uuid);
|
|
1071
|
+
idsList.push(...ids);
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
});
|
|
1075
|
+
this.$refs.scaffoldTreeControls.setCheckedKeys([...new Set(idsList)], processed);
|
|
1076
|
+
}
|
|
1077
|
+
},
|
|
1040
1078
|
enableAxisDisplay: function (enable, miniaxes) {
|
|
1041
1079
|
if (this.$module.scene) {
|
|
1042
1080
|
this.$module.scene.enableAxisDisplay(enable, miniaxes);
|
|
@@ -1073,12 +1111,10 @@ export default {
|
|
|
1073
1111
|
const regions = this.isNerves?.regions;
|
|
1074
1112
|
if (regions) {
|
|
1075
1113
|
const regionPath = zincObject.getRegion().getFullPath().toLowerCase();
|
|
1076
|
-
let
|
|
1077
|
-
for (let i = 0; i < regions.length && searching; i++) {
|
|
1114
|
+
for (let i = 0; i < regions.length; i++) {
|
|
1078
1115
|
if (regionPath.includes(regions[i].toLowerCase())) {
|
|
1079
1116
|
totalNerves++;
|
|
1080
1117
|
zincObject.userData.isNerves = true;
|
|
1081
|
-
searching = false;
|
|
1082
1118
|
const groupName = zincObject.groupName.toLowerCase();
|
|
1083
1119
|
if (groupName in nervesMap) {
|
|
1084
1120
|
foundNerves++;
|
|
@@ -1793,11 +1829,13 @@ export default {
|
|
|
1793
1829
|
* @arg objects objects to be set for the selected
|
|
1794
1830
|
*/
|
|
1795
1831
|
updatePrimitiveControls: function (objects) {
|
|
1796
|
-
this.
|
|
1797
|
-
|
|
1798
|
-
this
|
|
1799
|
-
|
|
1800
|
-
|
|
1832
|
+
if (this.viewingMode === 'Exploration') {
|
|
1833
|
+
this.selectedObjects = objects;
|
|
1834
|
+
if (this.selectedObjects && this.selectedObjects.length > 0) {
|
|
1835
|
+
this.$refs.primitiveControls.setObject(this.selectedObjects[0]);
|
|
1836
|
+
} else {
|
|
1837
|
+
this.$refs.primitiveControls.setObject(undefined);
|
|
1838
|
+
}
|
|
1801
1839
|
}
|
|
1802
1840
|
},
|
|
1803
1841
|
/**
|
|
@@ -2197,14 +2235,32 @@ export default {
|
|
|
2197
2235
|
this.tData.visible = false;
|
|
2198
2236
|
this.tData.region = undefined;
|
|
2199
2237
|
},
|
|
2238
|
+
/**
|
|
2239
|
+
*
|
|
2240
|
+
* @param flag boolean
|
|
2241
|
+
* @param nerves array of nerve names
|
|
2242
|
+
*/
|
|
2243
|
+
setGreyScale: function (flag, nerves = []) {
|
|
2244
|
+
const objects = this.$module.scene.getRootRegion().getAllObjects(true);
|
|
2245
|
+
objects.forEach((zincObject) => {
|
|
2246
|
+
if (nerves.length) {
|
|
2247
|
+
const groupName = zincObject.groupName.toLowerCase();
|
|
2248
|
+
if (zincObject.userData.isNerves) {
|
|
2249
|
+
if (!nerves.includes(groupName)) zincObject.setGreyScale(flag);
|
|
2250
|
+
}
|
|
2251
|
+
} else {
|
|
2252
|
+
if (!zincObject.userData.isNerves) zincObject.setGreyScale(flag);
|
|
2253
|
+
}
|
|
2254
|
+
});
|
|
2255
|
+
this.$refs.scaffoldTreeControls.updateAllNodeColours();
|
|
2256
|
+
},
|
|
2200
2257
|
/**
|
|
2201
2258
|
* @public
|
|
2202
2259
|
* Function to toggle colour/greyscale of primitives.
|
|
2203
2260
|
* The parameter ``flag`` is a boolean, ``true`` (colour) and ``false`` (greyscale).
|
|
2204
2261
|
* @arg {Boolean} `flag`
|
|
2205
2262
|
*/
|
|
2206
|
-
|
|
2207
|
-
console.log(flag, this.colourRadio)
|
|
2263
|
+
setColour: function (flag, forced = false) {
|
|
2208
2264
|
if (this.isReady && this.$module.scene &&
|
|
2209
2265
|
typeof flag === "boolean" &&
|
|
2210
2266
|
(forced || flag !== this.colourRadio)) {
|
|
@@ -2212,11 +2268,7 @@ export default {
|
|
|
2212
2268
|
//This can take sometime to finish , nextTick does not bring out
|
|
2213
2269
|
//the loading screen so I opt for timeout loop here.
|
|
2214
2270
|
setTimeout(() => {
|
|
2215
|
-
|
|
2216
|
-
objects.forEach((zincObject) => {
|
|
2217
|
-
if (!zincObject.userData.isNerves) zincObject.setGreyScale(!flag);
|
|
2218
|
-
});
|
|
2219
|
-
this.$refs.scaffoldTreeControls.updateAllNodeColours();
|
|
2271
|
+
this.setGreyScale(!flag)
|
|
2220
2272
|
this.loading = false;
|
|
2221
2273
|
this.colourRadio = flag;
|
|
2222
2274
|
}, 100);
|
|
@@ -2660,7 +2712,6 @@ export default {
|
|
|
2660
2712
|
adjustLayout: function () {
|
|
2661
2713
|
if (this.$refs.scaffoldContainer) {
|
|
2662
2714
|
let width = this.$refs.scaffoldContainer.clientWidth;
|
|
2663
|
-
this.clientHeight = this.$refs.scaffoldContainer.clientHeight;
|
|
2664
2715
|
this.minimisedSlider = width < 812;
|
|
2665
2716
|
if (this.minimisedSlider) {
|
|
2666
2717
|
this.sliderPosition = this.drawerOpen ? "right" : "left";
|
|
@@ -829,21 +829,73 @@ const getNerveMaps = () => {
|
|
|
829
829
|
const getTermNerveMaps = () => {
|
|
830
830
|
const curatedMap = {};
|
|
831
831
|
mappedNerves.forEach((item) => {
|
|
832
|
-
|
|
833
|
-
|
|
832
|
+
const nerve_id = item["nerve_id"];
|
|
833
|
+
const label = item["label"].toLowerCase();
|
|
834
|
+
const subclassLabels = item["subclass labels"];
|
|
835
|
+
if (nerve_id && label !== "nerve") {
|
|
836
|
+
if (!subclassLabels.length) {
|
|
834
837
|
return;
|
|
835
838
|
}
|
|
836
|
-
if (!(
|
|
837
|
-
curatedMap[
|
|
839
|
+
if (!(nerve_id in curatedMap)) {
|
|
840
|
+
curatedMap[nerve_id] = {};
|
|
838
841
|
}
|
|
839
|
-
const
|
|
840
|
-
|
|
842
|
+
const subLabels = subclassLabels
|
|
843
|
+
.map((label) => label.toLowerCase())
|
|
844
|
+
.sort();
|
|
845
|
+
curatedMap[nerve_id] = {
|
|
846
|
+
nerve: label,
|
|
847
|
+
subNerves: subLabels,
|
|
848
|
+
};
|
|
841
849
|
}
|
|
842
850
|
});
|
|
843
851
|
return curatedMap;
|
|
844
852
|
};
|
|
845
853
|
|
|
854
|
+
const getFilterOptions = () => {
|
|
855
|
+
let filterOptions = [];
|
|
856
|
+
let main = {
|
|
857
|
+
key: "scaffold.connectivity.nerve",
|
|
858
|
+
label: "Nerves",
|
|
859
|
+
children: [],
|
|
860
|
+
};
|
|
861
|
+
let children1 = [];
|
|
862
|
+
for (const nerve of mappedNerves) {
|
|
863
|
+
if (nerve.label === "nerve") {
|
|
864
|
+
continue;
|
|
865
|
+
}
|
|
866
|
+
let sub = {
|
|
867
|
+
facetPropPath: "scaffold.connectivity.nerve",
|
|
868
|
+
label: "",
|
|
869
|
+
children: [],
|
|
870
|
+
};
|
|
871
|
+
let children2 = [];
|
|
872
|
+
for (const [key, value] of Object.entries(nerve)) {
|
|
873
|
+
if (key === "label") {
|
|
874
|
+
sub.label = value;
|
|
875
|
+
}
|
|
876
|
+
if (key === "subclass labels") {
|
|
877
|
+
for (const subnerve of value) {
|
|
878
|
+
children2.push({
|
|
879
|
+
facetPropPath: "scaffold.connectivity.subnerve",
|
|
880
|
+
label: subnerve,
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
if (children2.length) {
|
|
886
|
+
sub.children = children2.sort((a, b) => a.label.localeCompare(b.label));
|
|
887
|
+
children1.push(sub);
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
if (children1.length) {
|
|
891
|
+
main.children = children1.sort((a, b) => a.label.localeCompare(b.label));
|
|
892
|
+
filterOptions.push(main);
|
|
893
|
+
}
|
|
894
|
+
return filterOptions;
|
|
895
|
+
};
|
|
896
|
+
|
|
846
897
|
export {
|
|
847
898
|
getNerveMaps,
|
|
848
|
-
getTermNerveMaps
|
|
899
|
+
getTermNerveMaps,
|
|
900
|
+
getFilterOptions
|
|
849
901
|
};
|