@abi-software/scaffoldvuer 0.1.52-beta.5 → 0.1.53-beta.2
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 +22311 -1865
- package/dist/scaffoldvuer.common.js.map +1 -1
- package/dist/scaffoldvuer.css +1 -1
- package/dist/scaffoldvuer.umd.js +22262 -1816
- 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 +4377 -7541
- package/package.json +4 -4
- package/src/App.vue +20 -7
- package/src/components/DropZone.vue +25 -3
- package/src/components/ScaffoldTooltip.vue +33 -33
- package/src/components/ScaffoldVuer.vue +102 -59
- package/src/components/TreeControls.vue +69 -67
- package/src/scripts/RendererModule.js +22 -7
- package/src/scripts/organsRenderer.js +38 -5
- package/src/scripts/utilities.js +34 -0
- package/vue.config.js +1 -1
- package/src/components/TraditionalControls.vue +0 -545
|
@@ -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);
|
|
@@ -472,14 +474,15 @@ const OrgansSceneData = function() {
|
|
|
472
474
|
_this.sceneData.currentName = name;
|
|
473
475
|
}
|
|
474
476
|
|
|
475
|
-
this.loadOrgansFromURL = function(url, speciesName, systemName, partName, viewURL) {
|
|
477
|
+
this.loadOrgansFromURL = function(url, speciesName, systemName, partName, viewURL, clearFirst) {
|
|
476
478
|
if (_this.zincRenderer) {
|
|
477
479
|
if (partName && (_this.sceneData.metaURL !== url)) {
|
|
478
480
|
setSceneData(speciesName, systemName, partName, undefined);
|
|
479
481
|
const name = _this.sceneData.currentName;
|
|
480
482
|
let organScene = _this.zincRenderer.getSceneByName(name);
|
|
481
483
|
if (organScene) {
|
|
482
|
-
|
|
484
|
+
if (clearFirst)
|
|
485
|
+
organScene.clearAll();
|
|
483
486
|
} else {
|
|
484
487
|
organScene = _this.zincRenderer.createScene(name);
|
|
485
488
|
}
|
|
@@ -505,6 +508,36 @@ const OrgansSceneData = function() {
|
|
|
505
508
|
}
|
|
506
509
|
}
|
|
507
510
|
}
|
|
511
|
+
|
|
512
|
+
this.loadGLTFFromURL = function(url, partName, clearFirst) {
|
|
513
|
+
if (_this.zincRenderer) {
|
|
514
|
+
if (partName && (_this.sceneData.metaURL !== url)) {
|
|
515
|
+
setSceneData(undefined, undefined, partName, undefined);
|
|
516
|
+
const name = _this.sceneData.currentName;
|
|
517
|
+
let organScene = _this.zincRenderer.getSceneByName(name);
|
|
518
|
+
if (organScene) {
|
|
519
|
+
if (clearFirst)
|
|
520
|
+
organScene.clearAll();
|
|
521
|
+
} else {
|
|
522
|
+
organScene = _this.zincRenderer.createScene(name);
|
|
523
|
+
}
|
|
524
|
+
for (let i = 0; i < sceneChangedCallbacks.length;i++) {
|
|
525
|
+
sceneChangedCallbacks[i](_this.sceneData);
|
|
526
|
+
}
|
|
527
|
+
_this.sceneData.viewURL = undefined;
|
|
528
|
+
_this.sceneData.metaURL = url;
|
|
529
|
+
organScene.loadGLTF(url, _addOrganPartCallback(undefined, partName, false),
|
|
530
|
+
downloadCompletedCallback());
|
|
531
|
+
_this.scene = organScene;
|
|
532
|
+
_this.zincRenderer.setCurrentScene(organScene);
|
|
533
|
+
_this.graphicsHighlight.reset();
|
|
534
|
+
const zincCameraControl = organScene.getZincCameraControls();
|
|
535
|
+
zincCameraControl.enableRaycaster(organScene, _pickingCallback(), _hoverCallback());
|
|
536
|
+
zincCameraControl.setMouseButtonAction("AUXILIARY", "ZOOM");
|
|
537
|
+
zincCameraControl.setMouseButtonAction("SECONDARY", "PAN");
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
508
541
|
|
|
509
542
|
this.alignCameraWithSelectedObject = function(transitionTime) {
|
|
510
543
|
const objects = _this.graphicsHighlight.getSelected();
|
|
@@ -534,7 +567,7 @@ const OrgansSceneData = function() {
|
|
|
534
567
|
_this.setName(settings.name);
|
|
535
568
|
if (settings.metaURL !== undefined && settings.metaURL != "") {
|
|
536
569
|
_this.loadOrgansFromURL(settings.metaURL, settings.species,
|
|
537
|
-
|
|
570
|
+
settings.system, settings.part, settings.viewURL, true);
|
|
538
571
|
} else {
|
|
539
572
|
_this.loadOrgans(settings.species, settings.system, settings.part);
|
|
540
573
|
}
|
|
@@ -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
|
+
}
|
package/vue.config.js
CHANGED
|
@@ -3,7 +3,7 @@ const nodeExternals = require('webpack-node-externals');
|
|
|
3
3
|
module.exports = {
|
|
4
4
|
configureWebpack: config => {
|
|
5
5
|
if(process.env.NODE_ENV === 'production') {
|
|
6
|
-
config.externals = [ nodeExternals() ];
|
|
6
|
+
config.externals = [ nodeExternals({allowlist: [/^element-ui/]}) ];
|
|
7
7
|
}
|
|
8
8
|
},
|
|
9
9
|
chainWebpack: config => {
|