@abi-software/scaffoldvuer 0.1.52 → 0.1.53-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/dist/scaffoldvuer.common.js +305 -214
- package/dist/scaffoldvuer.common.js.map +1 -1
- package/dist/scaffoldvuer.css +1 -1
- package/dist/scaffoldvuer.umd.js +305 -214
- package/dist/scaffoldvuer.umd.js.map +1 -1
- package/dist/scaffoldvuer.umd.min.js +1 -1
- package/dist/scaffoldvuer.umd.min.js.map +1 -1
- package/package-lock.json +598 -628
- package/package.json +2 -2
- package/src/App.vue +5 -1
- package/src/components/ScaffoldTooltip.vue +33 -33
- package/src/components/ScaffoldVuer.vue +70 -48
- package/src/components/TreeControls.vue +69 -67
- package/src/scripts/RendererModule.js +22 -7
- package/src/scripts/organsRenderer.js +4 -2
- package/src/scripts/utilities.js +34 -0
- package/src/components/TraditionalControls.vue +0 -545
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/scaffoldvuer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.53-beta.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"vue": "^2.6.10",
|
|
34
34
|
"vue-drag-resize": "^1.3.2",
|
|
35
35
|
"vue-router": "^3.5.1",
|
|
36
|
-
"zincjs": "^1.0.
|
|
36
|
+
"zincjs": "^1.0.3"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@vue/cli-plugin-babel": "^4.0.0",
|
package/src/App.vue
CHANGED
|
@@ -338,6 +338,7 @@ export default {
|
|
|
338
338
|
})
|
|
339
339
|
},
|
|
340
340
|
saveSettings: function() {
|
|
341
|
+
const state = this.$refs.scaffold.getState();
|
|
341
342
|
this._sceneSettings.push(this.$refs.scaffold.getState());
|
|
342
343
|
},
|
|
343
344
|
restoreSettings: function() {
|
|
@@ -362,10 +363,13 @@ export default {
|
|
|
362
363
|
}
|
|
363
364
|
},
|
|
364
365
|
onReady: function() {
|
|
366
|
+
console.log("ready")
|
|
365
367
|
this.$refs.dropzone.revokeURLs();
|
|
368
|
+
const names = ["left ventricle.mesh2d", "right ventricle.mesh2d"];
|
|
369
|
+
this.$refs.scaffold.changeActiveByName(names, "", false);
|
|
366
370
|
},
|
|
367
371
|
onSelected: function(data) {
|
|
368
|
-
if (data && data[0].data.group) {
|
|
372
|
+
if (data && (data.length > 0) && data[0].data.group) {
|
|
369
373
|
delete this.$route.query["viewURL"];
|
|
370
374
|
this.$router.replace({
|
|
371
375
|
query: { ...this.$route.query, region: data[0].data.group }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :style="position" class="
|
|
2
|
+
<div :style="position" class="region-tooltip">
|
|
3
3
|
<el-popover
|
|
4
4
|
ref="tooltip"
|
|
5
5
|
v-model="display"
|
|
@@ -82,45 +82,45 @@ export default {
|
|
|
82
82
|
<style scoped lang="scss">
|
|
83
83
|
@import "~element-ui/packages/theme-chalk/src/popover";
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
85
|
+
.region-tooltip {
|
|
86
|
+
position: absolute;
|
|
87
|
+
height: 50px;
|
|
88
|
+
z-index: 2;
|
|
89
|
+
::v-deep .tooltip-popper {
|
|
90
|
+
padding: 2px 6px;
|
|
91
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
|
92
|
+
font-size: 16px;
|
|
93
|
+
color: $app-primary-color;
|
|
94
|
+
background-color: #fff;
|
|
95
|
+
border: 1px solid $app-primary-color;
|
|
96
|
+
border-radius: 4px;
|
|
97
|
+
white-space: nowrap;
|
|
98
|
+
min-width: unset;
|
|
99
|
+
pointer-events: none;
|
|
100
|
+
top: -15px!important;
|
|
96
101
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
+
&.el-popper[x-placement^="top"] {
|
|
103
|
+
.popper__arrow {
|
|
104
|
+
border-top-color: $app-primary-color !important;
|
|
105
|
+
&:after {
|
|
106
|
+
border-top-color: #fff !important;
|
|
107
|
+
}
|
|
102
108
|
}
|
|
103
109
|
}
|
|
104
|
-
}
|
|
105
110
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
+
&.el-popper[x-placement^="bottom"] {
|
|
112
|
+
.popper__arrow {
|
|
113
|
+
border-bottom-color: $app-primary-color !important;
|
|
114
|
+
&:after {
|
|
115
|
+
border-bottom-color: #fff !important;
|
|
116
|
+
}
|
|
111
117
|
}
|
|
112
118
|
}
|
|
113
119
|
}
|
|
114
|
-
}
|
|
115
120
|
|
|
116
|
-
.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
::v-deep .non-selectable {
|
|
123
|
-
user-select: none;
|
|
124
|
-
pointer-events: none;
|
|
121
|
+
::v-deep .non-selectable {
|
|
122
|
+
user-select: none;
|
|
123
|
+
pointer-events: none;
|
|
124
|
+
}
|
|
125
125
|
}
|
|
126
126
|
</style>
|
|
@@ -249,7 +249,7 @@ import OpacityControls from "./OpacityControls";
|
|
|
249
249
|
import ScaffoldTooltip from "./ScaffoldTooltip";
|
|
250
250
|
import TreeControls from "./TreeControls";
|
|
251
251
|
import { MapSvgIcon, MapSvgSpriteColor } from "@abi-software/svg-sprite";
|
|
252
|
-
|
|
252
|
+
import { findObjectsWithNames } from "../scripts/utilities.js";
|
|
253
253
|
import {
|
|
254
254
|
Col,
|
|
255
255
|
Loading,
|
|
@@ -535,8 +535,8 @@ export default {
|
|
|
535
535
|
beforeCreate: function() {
|
|
536
536
|
this.$module = new OrgansViewer();
|
|
537
537
|
this.isReady = false;
|
|
538
|
-
this.
|
|
539
|
-
this.
|
|
538
|
+
this.selectedObjects = [];
|
|
539
|
+
this.hoveredObjects = [];
|
|
540
540
|
this.currentBackground = "white";
|
|
541
541
|
this._currentURL = undefined;
|
|
542
542
|
this.availableBackground = ["white", "black", "lightskyblue"];
|
|
@@ -682,8 +682,10 @@ export default {
|
|
|
682
682
|
/**
|
|
683
683
|
* Focus on named region
|
|
684
684
|
*/
|
|
685
|
-
viewRegion: function(
|
|
686
|
-
|
|
685
|
+
viewRegion: function(names) {
|
|
686
|
+
const rootRegion = this.$module.scene.getRootRegion();
|
|
687
|
+
const groups = Array.isArray(names) ? names : [names];
|
|
688
|
+
const objects = findObjectsWithNames(rootRegion, groups, "");
|
|
687
689
|
let box = this.$module.scene.getBoundingBoxOfZincObjects(objects);
|
|
688
690
|
if (box) {
|
|
689
691
|
if (this.$module.isSyncControl()) {
|
|
@@ -744,14 +746,22 @@ export default {
|
|
|
744
746
|
* It will also update other controls.
|
|
745
747
|
*/
|
|
746
748
|
eventNotifierCallback: function(event) {
|
|
749
|
+
const names = [];
|
|
750
|
+
const region = undefined;
|
|
751
|
+
if (event.eventType == 1 || event.eventType == 2) {
|
|
752
|
+
event.identifiers.forEach(identifier => {
|
|
753
|
+
if (identifier) {
|
|
754
|
+
let id = identifier.data.id
|
|
755
|
+
? identifier.data.id
|
|
756
|
+
: identifier.data.group;
|
|
757
|
+
names.push(id);
|
|
758
|
+
}
|
|
759
|
+
});
|
|
760
|
+
}
|
|
747
761
|
if (event.eventType == 1) {
|
|
748
762
|
if (this.$refs.treeControl) {
|
|
749
|
-
if (
|
|
750
|
-
|
|
751
|
-
? event.identifiers[0].data.id
|
|
752
|
-
: event.identifiers[0].data.group;
|
|
753
|
-
let region = event.identifiers[0].data.region;
|
|
754
|
-
this.$refs.treeControl.changeActiveByName(id, region, true);
|
|
763
|
+
if (names.length > 0) {
|
|
764
|
+
this.$refs.treeControl.changeActiveByNames(names, region, false);
|
|
755
765
|
} else {
|
|
756
766
|
this.$refs.treeControl.removeActive(true);
|
|
757
767
|
}
|
|
@@ -760,28 +770,29 @@ export default {
|
|
|
760
770
|
this.$emit("scaffold-selected", event.identifiers);
|
|
761
771
|
} else if (event.eventType == 2) {
|
|
762
772
|
this.tData.visible = false;
|
|
763
|
-
|
|
764
|
-
if (
|
|
773
|
+
// const offsets = this.$refs.scaffoldContainer.getBoundingClientRect();
|
|
774
|
+
if (this.$refs.treeControl) {
|
|
775
|
+
if (names.length > 0) {
|
|
776
|
+
this.$refs.treeControl.changeHoverByNames(names, region, false);
|
|
777
|
+
} else {
|
|
778
|
+
this.$refs.treeControl.removeHover(true);
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
if ((event.identifiers.length > 0) && event.identifiers[0]) {
|
|
765
782
|
let id = event.identifiers[0].data.id
|
|
766
783
|
? event.identifiers[0].data.id
|
|
767
784
|
: event.identifiers[0].data.group;
|
|
768
785
|
if (event.identifiers[0].coords) {
|
|
769
786
|
this.tData.visible = true;
|
|
770
787
|
this.tData.label = id;
|
|
771
|
-
this.tData.x = event.identifiers[0].coords.x
|
|
772
|
-
this.tData.y
|
|
773
|
-
}
|
|
774
|
-
if (this.$refs.treeControl) {
|
|
775
|
-
let region = event.identifiers[0].data.region;
|
|
776
|
-
this.$refs.treeControl.changeHoverByName(id, region, true);
|
|
777
|
-
} else {
|
|
778
|
-
this.$refs.treeControl.removeHover(true);
|
|
788
|
+
this.tData.x = event.identifiers[0].coords.x;
|
|
789
|
+
this.tData.y = event.identifiers[0].coords.y;
|
|
779
790
|
}
|
|
780
791
|
}
|
|
781
792
|
// Triggers when an object has been highlighted
|
|
782
793
|
this.$emit("scaffold-highlighted", event.identifiers);
|
|
783
794
|
} else if (event.eventType == 3) { //MOVE
|
|
784
|
-
if (event.identifiers[0]) {
|
|
795
|
+
if ((event.identifiers.length > 0) && event.identifiers[0]) {
|
|
785
796
|
if (event.identifiers[0].coords) {
|
|
786
797
|
const offsets = this.$refs.scaffoldContainer.getBoundingClientRect();
|
|
787
798
|
this.tData.x = event.identifiers[0].coords.x - offsets.left;
|
|
@@ -796,8 +807,8 @@ export default {
|
|
|
796
807
|
* @public
|
|
797
808
|
*/
|
|
798
809
|
getCoordinatesOfSelected: function() {
|
|
799
|
-
if (this.
|
|
800
|
-
return this.$module.scene.getObjectsScreenXY([this.
|
|
810
|
+
if (this.selectedObjects && this.selectedObjects.length > 0) {
|
|
811
|
+
return this.$module.scene.getObjectsScreenXY([this.selectedObjects]);
|
|
801
812
|
}
|
|
802
813
|
return undefined;
|
|
803
814
|
},
|
|
@@ -824,47 +835,54 @@ export default {
|
|
|
824
835
|
*
|
|
825
836
|
* @param {object} object Zinc object
|
|
826
837
|
*/
|
|
827
|
-
objectSelected: function(
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
this.$refs.opacityControl.setObject(this.
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
}
|
|
838
|
+
objectSelected: function(objects, propagate) {
|
|
839
|
+
this.selectedObjects = objects;
|
|
840
|
+
if (this.selectedObjects)
|
|
841
|
+
this.$refs.opacityControl.setObject(this.selectedObjects[0]);
|
|
842
|
+
if (objects) this.$module.setSelectedByZincObjects(objects, undefined, propagate);
|
|
843
|
+
else this.$module.setSelectedByObjects([], undefined, propagate);
|
|
834
844
|
},
|
|
835
845
|
/**
|
|
836
846
|
* A callback used by children components. Set the highlighted zinc object
|
|
837
847
|
*
|
|
838
848
|
* @param {object} object Zinc object
|
|
839
849
|
*/
|
|
840
|
-
objectHovered: function(
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
else this.$module.setHighlightedByObjects([], undefined, propagate);
|
|
845
|
-
}
|
|
850
|
+
objectHovered: function(objects, propagate) {
|
|
851
|
+
this.hoveredObjects = objects;
|
|
852
|
+
if (objects) this.$module.setHighlightedByZincObjects(objects, undefined, propagate);
|
|
853
|
+
else this.$module.setHighlightedByObjects([], undefined, propagate);
|
|
846
854
|
},
|
|
847
855
|
/**
|
|
848
856
|
* Set the selected by name.
|
|
849
857
|
*
|
|
850
|
-
* @param {
|
|
858
|
+
* @param {} name Name of the group
|
|
851
859
|
*/
|
|
852
|
-
changeActiveByName: function(
|
|
853
|
-
|
|
860
|
+
changeActiveByName: function(names, region, propagate) {
|
|
861
|
+
const isArray = Array.isArray(names);
|
|
862
|
+
if (names === undefined || (isArray && names.length === 0)) {
|
|
854
863
|
this.$refs.treeControl.removeActive(propagate);
|
|
855
|
-
else
|
|
856
|
-
|
|
864
|
+
} else {
|
|
865
|
+
let array = names;
|
|
866
|
+
if (!isArray)
|
|
867
|
+
array = [array];
|
|
868
|
+
this.$refs.treeControl.changeActiveByNames(array, region, propagate);
|
|
869
|
+
}
|
|
857
870
|
},
|
|
858
871
|
/**
|
|
859
872
|
* Set the highlighted by name.
|
|
860
873
|
*
|
|
861
874
|
* @param {name} name Name of the group
|
|
862
875
|
*/
|
|
863
|
-
changeHighlightedByName: function(
|
|
864
|
-
|
|
876
|
+
changeHighlightedByName: function(names, region, propagate) {
|
|
877
|
+
const isArray = Array.isArray(names);
|
|
878
|
+
if (names === undefined || (isArray && names.length === 0)) {
|
|
865
879
|
this.$refs.treeControl.removeHover(propagate);
|
|
866
|
-
else
|
|
867
|
-
|
|
880
|
+
} else {
|
|
881
|
+
let array = names;
|
|
882
|
+
if (!isArray)
|
|
883
|
+
array = [array];
|
|
884
|
+
this.$refs.treeControl.changeHoverByNames(array, region, propagate);
|
|
885
|
+
}
|
|
868
886
|
},
|
|
869
887
|
/**
|
|
870
888
|
* Start the animation.
|
|
@@ -1104,8 +1122,12 @@ export default {
|
|
|
1104
1122
|
const payload = this.$module.NDCCameraControl.getPanZoom();
|
|
1105
1123
|
this.$emit("scaffold-navigated", payload);
|
|
1106
1124
|
},
|
|
1107
|
-
|
|
1108
|
-
|
|
1125
|
+
/**
|
|
1126
|
+
* Rotate mode - "none", "horizontal", "vertical", "free" but
|
|
1127
|
+
* it will be ignored if flag is set to false.
|
|
1128
|
+
*/
|
|
1129
|
+
toggleSyncControl: function(flag, rotateMode) {
|
|
1130
|
+
this.$module.toggleSyncControl(flag, rotateMode);
|
|
1109
1131
|
this.$module.setSyncControlCallback(this.syncControlCallback);
|
|
1110
1132
|
}
|
|
1111
1133
|
}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
default-expand-all
|
|
18
18
|
node-key="id"
|
|
19
19
|
show-checkbox
|
|
20
|
-
:check-strictly="
|
|
20
|
+
:check-strictly="false"
|
|
21
21
|
:data="treeData"
|
|
22
22
|
:default-checked-keys="['__r/']"
|
|
23
23
|
:expand-on-click-node="false"
|
|
@@ -27,14 +27,8 @@
|
|
|
27
27
|
slot-scope="{ node, data }"
|
|
28
28
|
class="region-tree-node"
|
|
29
29
|
:class="{
|
|
30
|
-
activeItem:
|
|
31
|
-
|
|
32
|
-
((active.regionPath === data.regionPath) ||
|
|
33
|
-
active.regionPath === undefined)),
|
|
34
|
-
hoverItem:
|
|
35
|
-
(hover.group === data.label &&
|
|
36
|
-
((hover.regionPath === data.regionPath) ||
|
|
37
|
-
hover.regionPath === undefined))
|
|
30
|
+
activeItem: nodeIsActive(data),
|
|
31
|
+
hoverItem: nodeIsHover(data),
|
|
38
32
|
}"
|
|
39
33
|
@click="changeActiveByNode(data, true)"
|
|
40
34
|
@mouseover="changeHoverByNode(data, true)"
|
|
@@ -68,6 +62,7 @@ import Vue from "vue";
|
|
|
68
62
|
import { Checkbox, CheckboxGroup, ColorPicker, Row, Tree } from "element-ui";
|
|
69
63
|
import lang from "element-ui/lib/locale/lang/en";
|
|
70
64
|
import locale from "element-ui/lib/locale";
|
|
65
|
+
import { createListFromPrimitives, extractAllIds, findObjectsWithNames } from "../scripts/utilities.js";
|
|
71
66
|
|
|
72
67
|
const orderBy = require("lodash/orderBy");
|
|
73
68
|
const uniq = require("lodash/uniq");
|
|
@@ -90,12 +85,6 @@ const nameSorting = (a, b) => {
|
|
|
90
85
|
return 0;
|
|
91
86
|
};
|
|
92
87
|
|
|
93
|
-
const extractAllIds = (item, list) => {
|
|
94
|
-
list.push(item.id);
|
|
95
|
-
if (item.children)
|
|
96
|
-
item.children.forEach(child => extractAllIds(child, list));
|
|
97
|
-
}
|
|
98
|
-
|
|
99
88
|
/**
|
|
100
89
|
* A vue component for toggling visibility of various regions.
|
|
101
90
|
*/
|
|
@@ -117,8 +106,8 @@ export default {
|
|
|
117
106
|
data: function () {
|
|
118
107
|
return {
|
|
119
108
|
treeData: [{ label: "Root", id: "__r/", children: [] }],
|
|
120
|
-
active: {group: "", regionPath: undefined},
|
|
121
|
-
hover: {group: "", regionPath: undefined},
|
|
109
|
+
active: [{group: "", regionPath: undefined}],
|
|
110
|
+
hover: [{group: "", regionPath: undefined}],
|
|
122
111
|
myPopperClass: "hide-scaffold-colour-popup",
|
|
123
112
|
drawerOpen: true,
|
|
124
113
|
};
|
|
@@ -201,6 +190,28 @@ export default {
|
|
|
201
190
|
return data;
|
|
202
191
|
}
|
|
203
192
|
},
|
|
193
|
+
nodeIsActive: function(data) {
|
|
194
|
+
for (let i = 0; i < this.active.length; i++) {
|
|
195
|
+
let item = this.active[i];
|
|
196
|
+
if (item.group === data.label &&
|
|
197
|
+
((item.regionPath === item.regionPath) ||
|
|
198
|
+
item.regionPath === undefined)) {
|
|
199
|
+
return true;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return false;
|
|
203
|
+
},
|
|
204
|
+
nodeIsHover: function(data) {
|
|
205
|
+
for (let i = 0; i < this.hover.length; i++) {
|
|
206
|
+
let item = this.hover[i];
|
|
207
|
+
if (item.group === data.label &&
|
|
208
|
+
((item.regionPath === item.regionPath) ||
|
|
209
|
+
item.regionPath === undefined)) {
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return false;
|
|
214
|
+
},
|
|
204
215
|
/**
|
|
205
216
|
* This is called when a new organ is read into the scene.
|
|
206
217
|
*/
|
|
@@ -228,30 +239,37 @@ export default {
|
|
|
228
239
|
}
|
|
229
240
|
},
|
|
230
241
|
checkChanged: function (node, data) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
242
|
+
const rootRegion = this.module.scene.getRootRegion();
|
|
243
|
+
rootRegion.hideAllChildren();
|
|
244
|
+
data.checkedNodes.forEach(localNode => {
|
|
245
|
+
if (localNode.region) localNode.region.setVisibility(true);
|
|
246
|
+
if (localNode.primitives) {
|
|
247
|
+
localNode.primitives.forEach(primitive => {
|
|
248
|
+
primitive.setVisibility(true);
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
data.halfCheckedNodes.forEach(localNode => {
|
|
253
|
+
if (localNode.region) localNode.region.setVisibility(true);
|
|
254
|
+
});
|
|
238
255
|
},
|
|
239
|
-
|
|
240
|
-
if (
|
|
241
|
-
this.active
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
this.$emit("object-selected",
|
|
256
|
+
changeActiveByPrimitives: function (primitives, propagate) {
|
|
257
|
+
if (primitives && primitives.length > 0) {
|
|
258
|
+
this.active = [];
|
|
259
|
+
const list = createListFromPrimitives(primitives);
|
|
260
|
+
this.active.push(...list);
|
|
261
|
+
this.$emit("object-selected", primitives, propagate);
|
|
245
262
|
} else {
|
|
246
263
|
this.removeActive(propagate);
|
|
247
264
|
}
|
|
248
265
|
this.removeHover(propagate);
|
|
249
266
|
},
|
|
250
|
-
|
|
251
|
-
if (
|
|
252
|
-
this.hover
|
|
253
|
-
|
|
254
|
-
this
|
|
267
|
+
changeHoverByPrimitives: function (primitives, propagate) {
|
|
268
|
+
if (primitives && primitives.length > 0) {
|
|
269
|
+
this.hover = [];
|
|
270
|
+
const list = createListFromPrimitives(primitives);
|
|
271
|
+
this.hover.push(...list);
|
|
272
|
+
this.$emit("object-hovered", primitives, propagate);
|
|
255
273
|
} else {
|
|
256
274
|
this.removeHover(propagate);
|
|
257
275
|
}
|
|
@@ -259,43 +277,41 @@ export default {
|
|
|
259
277
|
/**
|
|
260
278
|
* Select a region by its name.
|
|
261
279
|
*/
|
|
262
|
-
|
|
280
|
+
changeActiveByNames: function (names, regionPath, propagate) {
|
|
263
281
|
const rootRegion = this.module.scene.getRootRegion();
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
this.
|
|
282
|
+
const targetObjects = findObjectsWithNames(rootRegion, names,
|
|
283
|
+
regionPath);
|
|
284
|
+
this.changeActiveByPrimitives(targetObjects, propagate);
|
|
267
285
|
},
|
|
268
286
|
/**
|
|
269
287
|
* Hover a region by its name.
|
|
270
288
|
*/
|
|
271
|
-
|
|
289
|
+
changeHoverByNames: function (names, regionPath, propagate) {
|
|
272
290
|
const rootRegion = this.module.scene.getRootRegion();
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
this.
|
|
291
|
+
const targetObjects = findObjectsWithNames(rootRegion, names,
|
|
292
|
+
regionPath);
|
|
293
|
+
this.changeHoverByPrimitives(targetObjects, propagate);
|
|
276
294
|
},
|
|
277
295
|
changeActiveByNode: function (node, propagate) {
|
|
278
296
|
if (node.primitives)
|
|
279
|
-
this.
|
|
297
|
+
this.changeActiveByPrimitives(node.primitives, propagate);
|
|
280
298
|
},
|
|
281
299
|
changeHoverByNode: function (node, propagate) {
|
|
282
300
|
if (node.primitives)
|
|
283
|
-
this.
|
|
301
|
+
this.changeHoverByPrimitives(node.primitives, propagate);
|
|
284
302
|
},
|
|
285
303
|
/**
|
|
286
304
|
* Unselect the current selected region.
|
|
287
305
|
*/
|
|
288
306
|
removeActive: function (propagate) {
|
|
289
|
-
this.active
|
|
290
|
-
this.active.regionPath = undefined;
|
|
307
|
+
this.active = [];
|
|
291
308
|
this.$emit("object-selected", undefined, propagate);
|
|
292
309
|
},
|
|
293
310
|
/**
|
|
294
311
|
* Unselect the current hover region.
|
|
295
312
|
*/
|
|
296
313
|
removeHover: function (propagate) {
|
|
297
|
-
this.hover
|
|
298
|
-
this.hover.regionPath = undefined;
|
|
314
|
+
this.hover = [];
|
|
299
315
|
this.$emit("object-hovered", undefined, propagate);
|
|
300
316
|
},
|
|
301
317
|
/**
|
|
@@ -309,19 +325,6 @@ export default {
|
|
|
309
325
|
this.$refs.regionTree.updateKeyChildren( "__r/", []);
|
|
310
326
|
this.$emit("object-selected", undefined);
|
|
311
327
|
},
|
|
312
|
-
getFirstZincObjectWithGroupName: function (region, name) {
|
|
313
|
-
if (region) {
|
|
314
|
-
let array = region.findGeometriesWithGroupName(name);
|
|
315
|
-
if (array.length > 0) return array[0];
|
|
316
|
-
array = region.findGlyphsetsWithGroupName(name);
|
|
317
|
-
if (array.length > 0) return array[0];
|
|
318
|
-
array = region.findLinesWithGroupName(name);
|
|
319
|
-
if (array.length > 0) return array[0];
|
|
320
|
-
array = region.findPointsetsWithGroupName(name);
|
|
321
|
-
if (array.length > 0) return array[0];
|
|
322
|
-
}
|
|
323
|
-
return undefined;
|
|
324
|
-
},
|
|
325
328
|
getColour: function (nodeData) {
|
|
326
329
|
if (nodeData) {
|
|
327
330
|
let graphic = nodeData.primitives[0];
|
|
@@ -333,12 +336,11 @@ export default {
|
|
|
333
336
|
return "#FFFFFF";
|
|
334
337
|
},
|
|
335
338
|
setColour: function (nodeData, value) {
|
|
336
|
-
if (nodeData) {
|
|
337
|
-
|
|
338
|
-
if (graphic) {
|
|
339
|
+
if (nodeData && nodeData.primitives) {
|
|
340
|
+
nodeData.primitives.forEach(primitive => {
|
|
339
341
|
let hexString = value.replace("#", "0x");
|
|
340
|
-
|
|
341
|
-
}
|
|
342
|
+
primitive.setColourHex(hexString);
|
|
343
|
+
});
|
|
342
344
|
}
|
|
343
345
|
},
|
|
344
346
|
viewAll: function () {
|
|
@@ -103,9 +103,17 @@ RendererModule.prototype.setHighlightedByObjects = function(
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
|
|
106
|
-
RendererModule.prototype.
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
RendererModule.prototype.setHighlightedByZincObjects = function(
|
|
107
|
+
zincObjects, coords, propagateChanges) {
|
|
108
|
+
let morphs = [];
|
|
109
|
+
if (zincObjects) {
|
|
110
|
+
zincObjects.forEach(zincObject => {
|
|
111
|
+
if (zincObject && zincObject.morph)
|
|
112
|
+
morphs.push(zincObject.morph);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return this.setHighlightedByObjects(morphs, coords,propagateChanges);
|
|
109
117
|
}
|
|
110
118
|
|
|
111
119
|
RendererModule.prototype.setupLiveCoordinates = function(zincObjects) {
|
|
@@ -160,10 +168,17 @@ RendererModule.prototype.setSelectedByObjects = function(
|
|
|
160
168
|
return changed;
|
|
161
169
|
}
|
|
162
170
|
|
|
163
|
-
RendererModule.prototype.
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
171
|
+
RendererModule.prototype.setSelectedByZincObjects = function(
|
|
172
|
+
zincObjects, coords, propagateChanges) {
|
|
173
|
+
let morphs = [];
|
|
174
|
+
if (zincObjects) {
|
|
175
|
+
zincObjects.forEach(zincObject => {
|
|
176
|
+
if (zincObject && zincObject.morph)
|
|
177
|
+
morphs.push(zincObject.morph);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return this.setSelectedByObjects(morphs, coords, propagateChanges);
|
|
167
182
|
}
|
|
168
183
|
|
|
169
184
|
const addGlyphToArray = function(objects) {
|
|
@@ -84,14 +84,16 @@ const OrgansSceneData = function() {
|
|
|
84
84
|
_this.sceneData.currentTime = currentTime / duration * 100.0;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
this.toggleSyncControl = (flag) => {
|
|
87
|
+
this.toggleSyncControl = (flag, rotateMode) => {
|
|
88
88
|
let cameraControl = this.scene.getZincCameraControls();
|
|
89
89
|
if (flag) {
|
|
90
90
|
cameraControl.resetView();
|
|
91
91
|
this.NDCCameraControl = cameraControl.enableSyncControl();
|
|
92
|
+
cameraControl.setRotationMode(rotateMode);
|
|
92
93
|
} else {
|
|
93
94
|
cameraControl.disableSyncControl();
|
|
94
95
|
this.NDCCameraControl = undefined;
|
|
96
|
+
cameraControl.setRotationMode("free");
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
99
|
|
|
@@ -225,7 +227,7 @@ const OrgansSceneData = function() {
|
|
|
225
227
|
if (idObject.object.name)
|
|
226
228
|
_this.setSelectedByObjects([idObject.object], coords, true);
|
|
227
229
|
else
|
|
228
|
-
_this.
|
|
230
|
+
_this.setSelectedByZincObjects(idObject.object.userData.getGlyphset(),
|
|
229
231
|
coords, true);
|
|
230
232
|
} else {
|
|
231
233
|
_this.setSelectedByObjects([idObject.object], coords, true);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const createListFromPrimitives = primitives => {
|
|
2
|
+
const list = [];
|
|
3
|
+
if (primitives) {
|
|
4
|
+
primitives.forEach(primitive => {
|
|
5
|
+
if (primitive && primitive.getVisibility()) {
|
|
6
|
+
list.push({
|
|
7
|
+
group: primitive.groupName,
|
|
8
|
+
regionPath: primitive.region.getFullPath()
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return list;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const extractAllIds = (item, list) => {
|
|
17
|
+
list.push(item.id);
|
|
18
|
+
if (item.children)
|
|
19
|
+
item.children.forEach(child => extractAllIds(child, list));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const findObjectsWithNames = (rootRegion, names, regionPath) => {
|
|
23
|
+
let targetRegion = rootRegion;
|
|
24
|
+
const targetObjects = [];
|
|
25
|
+
if (regionPath)
|
|
26
|
+
targetRegion = rootRegion.findChildFromPath(regionPath);
|
|
27
|
+
if (targetRegion) {
|
|
28
|
+
names.forEach(name => {
|
|
29
|
+
const temp = targetRegion.findObjectsWithGroupName(name, true);
|
|
30
|
+
targetObjects.push(...temp);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return targetObjects;
|
|
34
|
+
}
|