@abi-software/scaffoldvuer 0.1.56 → 0.1.58
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-wc.common.js +53 -54
- package/dist/scaffoldvuer-wc.umd.js +53 -54
- package/dist/scaffoldvuer-wc.umd.min.js +53 -54
- package/dist/scaffoldvuer.common.js +317 -224
- package/dist/scaffoldvuer.common.js.map +1 -1
- package/dist/scaffoldvuer.css +1 -1
- package/dist/scaffoldvuer.umd.js +317 -224
- 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 +46 -46
- package/package.json +2 -2
- package/src/App.vue +147 -2
- package/src/components/ScaffoldTooltip.vue +6 -1
- package/src/components/ScaffoldVuer.vue +111 -41
- package/src/components/TreeControls.vue +71 -55
- package/src/scripts/RendererModule.js +3 -2
- package/src/scripts/graphicsHighlight.js +3 -3
- package/src/scripts/organsRenderer.js +16 -12
- package/src/scripts/utilities.js +7 -3
- package/src/components/TraditionalControls.vue +0 -544
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
v-if="displayWarning"
|
|
38
38
|
v-popover:warningPopover
|
|
39
39
|
class="el-icon-warning warning-icon"
|
|
40
|
-
@mouseover="
|
|
41
|
-
@mouseout="
|
|
40
|
+
@mouseover="showHelpText(6)"
|
|
41
|
+
@mouseout="hideHelpText(6)"
|
|
42
42
|
>
|
|
43
43
|
<span class="warning-text">Beta</span>
|
|
44
44
|
</i>
|
|
@@ -52,10 +52,9 @@
|
|
|
52
52
|
popper-class="scaffold-popper right-popper non-selectable"
|
|
53
53
|
/>
|
|
54
54
|
<tree-controls
|
|
55
|
-
ref="
|
|
55
|
+
ref="treeControls"
|
|
56
56
|
v-popover:checkBoxPopover
|
|
57
57
|
:help-mode="helpMode"
|
|
58
|
-
:module="$module"
|
|
59
58
|
:show-colour-picker="showColourPicker"
|
|
60
59
|
@object-selected="objectSelected"
|
|
61
60
|
@object-hovered="objectHovered"
|
|
@@ -158,8 +157,8 @@
|
|
|
158
157
|
icon="zoomIn"
|
|
159
158
|
class="icon-button zoomIn"
|
|
160
159
|
@click.native="zoomIn()"
|
|
161
|
-
@mouseover.native="
|
|
162
|
-
@mouseout.native="
|
|
160
|
+
@mouseover.native="showHelpText(0)"
|
|
161
|
+
@mouseout.native="hideHelpText(0)"
|
|
163
162
|
/>
|
|
164
163
|
</el-popover>
|
|
165
164
|
<el-popover
|
|
@@ -175,8 +174,8 @@
|
|
|
175
174
|
icon="zoomOut"
|
|
176
175
|
class="icon-button zoomOut"
|
|
177
176
|
@click.native="zoomOut()"
|
|
178
|
-
@mouseover.native="
|
|
179
|
-
@mouseout.native="
|
|
177
|
+
@mouseover.native="showHelpText(1)"
|
|
178
|
+
@mouseout.native="hideHelpText(1)"
|
|
180
179
|
/>
|
|
181
180
|
</el-popover>
|
|
182
181
|
<el-popover
|
|
@@ -196,8 +195,8 @@
|
|
|
196
195
|
icon="fitWindow"
|
|
197
196
|
class="icon-button fitWindow"
|
|
198
197
|
@click.native="fitWindow()"
|
|
199
|
-
@mouseover.native="
|
|
200
|
-
@mouseout.native="
|
|
198
|
+
@mouseover.native="showHelpText(2)"
|
|
199
|
+
@mouseout.native="hideHelpText(2)"
|
|
201
200
|
/>
|
|
202
201
|
</el-popover>
|
|
203
202
|
</div>
|
|
@@ -235,8 +234,8 @@
|
|
|
235
234
|
icon="changeBckgd"
|
|
236
235
|
class="icon-button background-colour"
|
|
237
236
|
:class="{ open: drawerOpen, close: !drawerOpen }"
|
|
238
|
-
@mouseover.native="
|
|
239
|
-
@mouseout.native="
|
|
237
|
+
@mouseover.native="showHelpText(3)"
|
|
238
|
+
@mouseout.native="hideHelpText(3)"
|
|
240
239
|
/>
|
|
241
240
|
</el-popover>
|
|
242
241
|
</div>
|
|
@@ -481,7 +480,8 @@ export default {
|
|
|
481
480
|
region: "",
|
|
482
481
|
visible: false,
|
|
483
482
|
x: 200,
|
|
484
|
-
y: 200
|
|
483
|
+
y: 200,
|
|
484
|
+
external: false,
|
|
485
485
|
},
|
|
486
486
|
fileFormat: "metadata",
|
|
487
487
|
};
|
|
@@ -560,10 +560,11 @@ export default {
|
|
|
560
560
|
this.availableBackground = ["white", "black", "lightskyblue"];
|
|
561
561
|
},
|
|
562
562
|
mounted: function() {
|
|
563
|
+
this.$refs.treeControls.setModule(this.$module);
|
|
563
564
|
let eventNotifier = new EventNotifier();
|
|
564
565
|
eventNotifier.subscribe(this, this.eventNotifierCallback);
|
|
565
566
|
this.$module.addNotifier(eventNotifier);
|
|
566
|
-
this.$module.addOrganPartAddedCallback(this.
|
|
567
|
+
this.$module.addOrganPartAddedCallback(this.zincObjectAdded);
|
|
567
568
|
this.$module.initialiseRenderer(this.$refs.display);
|
|
568
569
|
this.toggleRendering(this.render);
|
|
569
570
|
this.ro = new ResizeObserver(this.adjustLayout).observe(
|
|
@@ -578,10 +579,11 @@ export default {
|
|
|
578
579
|
},
|
|
579
580
|
methods: {
|
|
580
581
|
/**
|
|
581
|
-
* This is called when a new
|
|
582
|
+
* This is called when a new zinc object is read into the scene.
|
|
582
583
|
*/
|
|
583
|
-
|
|
584
|
+
zincObjectAdded: function(zincObject) {
|
|
584
585
|
this.loading = false;
|
|
586
|
+
this.$emit("zinc-object-added", zincObject);
|
|
585
587
|
},
|
|
586
588
|
/**
|
|
587
589
|
* This is called when Change backgspeedround colour button
|
|
@@ -703,7 +705,7 @@ export default {
|
|
|
703
705
|
viewRegion: function(names) {
|
|
704
706
|
const rootRegion = this.$module.scene.getRootRegion();
|
|
705
707
|
const groups = Array.isArray(names) ? names : [names];
|
|
706
|
-
const objects = findObjectsWithNames(rootRegion, groups, "");
|
|
708
|
+
const objects = findObjectsWithNames(rootRegion, groups, "", true);
|
|
707
709
|
let box = this.$module.scene.getBoundingBoxOfZincObjects(objects);
|
|
708
710
|
if (box) {
|
|
709
711
|
if (this.$module.isSyncControl()) {
|
|
@@ -765,6 +767,7 @@ export default {
|
|
|
765
767
|
/**
|
|
766
768
|
* Callback when a region is selected/highlighted.
|
|
767
769
|
* It will also update other controls.
|
|
770
|
+
*
|
|
768
771
|
*/
|
|
769
772
|
eventNotifierCallback: function(event) {
|
|
770
773
|
const names = [];
|
|
@@ -781,13 +784,18 @@ export default {
|
|
|
781
784
|
});
|
|
782
785
|
zincObjects = event.zincObjects;
|
|
783
786
|
}
|
|
787
|
+
/*
|
|
788
|
+
* Event Type 1: Selected
|
|
789
|
+
* Event Type 2: Highlighted
|
|
790
|
+
* Event Type 1: Move
|
|
791
|
+
*/
|
|
784
792
|
if (event.eventType == 1) {
|
|
785
|
-
if (this.$refs.
|
|
793
|
+
if (this.$refs.treeControls) {
|
|
786
794
|
if (names.length > 0) {
|
|
787
|
-
//this.$refs.
|
|
788
|
-
this.$refs.
|
|
795
|
+
//this.$refs.treeControls.changeActiveByNames(names, region, false);
|
|
796
|
+
this.$refs.treeControls.updateActiveUI(zincObjects);
|
|
789
797
|
} else {
|
|
790
|
-
this.$refs.
|
|
798
|
+
this.$refs.treeControls.removeActive(true)
|
|
791
799
|
}
|
|
792
800
|
}
|
|
793
801
|
// Triggers when an object has been selected
|
|
@@ -795,12 +803,12 @@ export default {
|
|
|
795
803
|
} else if (event.eventType == 2) {
|
|
796
804
|
this.tData.visible = false;
|
|
797
805
|
// const offsets = this.$refs.scaffoldContainer.getBoundingClientRect();
|
|
798
|
-
if (this.$refs.
|
|
806
|
+
if (this.$refs.treeControls) {
|
|
799
807
|
if (names.length > 0) {
|
|
800
|
-
//this.$refs.
|
|
801
|
-
this.$refs.
|
|
808
|
+
//this.$refs.treeControls.changeHoverByNames(names, region, false);
|
|
809
|
+
this.$refs.treeControls.updateHoverUI(zincObjects);
|
|
802
810
|
} else {
|
|
803
|
-
this.$refs.
|
|
811
|
+
this.$refs.treeControls.removeHover(true);
|
|
804
812
|
}
|
|
805
813
|
}
|
|
806
814
|
if ((event.identifiers.length > 0) && event.identifiers[0]) {
|
|
@@ -808,6 +816,7 @@ export default {
|
|
|
808
816
|
? event.identifiers[0].data.id
|
|
809
817
|
: event.identifiers[0].data.group;
|
|
810
818
|
if (event.identifiers[0].coords) {
|
|
819
|
+
this.tData.external = false;
|
|
811
820
|
this.tData.visible = true;
|
|
812
821
|
this.tData.label = id;
|
|
813
822
|
if (event.identifiers[0].data.region)
|
|
@@ -889,12 +898,12 @@ export default {
|
|
|
889
898
|
changeActiveByName: function(names, region, propagate) {
|
|
890
899
|
const isArray = Array.isArray(names);
|
|
891
900
|
if (names === undefined || (isArray && names.length === 0)) {
|
|
892
|
-
this.$refs.
|
|
901
|
+
this.$refs.treeControls.removeActive(propagate);
|
|
893
902
|
} else {
|
|
894
903
|
let array = names;
|
|
895
904
|
if (!isArray)
|
|
896
905
|
array = [array];
|
|
897
|
-
this.$refs.
|
|
906
|
+
this.$refs.treeControls.changeActiveByNames(array, region, propagate);
|
|
898
907
|
}
|
|
899
908
|
},
|
|
900
909
|
/**
|
|
@@ -905,12 +914,12 @@ export default {
|
|
|
905
914
|
changeHighlightedByName: function(names, region, propagate) {
|
|
906
915
|
const isArray = Array.isArray(names);
|
|
907
916
|
if (names === undefined || (isArray && names.length === 0)) {
|
|
908
|
-
this.$refs.
|
|
917
|
+
this.$refs.treeControls.removeHover(propagate);
|
|
909
918
|
} else {
|
|
910
919
|
let array = names;
|
|
911
920
|
if (!isArray)
|
|
912
921
|
array = [array];
|
|
913
|
-
this.$refs.
|
|
922
|
+
this.$refs.treeControls.changeHoverByNames(array, region, propagate);
|
|
914
923
|
}
|
|
915
924
|
},
|
|
916
925
|
/**
|
|
@@ -938,24 +947,82 @@ export default {
|
|
|
938
947
|
});
|
|
939
948
|
}
|
|
940
949
|
},
|
|
950
|
+
/**
|
|
951
|
+
* Callback function used by showRegionTooltip in the case when the tooltip
|
|
952
|
+
* is out of view.
|
|
953
|
+
*/
|
|
954
|
+
showRegionTooltipCallback: function(name) {
|
|
955
|
+
const instance = this;
|
|
956
|
+
return function() {
|
|
957
|
+
instance.$module.zincRenderer.removePostRenderCallbackFunction(instance.$_regionTooltipCallback);
|
|
958
|
+
instance.showRegionTooltip(name, false);
|
|
959
|
+
}
|
|
960
|
+
},
|
|
961
|
+
/**
|
|
962
|
+
* Display the tooltip. Reset view if the tooltip is not
|
|
963
|
+
* in view.
|
|
964
|
+
*/
|
|
965
|
+
showRegionTooltip: function(name, resetView) {
|
|
966
|
+
if (name && this.$module.scene) {
|
|
967
|
+
const rootRegion = this.$module.scene.getRootRegion();
|
|
968
|
+
const groups = [name];
|
|
969
|
+
const objects = findObjectsWithNames(rootRegion, groups, "", true);
|
|
970
|
+
if (objects.length > 0) {
|
|
971
|
+
let coords = objects[0].getClosestVertexDOMElementCoords(this.$module.scene);
|
|
972
|
+
if (coords) {
|
|
973
|
+
//The coords is not in view, view all if resetView flag is true
|
|
974
|
+
if (!coords.inView) {
|
|
975
|
+
this.hideRegionTooltip();
|
|
976
|
+
if (resetView) {
|
|
977
|
+
this.$module.scene.viewAll();
|
|
978
|
+
//Use the post render callback to make sure the scene has been updated
|
|
979
|
+
//before getting the position of the tooltip.
|
|
980
|
+
this.$_regionTooltipCallback =
|
|
981
|
+
this.$module.zincRenderer.addPostRenderCallbackFunction(
|
|
982
|
+
this.showRegionTooltipCallback(name)
|
|
983
|
+
);
|
|
984
|
+
}
|
|
985
|
+
return;
|
|
986
|
+
} else {
|
|
987
|
+
this.tData.external = true;
|
|
988
|
+
this.tData.visible = true;
|
|
989
|
+
this.tData.label = name;
|
|
990
|
+
this.tData.x = coords.position.x;
|
|
991
|
+
this.tData.y = coords.position.y;
|
|
992
|
+
const regionPath = objects[0].getRegion().getFullPath();
|
|
993
|
+
if (regionPath)
|
|
994
|
+
this.tData.region = regionPath;
|
|
995
|
+
else
|
|
996
|
+
this.tData.region = "Root";
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
} else {
|
|
1000
|
+
this.hideRegionTooltip();
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
},
|
|
1004
|
+
hideRegionTooltip: function() {
|
|
1005
|
+
this.tData.visible = false;
|
|
1006
|
+
this.tData.region = "Root";
|
|
1007
|
+
},
|
|
941
1008
|
/**
|
|
942
1009
|
* This is called when mouse cursor enters supported elements
|
|
943
1010
|
* with help tootltips.
|
|
944
1011
|
*/
|
|
945
|
-
|
|
1012
|
+
showHelpText: function(helpTextNumber) {
|
|
946
1013
|
if (!this.inHelp) {
|
|
947
|
-
this.
|
|
948
|
-
this.hoverVisabilities[
|
|
1014
|
+
this.helpTextWait = setTimeout(() => {
|
|
1015
|
+
this.hoverVisabilities[helpTextNumber].value = true;
|
|
949
1016
|
}, 500);
|
|
950
1017
|
}
|
|
951
1018
|
},
|
|
952
1019
|
/**
|
|
953
1020
|
* This is called when mouse cursor exits supported element..
|
|
954
1021
|
*/
|
|
955
|
-
|
|
1022
|
+
hideHelpText: function(helpTextNumber) {
|
|
956
1023
|
if (!this.inHelp) {
|
|
957
|
-
this.hoverVisabilities[
|
|
958
|
-
clearTimeout(this.
|
|
1024
|
+
this.hoverVisabilities[helpTextNumber].value = false;
|
|
1025
|
+
clearTimeout(this.helpTextWait);
|
|
959
1026
|
}
|
|
960
1027
|
},
|
|
961
1028
|
/**
|
|
@@ -998,7 +1065,7 @@ export default {
|
|
|
998
1065
|
if (options.visibility) {
|
|
999
1066
|
// Some UIs may not be ready at this time.
|
|
1000
1067
|
this.$nextTick(() => {
|
|
1001
|
-
this.$refs.
|
|
1068
|
+
this.$refs.treeControls.setState(options.visibility);
|
|
1002
1069
|
});
|
|
1003
1070
|
}
|
|
1004
1071
|
}
|
|
@@ -1023,8 +1090,8 @@ export default {
|
|
|
1023
1090
|
viewport: undefined,
|
|
1024
1091
|
visibility: undefined,
|
|
1025
1092
|
};
|
|
1026
|
-
if (this.$refs.
|
|
1027
|
-
state.visibility = this.$refs.
|
|
1093
|
+
if (this.$refs.treeControls)
|
|
1094
|
+
state.visibility = this.$refs.treeControls.getState();
|
|
1028
1095
|
if (this.$module.scene) {
|
|
1029
1096
|
let zincCameraControls = this.$module.scene.getZincCameraControls();
|
|
1030
1097
|
state.viewport = zincCameraControls.getCurrentViewport();
|
|
@@ -1053,7 +1120,7 @@ export default {
|
|
|
1053
1120
|
.getZincCameraControls()
|
|
1054
1121
|
.setCurrentCameraSettings(state.viewport);
|
|
1055
1122
|
if (state.visibility)
|
|
1056
|
-
this.$refs.
|
|
1123
|
+
this.$refs.treeControls.setState(state.visibility);
|
|
1057
1124
|
} else {
|
|
1058
1125
|
this.$module.setFinishDownloadCallback(
|
|
1059
1126
|
this.setURLFinishCallback({
|
|
@@ -1083,8 +1150,8 @@ export default {
|
|
|
1083
1150
|
let visibility =
|
|
1084
1151
|
state && state.visibility ? state.visibility : undefined;
|
|
1085
1152
|
this._currentURL = newValue;
|
|
1086
|
-
if (this.$refs.
|
|
1087
|
-
this.$refs.
|
|
1153
|
+
if (this.$refs.treeControls)
|
|
1154
|
+
this.$refs.treeControls.clear();
|
|
1088
1155
|
this.loading = true;
|
|
1089
1156
|
this.isReady = false;
|
|
1090
1157
|
this.$module.setFinishDownloadCallback(
|
|
@@ -1157,6 +1224,9 @@ export default {
|
|
|
1157
1224
|
},
|
|
1158
1225
|
syncControlCallback: function() {
|
|
1159
1226
|
const payload = this.$module.NDCCameraControl.getPanZoom();
|
|
1227
|
+
if (this.tData.visible) {
|
|
1228
|
+
this.showRegionTooltip(this.tData.label);
|
|
1229
|
+
}
|
|
1160
1230
|
this.$emit("scaffold-navigated", payload);
|
|
1161
1231
|
},
|
|
1162
1232
|
/**
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
:data="treeData"
|
|
22
22
|
:default-checked-keys="['__r/']"
|
|
23
23
|
:expand-on-click-node="false"
|
|
24
|
-
:
|
|
24
|
+
:render-after-expand="false"
|
|
25
25
|
@check="checkChanged"
|
|
26
26
|
>
|
|
27
27
|
<span
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
@mouseover="changeHoverByNode(data, true)"
|
|
36
36
|
>
|
|
37
37
|
<el-color-picker
|
|
38
|
-
v-if="data.
|
|
38
|
+
v-if="data.isPrimitives"
|
|
39
39
|
:class="{ 'show-picker': showColourPicker }"
|
|
40
40
|
:value="getColour(data)"
|
|
41
41
|
size="small"
|
|
@@ -92,13 +92,6 @@ const nameSorting = (a, b) => {
|
|
|
92
92
|
export default {
|
|
93
93
|
name: "TreeControls",
|
|
94
94
|
props: {
|
|
95
|
-
/**
|
|
96
|
-
* @ignore
|
|
97
|
-
*/
|
|
98
|
-
module: {
|
|
99
|
-
type: Object,
|
|
100
|
-
default: undefined,
|
|
101
|
-
},
|
|
102
95
|
/**
|
|
103
96
|
* Enable/disable colour picker
|
|
104
97
|
*/
|
|
@@ -122,22 +115,6 @@ export default {
|
|
|
122
115
|
},
|
|
123
116
|
},
|
|
124
117
|
},
|
|
125
|
-
created: function () {
|
|
126
|
-
this.module.sceneData.geometries.forEach(zincObject => {
|
|
127
|
-
this.zincObjectAdded(zincObject);
|
|
128
|
-
});
|
|
129
|
-
this.module.sceneData.lines.forEach(zincObject => {
|
|
130
|
-
this.zincObjectAdded(zincObject);
|
|
131
|
-
});
|
|
132
|
-
this.module.sceneData.glyphsets.forEach(zincObject => {
|
|
133
|
-
this.zincObjectAdded(zincObject);
|
|
134
|
-
});
|
|
135
|
-
this.module.sceneData.pointsets.forEach(zincObject => {
|
|
136
|
-
this.zincObjectAdded(zincObject);
|
|
137
|
-
});
|
|
138
|
-
this.module.addOrganPartAddedCallback(this.zincObjectAdded);
|
|
139
|
-
this.__nodeNumbers = 1;
|
|
140
|
-
},
|
|
141
118
|
destroyed: function () {
|
|
142
119
|
this.sortedPrimitiveGroups = undefined;
|
|
143
120
|
},
|
|
@@ -146,8 +123,7 @@ export default {
|
|
|
146
123
|
//The following block prevent duplicate graphics with the same name
|
|
147
124
|
for (let i = 0; i < parentContainer.length; i++) {
|
|
148
125
|
if (parentContainer[i].id === item.id) {
|
|
149
|
-
if (item.
|
|
150
|
-
parentContainer[i].primitives.push(...item.primitives);
|
|
126
|
+
if (item.isPrimitives && parentContainer[i].isPrimitives) {
|
|
151
127
|
return;
|
|
152
128
|
}
|
|
153
129
|
}
|
|
@@ -165,10 +141,10 @@ export default {
|
|
|
165
141
|
// '__r/'
|
|
166
142
|
findOrCreateRegion: function (data, paths, prefix) {
|
|
167
143
|
//check if root region has been set
|
|
168
|
-
if (
|
|
169
|
-
this.treeData[0].
|
|
144
|
+
if ((this.treeData[0].regionPath === undefined) && this.$module && this.$module.scene) {
|
|
145
|
+
this.treeData[0].regionPath = "";
|
|
146
|
+
this.treeData[0].isRegion = true;
|
|
170
147
|
}
|
|
171
|
-
|
|
172
148
|
if (paths.length > 0) {
|
|
173
149
|
const _paths = [...paths];
|
|
174
150
|
let childRegion = data.children.find(
|
|
@@ -177,12 +153,12 @@ export default {
|
|
|
177
153
|
const path = prefix + "/" + paths[0];
|
|
178
154
|
const id = "__r" + path;
|
|
179
155
|
if (!childRegion) {
|
|
180
|
-
const region = this.treeData[0].region.findChildFromPath(path);
|
|
181
156
|
childRegion = {
|
|
182
157
|
label: _paths[0],
|
|
183
158
|
id: id,
|
|
184
159
|
children: [],
|
|
185
|
-
|
|
160
|
+
regionPath: path,
|
|
161
|
+
isRegion: true,
|
|
186
162
|
};
|
|
187
163
|
this.addTreeItem(data.children, childRegion);
|
|
188
164
|
}
|
|
@@ -232,7 +208,7 @@ export default {
|
|
|
232
208
|
const child = {
|
|
233
209
|
label: zincObject.groupName,
|
|
234
210
|
id: id,
|
|
235
|
-
|
|
211
|
+
isPrimitives: true,
|
|
236
212
|
regionPath: zincObject.region.getFullPath(),
|
|
237
213
|
};
|
|
238
214
|
this.addTreeItem(regionData.children, child);
|
|
@@ -241,15 +217,19 @@ export default {
|
|
|
241
217
|
}
|
|
242
218
|
},
|
|
243
219
|
checkChanged: function (node, data) {
|
|
244
|
-
const isRegion = node.
|
|
245
|
-
const isPrimitives = node.
|
|
220
|
+
const isRegion = node.isRegion;
|
|
221
|
+
const isPrimitives = node.isPrimitives;
|
|
246
222
|
const isChecked = data.checkedKeys.includes(node.id);
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
223
|
+
const region = this.$module.scene.getRootRegion().findChildFromPath(node.regionPath);
|
|
224
|
+
if (isRegion) {
|
|
225
|
+
isChecked ? region.showAllPrimitives() : region.hideAllPrimitives();
|
|
226
|
+
}
|
|
227
|
+
if (isPrimitives) {
|
|
228
|
+
const primitives = region.findObjectsWithGroupName(node.label);
|
|
229
|
+
primitives.forEach(primitive => {
|
|
251
230
|
primitive.setVisibility(isChecked);
|
|
252
231
|
});
|
|
232
|
+
}
|
|
253
233
|
},
|
|
254
234
|
updateActiveUI: function (primitives) {
|
|
255
235
|
this.active.length = 0;
|
|
@@ -280,27 +260,31 @@ export default {
|
|
|
280
260
|
* Select a region by its name.
|
|
281
261
|
*/
|
|
282
262
|
changeActiveByNames: function (names, regionPath, propagate) {
|
|
283
|
-
const rootRegion = this
|
|
263
|
+
const rootRegion = this.$module.scene.getRootRegion();
|
|
284
264
|
const targetObjects = findObjectsWithNames(rootRegion, names,
|
|
285
|
-
regionPath);
|
|
265
|
+
regionPath, true);
|
|
286
266
|
this.changeActiveByPrimitives(targetObjects, propagate);
|
|
287
267
|
},
|
|
288
268
|
/**
|
|
289
269
|
* Hover a region by its name.
|
|
290
270
|
*/
|
|
291
271
|
changeHoverByNames: function (names, regionPath, propagate) {
|
|
292
|
-
const rootRegion = this
|
|
272
|
+
const rootRegion = this.$module.scene.getRootRegion();
|
|
293
273
|
const targetObjects = findObjectsWithNames(rootRegion, names,
|
|
294
|
-
regionPath);
|
|
274
|
+
regionPath, true);
|
|
295
275
|
this.changeHoverByPrimitives(targetObjects, propagate);
|
|
296
276
|
},
|
|
297
277
|
changeActiveByNode: function (node, propagate) {
|
|
298
|
-
if (node.
|
|
299
|
-
this.
|
|
278
|
+
if (node.isPrimitives) {
|
|
279
|
+
const targetObjects = this.getZincObjectsFromNode(node, false);
|
|
280
|
+
this.changeActiveByPrimitives(targetObjects, propagate);
|
|
281
|
+
}
|
|
300
282
|
},
|
|
301
283
|
changeHoverByNode: function (node, propagate) {
|
|
302
|
-
if (node.
|
|
303
|
-
this.
|
|
284
|
+
if (node.isPrimitives) {
|
|
285
|
+
const targetObjects = this.getZincObjectsFromNode(node, false);
|
|
286
|
+
this.changeHoverByPrimitives(targetObjects, propagate);
|
|
287
|
+
}
|
|
304
288
|
},
|
|
305
289
|
/**
|
|
306
290
|
* Unselect the current selected region.
|
|
@@ -328,8 +312,10 @@ export default {
|
|
|
328
312
|
this.$emit("object-selected", undefined);
|
|
329
313
|
},
|
|
330
314
|
getColour: function (nodeData) {
|
|
315
|
+
//Do not need to check for primitives as this is checked on the template
|
|
331
316
|
if (nodeData) {
|
|
332
|
-
|
|
317
|
+
const targetObjects = this.getZincObjectsFromNode(nodeData, false);
|
|
318
|
+
let graphic = targetObjects[0];
|
|
333
319
|
if (graphic) {
|
|
334
320
|
let hex = graphic.getColourHex();
|
|
335
321
|
if (hex) return "#" + hex;
|
|
@@ -337,19 +323,43 @@ export default {
|
|
|
337
323
|
}
|
|
338
324
|
return "#FFFFFF";
|
|
339
325
|
},
|
|
326
|
+
getZincObjectsFromNode: function(node, transverse) {
|
|
327
|
+
const rootRegion = this.$module.scene.getRootRegion();
|
|
328
|
+
return findObjectsWithNames(rootRegion, node.label,
|
|
329
|
+
node.regionPath, transverse);
|
|
330
|
+
},
|
|
331
|
+
//Set this right at the beginning.
|
|
332
|
+
setModule: function (moduleIn) {
|
|
333
|
+
this.$module = moduleIn;
|
|
334
|
+
this.$module.primitiveData.geometries.forEach(zincObject => {
|
|
335
|
+
this.zincObjectAdded(zincObject);
|
|
336
|
+
});
|
|
337
|
+
this.$module.primitiveData.lines.forEach(zincObject => {
|
|
338
|
+
this.zincObjectAdded(zincObject);
|
|
339
|
+
});
|
|
340
|
+
this.$module.primitiveData.glyphsets.forEach(zincObject => {
|
|
341
|
+
this.zincObjectAdded(zincObject);
|
|
342
|
+
});
|
|
343
|
+
this.$module.primitiveData.pointsets.forEach(zincObject => {
|
|
344
|
+
this.zincObjectAdded(zincObject);
|
|
345
|
+
});
|
|
346
|
+
this.$module.addOrganPartAddedCallback(this.zincObjectAdded);
|
|
347
|
+
this.__nodeNumbers = 1;
|
|
348
|
+
},
|
|
340
349
|
setColour: function (nodeData, value) {
|
|
341
|
-
if (nodeData && nodeData.
|
|
342
|
-
|
|
350
|
+
if (nodeData && nodeData.isPrimitives) {
|
|
351
|
+
const targetObjects = this.getZincObjectsFromNode(nodeData, false);
|
|
352
|
+
targetObjects.forEach(primitive => {
|
|
343
353
|
let hexString = value.replace("#", "0x");
|
|
344
354
|
primitive.setColourHex(hexString);
|
|
345
355
|
});
|
|
346
356
|
}
|
|
347
357
|
},
|
|
348
358
|
viewAll: function () {
|
|
349
|
-
this
|
|
359
|
+
this.$module.viewAll();
|
|
350
360
|
},
|
|
351
361
|
visibilityToggle: function (item, event) {
|
|
352
|
-
this
|
|
362
|
+
this.$module.changeOrganPartsVisibility(item, event);
|
|
353
363
|
if (event == false) {
|
|
354
364
|
if (this.activeRegion === item) {
|
|
355
365
|
this.removeActive(true);
|
|
@@ -366,9 +376,15 @@ export default {
|
|
|
366
376
|
setTreeVisibility: function(node, list) {
|
|
367
377
|
let flag = false;
|
|
368
378
|
if (list.includes(node.id)) flag = true;
|
|
369
|
-
|
|
370
|
-
if (node.
|
|
371
|
-
|
|
379
|
+
const region = this.$module.scene.getRootRegion().findChildFromPath(node.regionPath);
|
|
380
|
+
if (node.isRegion)
|
|
381
|
+
region.setVisibility(flag);
|
|
382
|
+
if (node.isPrimitives) {
|
|
383
|
+
const primitives = region.findObjectsWithGroupName(node.label);
|
|
384
|
+
primitives.forEach(primitive => primitive.setVisibility(flag))
|
|
385
|
+
}
|
|
386
|
+
if (node.children)
|
|
387
|
+
node.children.forEach(child => this.setTreeVisibility(child, list));
|
|
372
388
|
},
|
|
373
389
|
checkAllKeys: function () {
|
|
374
390
|
const keysList = [];
|
|
@@ -10,8 +10,8 @@ const createRenderer = function () {
|
|
|
10
10
|
const localContainer = document.createElement( 'div' );
|
|
11
11
|
let localRenderer = undefined;;
|
|
12
12
|
localContainer.style.height = "100%";
|
|
13
|
+
const Zinc = require('zincjs');
|
|
13
14
|
if (WEBGL.isWebGLAvailable()) {
|
|
14
|
-
const Zinc = require('zincjs');
|
|
15
15
|
localRenderer = new Zinc.Renderer(localContainer, window);
|
|
16
16
|
Zinc.defaultMaterialColor = 0xFFFF9C;
|
|
17
17
|
localRenderer.initialiseVisualisation();
|
|
@@ -20,7 +20,7 @@ const createRenderer = function () {
|
|
|
20
20
|
const warning = WEBGL.getWebGLErrorMessage();
|
|
21
21
|
localContainer.appendChild(warning);
|
|
22
22
|
}
|
|
23
|
-
return {"renderer":localRenderer, "container":localContainer};
|
|
23
|
+
return {Zinc, "renderer":localRenderer, "container":localContainer};
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
const RendererModule = function() {
|
|
@@ -264,6 +264,7 @@ RendererModule.prototype.getPlayRate = function(value) {
|
|
|
264
264
|
RendererModule.prototype.initialiseRenderer = function(displayAreaIn) {
|
|
265
265
|
if (this.zincRenderer === undefined || this.rendererContainer === undefined) {
|
|
266
266
|
let returnedValue = createRenderer();
|
|
267
|
+
this.Zinc = returnedValue["Zinc"];
|
|
267
268
|
this.zincRenderer = returnedValue["renderer"];
|
|
268
269
|
this.rendererContainer = returnedValue["container"];
|
|
269
270
|
}
|
|
@@ -60,7 +60,7 @@ exports.GraphicsHighlight = function() {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
this.setHighlighted = function(objects) {
|
|
63
|
-
const previousHighlightedObjects = currentHighlightedObjects;
|
|
63
|
+
const previousHighlightedObjects = [...currentHighlightedObjects];
|
|
64
64
|
_this.resetHighlighted();
|
|
65
65
|
// Selected object cannot be highlighted
|
|
66
66
|
const array = getUnmatchingObjects(objects, currentSelectedObjects);
|
|
@@ -75,9 +75,9 @@ exports.GraphicsHighlight = function() {
|
|
|
75
75
|
|
|
76
76
|
this.setSelected = function(objects) {
|
|
77
77
|
// first find highlighted object that are not selected
|
|
78
|
-
const previousHSelectedObjects = currentSelectedObjects;
|
|
78
|
+
const previousHSelectedObjects = [...currentSelectedObjects];
|
|
79
79
|
const array = getUnmatchingObjects(currentHighlightedObjects, objects);
|
|
80
|
-
|
|
80
|
+
_this.resetHighlighted();
|
|
81
81
|
_this.resetSelected();
|
|
82
82
|
const fullList = getFullListOfObjects(objects);
|
|
83
83
|
for (let i = 0; i < fullList.length; i++) {
|