@abi-software/scaffoldvuer 0.2.1 → 0.2.2-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/CHANGELOG.md +18 -1
- package/dist/scaffoldvuer-wc.common.js +44 -22
- package/dist/scaffoldvuer-wc.umd.js +44 -22
- package/dist/scaffoldvuer-wc.umd.min.js +44 -22
- package/dist/scaffoldvuer.common.js +214 -98
- package/dist/scaffoldvuer.common.js.map +1 -1
- package/dist/scaffoldvuer.css +1 -1
- package/dist/scaffoldvuer.umd.js +214 -98
- 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 +4 -4
- package/package.json +2 -2
- package/src/App.vue +6 -0
- package/src/components/ScaffoldVuer.vue +310 -179
- package/src/components/TreeControls.vue +76 -38
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
<el-tree
|
|
16
16
|
ref="regionTree"
|
|
17
17
|
node-key="id"
|
|
18
|
+
v-loading="!isReady"
|
|
18
19
|
show-checkbox
|
|
20
|
+
element-loading-spinner="el-icon-loading"
|
|
21
|
+
element-loading-background="rgba(0, 0, 0, 0.3)"
|
|
19
22
|
:check-strictly="false"
|
|
20
23
|
:data="treeData[0].children"
|
|
21
24
|
:expand-on-click-node="false"
|
|
@@ -58,10 +61,21 @@
|
|
|
58
61
|
<script>
|
|
59
62
|
/* eslint-disable no-alert, no-console */
|
|
60
63
|
import Vue from "vue";
|
|
61
|
-
import {
|
|
64
|
+
import {
|
|
65
|
+
Checkbox,
|
|
66
|
+
CheckboxGroup,
|
|
67
|
+
ColorPicker,
|
|
68
|
+
Loading,
|
|
69
|
+
Row,
|
|
70
|
+
Tree,
|
|
71
|
+
} from "element-ui";
|
|
62
72
|
import lang from "element-ui/lib/locale/lang/en";
|
|
63
73
|
import locale from "element-ui/lib/locale";
|
|
64
|
-
import {
|
|
74
|
+
import {
|
|
75
|
+
createListFromPrimitives,
|
|
76
|
+
extractAllIds,
|
|
77
|
+
findObjectsWithNames,
|
|
78
|
+
} from "../scripts/utilities.js";
|
|
65
79
|
|
|
66
80
|
const orderBy = require("lodash/orderBy");
|
|
67
81
|
const uniq = require("lodash/uniq");
|
|
@@ -69,6 +83,7 @@ locale.use(lang);
|
|
|
69
83
|
Vue.use(Checkbox);
|
|
70
84
|
Vue.use(CheckboxGroup);
|
|
71
85
|
Vue.use(ColorPicker);
|
|
86
|
+
Vue.use(Loading);
|
|
72
87
|
Vue.use(Row);
|
|
73
88
|
Vue.use(Tree);
|
|
74
89
|
|
|
@@ -94,12 +109,13 @@ export default {
|
|
|
94
109
|
* Enable/disable colour picker
|
|
95
110
|
*/
|
|
96
111
|
showColourPicker: Boolean,
|
|
112
|
+
isReady: Boolean,
|
|
97
113
|
},
|
|
98
114
|
data: function () {
|
|
99
115
|
return {
|
|
100
116
|
treeData: [{ label: "Root", id: "__r/", children: [] }],
|
|
101
|
-
active: [{group: "", regionPath: undefined}],
|
|
102
|
-
hover: [{group: "", regionPath: undefined}],
|
|
117
|
+
active: [{ group: "", regionPath: undefined }],
|
|
118
|
+
hover: [{ group: "", regionPath: undefined }],
|
|
103
119
|
myPopperClass: "hide-scaffold-colour-popup",
|
|
104
120
|
drawerOpen: true,
|
|
105
121
|
};
|
|
@@ -139,7 +155,11 @@ export default {
|
|
|
139
155
|
// '__r/'
|
|
140
156
|
findOrCreateRegion: function (data, paths, prefix) {
|
|
141
157
|
//check if root region has been set
|
|
142
|
-
if (
|
|
158
|
+
if (
|
|
159
|
+
this.treeData[0].regionPath === undefined &&
|
|
160
|
+
this.$module &&
|
|
161
|
+
this.$module.scene
|
|
162
|
+
) {
|
|
143
163
|
this.treeData[0].regionPath = "";
|
|
144
164
|
this.treeData[0].isRegion = true;
|
|
145
165
|
}
|
|
@@ -166,23 +186,25 @@ export default {
|
|
|
166
186
|
return data;
|
|
167
187
|
}
|
|
168
188
|
},
|
|
169
|
-
nodeIsActive: function(data) {
|
|
189
|
+
nodeIsActive: function (data) {
|
|
170
190
|
for (let i = 0; i < this.active.length; i++) {
|
|
171
191
|
let item = this.active[i];
|
|
172
|
-
if (
|
|
173
|
-
|
|
174
|
-
item.regionPath === undefined)
|
|
192
|
+
if (
|
|
193
|
+
item.group === data.label &&
|
|
194
|
+
(item.regionPath === data.regionPath || item.regionPath === undefined)
|
|
195
|
+
) {
|
|
175
196
|
return true;
|
|
176
197
|
}
|
|
177
198
|
}
|
|
178
199
|
return false;
|
|
179
200
|
},
|
|
180
|
-
nodeIsHover: function(data) {
|
|
201
|
+
nodeIsHover: function (data) {
|
|
181
202
|
for (let i = 0; i < this.hover.length; i++) {
|
|
182
203
|
let item = this.hover[i];
|
|
183
|
-
if (
|
|
184
|
-
|
|
185
|
-
item.regionPath === undefined)
|
|
204
|
+
if (
|
|
205
|
+
item.group === data.label &&
|
|
206
|
+
(item.regionPath === data.regionPath || item.regionPath === undefined)
|
|
207
|
+
) {
|
|
186
208
|
return true;
|
|
187
209
|
}
|
|
188
210
|
}
|
|
@@ -218,13 +240,15 @@ export default {
|
|
|
218
240
|
const isRegion = node.isRegion;
|
|
219
241
|
const isPrimitives = node.isPrimitives;
|
|
220
242
|
const isChecked = data.checkedKeys.includes(node.id);
|
|
221
|
-
const region = this.$module.scene
|
|
243
|
+
const region = this.$module.scene
|
|
244
|
+
.getRootRegion()
|
|
245
|
+
.findChildFromPath(node.regionPath);
|
|
222
246
|
if (isRegion) {
|
|
223
247
|
isChecked ? region.showAllPrimitives() : region.hideAllPrimitives();
|
|
224
248
|
}
|
|
225
249
|
if (isPrimitives) {
|
|
226
250
|
const primitives = region.findObjectsWithGroupName(node.label);
|
|
227
|
-
primitives.forEach(primitive => {
|
|
251
|
+
primitives.forEach((primitive) => {
|
|
228
252
|
primitive.setVisibility(isChecked);
|
|
229
253
|
});
|
|
230
254
|
}
|
|
@@ -259,8 +283,12 @@ export default {
|
|
|
259
283
|
*/
|
|
260
284
|
changeActiveByNames: function (names, regionPath, propagate) {
|
|
261
285
|
const rootRegion = this.$module.scene.getRootRegion();
|
|
262
|
-
const targetObjects = findObjectsWithNames(
|
|
263
|
-
|
|
286
|
+
const targetObjects = findObjectsWithNames(
|
|
287
|
+
rootRegion,
|
|
288
|
+
names,
|
|
289
|
+
regionPath,
|
|
290
|
+
true
|
|
291
|
+
);
|
|
264
292
|
this.changeActiveByPrimitives(targetObjects, propagate);
|
|
265
293
|
},
|
|
266
294
|
/**
|
|
@@ -268,8 +296,12 @@ export default {
|
|
|
268
296
|
*/
|
|
269
297
|
changeHoverByNames: function (names, regionPath, propagate) {
|
|
270
298
|
const rootRegion = this.$module.scene.getRootRegion();
|
|
271
|
-
const targetObjects = findObjectsWithNames(
|
|
272
|
-
|
|
299
|
+
const targetObjects = findObjectsWithNames(
|
|
300
|
+
rootRegion,
|
|
301
|
+
names,
|
|
302
|
+
regionPath,
|
|
303
|
+
true
|
|
304
|
+
);
|
|
273
305
|
this.changeHoverByPrimitives(targetObjects, propagate);
|
|
274
306
|
},
|
|
275
307
|
changeActiveByNode: function (node, propagate) {
|
|
@@ -306,7 +338,7 @@ export default {
|
|
|
306
338
|
this.active.regionPath = undefined;
|
|
307
339
|
this.hover.group = "";
|
|
308
340
|
this.hover.regionPath = undefined;
|
|
309
|
-
this.$refs.regionTree.updateKeyChildren(
|
|
341
|
+
this.$refs.regionTree.updateKeyChildren("__r/", []);
|
|
310
342
|
this.treeData[0].children.length = 0;
|
|
311
343
|
this.$emit("object-selected", undefined);
|
|
312
344
|
},
|
|
@@ -322,24 +354,28 @@ export default {
|
|
|
322
354
|
}
|
|
323
355
|
return "#FFFFFF";
|
|
324
356
|
},
|
|
325
|
-
getZincObjectsFromNode: function(node, transverse) {
|
|
357
|
+
getZincObjectsFromNode: function (node, transverse) {
|
|
326
358
|
const rootRegion = this.$module.scene.getRootRegion();
|
|
327
|
-
return findObjectsWithNames(
|
|
328
|
-
|
|
359
|
+
return findObjectsWithNames(
|
|
360
|
+
rootRegion,
|
|
361
|
+
node.label,
|
|
362
|
+
node.regionPath,
|
|
363
|
+
transverse
|
|
364
|
+
);
|
|
329
365
|
},
|
|
330
366
|
//Set this right at the beginning.
|
|
331
367
|
setModule: function (moduleIn) {
|
|
332
368
|
this.$module = moduleIn;
|
|
333
|
-
this.$module.primitiveData.geometries.forEach(zincObject => {
|
|
369
|
+
this.$module.primitiveData.geometries.forEach((zincObject) => {
|
|
334
370
|
this.zincObjectAdded(zincObject);
|
|
335
371
|
});
|
|
336
|
-
this.$module.primitiveData.lines.forEach(zincObject => {
|
|
372
|
+
this.$module.primitiveData.lines.forEach((zincObject) => {
|
|
337
373
|
this.zincObjectAdded(zincObject);
|
|
338
374
|
});
|
|
339
|
-
this.$module.primitiveData.glyphsets.forEach(zincObject => {
|
|
375
|
+
this.$module.primitiveData.glyphsets.forEach((zincObject) => {
|
|
340
376
|
this.zincObjectAdded(zincObject);
|
|
341
377
|
});
|
|
342
|
-
this.$module.primitiveData.pointsets.forEach(zincObject => {
|
|
378
|
+
this.$module.primitiveData.pointsets.forEach((zincObject) => {
|
|
343
379
|
this.zincObjectAdded(zincObject);
|
|
344
380
|
});
|
|
345
381
|
this.$module.addOrganPartAddedCallback(this.zincObjectAdded);
|
|
@@ -348,7 +384,7 @@ export default {
|
|
|
348
384
|
setColour: function (nodeData, value) {
|
|
349
385
|
if (nodeData && nodeData.isPrimitives) {
|
|
350
386
|
const targetObjects = this.getZincObjectsFromNode(nodeData, false);
|
|
351
|
-
targetObjects.forEach(primitive => {
|
|
387
|
+
targetObjects.forEach((primitive) => {
|
|
352
388
|
let hexString = value.replace("#", "0x");
|
|
353
389
|
primitive.setColourHex(hexString);
|
|
354
390
|
});
|
|
@@ -372,18 +408,19 @@ export default {
|
|
|
372
408
|
this.drawerOpen = !this.drawerOpen;
|
|
373
409
|
this.$emit("drawer-toggled", this.drawerOpen);
|
|
374
410
|
},
|
|
375
|
-
setTreeVisibility: function(node, list) {
|
|
411
|
+
setTreeVisibility: function (node, list) {
|
|
376
412
|
let flag = false;
|
|
377
413
|
if (list.includes(node.id)) flag = true;
|
|
378
|
-
const region = this.$module.scene
|
|
379
|
-
|
|
380
|
-
|
|
414
|
+
const region = this.$module.scene
|
|
415
|
+
.getRootRegion()
|
|
416
|
+
.findChildFromPath(node.regionPath);
|
|
417
|
+
if (node.isRegion) region.setVisibility(flag);
|
|
381
418
|
if (node.isPrimitives) {
|
|
382
419
|
const primitives = region.findObjectsWithGroupName(node.label);
|
|
383
|
-
primitives.forEach(primitive => primitive.setVisibility(flag))
|
|
420
|
+
primitives.forEach((primitive) => primitive.setVisibility(flag));
|
|
384
421
|
}
|
|
385
422
|
if (node.children)
|
|
386
|
-
node.children.forEach(child => this.setTreeVisibility(child, list));
|
|
423
|
+
node.children.forEach((child) => this.setTreeVisibility(child, list));
|
|
387
424
|
},
|
|
388
425
|
checkAllKeys: function () {
|
|
389
426
|
const keysList = [];
|
|
@@ -400,11 +437,11 @@ export default {
|
|
|
400
437
|
setState: function (state) {
|
|
401
438
|
if (state) {
|
|
402
439
|
if (state.checkAll) {
|
|
403
|
-
this.checkAllKeys();
|
|
440
|
+
this.checkAllKeys();
|
|
404
441
|
} else if (state.checkedItems) {
|
|
405
442
|
let list = [];
|
|
406
443
|
if (state.version !== "2.0") {
|
|
407
|
-
list = state.checkedItems.map(item => "/" + item);
|
|
444
|
+
list = state.checkedItems.map((item) => "/" + item);
|
|
408
445
|
list.shift("__r/");
|
|
409
446
|
} else {
|
|
410
447
|
list.push(...state.checkedItems);
|
|
@@ -422,6 +459,7 @@ export default {
|
|
|
422
459
|
<style scoped lang="scss">
|
|
423
460
|
@import "~element-ui/packages/theme-chalk/src/checkbox";
|
|
424
461
|
@import "~element-ui/packages/theme-chalk/src/color-picker";
|
|
462
|
+
@import "~element-ui/packages/theme-chalk/src/loading";
|
|
425
463
|
@import "~element-ui/packages/theme-chalk/src/row";
|
|
426
464
|
@import "~element-ui/packages/theme-chalk/src/tree";
|
|
427
465
|
|
|
@@ -610,7 +648,7 @@ export default {
|
|
|
610
648
|
z-index: 8;
|
|
611
649
|
margin-top: calc(50% - 52px);
|
|
612
650
|
border: solid 1px $app-primary-color;
|
|
613
|
-
background-color: #
|
|
651
|
+
background-color: #f9f2fc;
|
|
614
652
|
text-align: center;
|
|
615
653
|
vertical-align: middle;
|
|
616
654
|
cursor: pointer;
|
|
@@ -619,7 +657,7 @@ export default {
|
|
|
619
657
|
|
|
620
658
|
.drawer-button {
|
|
621
659
|
i {
|
|
622
|
-
font-weight:600;
|
|
660
|
+
font-weight: 600;
|
|
623
661
|
margin-top: 12px;
|
|
624
662
|
color: $app-primary-color;
|
|
625
663
|
transition-delay: 0.9s;
|