@abi-software/scaffoldvuer 1.3.2 → 1.3.3-beta.0
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 +5180 -5837
- package/dist/scaffoldvuer.umd.cjs +174 -174
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/App.vue +1 -0
- package/src/components/LinesControls.vue +15 -17
- package/src/components/PointsControls.vue +12 -14
- package/src/components/PrimitiveControls.vue +4 -3
- package/src/components/ScaffoldTreeControls.vue +22 -19
- package/src/components/ScaffoldVuer.vue +5 -2
- package/src/components/TextureSlidesControls.vue +9 -10
- package/src/components/TransformationControls.vue +7 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/scaffoldvuer",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3-beta.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"vue": "^3.4.15",
|
|
56
56
|
"vue-router": "^4.2.5",
|
|
57
57
|
"vue3-component-svg-sprite": "^0.0.1",
|
|
58
|
-
"zincjs": "^1.10.
|
|
58
|
+
"zincjs": "^1.10.3"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@vitejs/plugin-vue": "^4.6.2",
|
package/src/App.vue
CHANGED
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
/* eslint-disable no-alert, no-console */
|
|
98
98
|
// This is not in use at this moment, due to
|
|
99
99
|
// limited support to line width
|
|
100
|
-
import { shallowRef } from 'vue';
|
|
100
|
+
import { markRaw, shallowRef } from 'vue';
|
|
101
101
|
import {
|
|
102
102
|
getLineDistance,
|
|
103
103
|
moveAndExtendLine,
|
|
@@ -146,26 +146,24 @@ export default {
|
|
|
146
146
|
ElIconArrowLeft: shallowRef(ElIconArrowLeft),
|
|
147
147
|
ElIconArrowRight: shallowRef(ElIconArrowRight),
|
|
148
148
|
edited: false,
|
|
149
|
+
zincObject: undefined,
|
|
149
150
|
};
|
|
150
151
|
},
|
|
151
152
|
watch: {
|
|
152
153
|
"createData.faceIndex": {
|
|
153
154
|
handler: function (value) {
|
|
154
|
-
if (this.
|
|
155
|
+
if (this.zincObject?.isLines2) {
|
|
155
156
|
this.currentIndex = value;
|
|
156
|
-
this.distance = getLineDistance(this.
|
|
157
|
+
this.distance = getLineDistance(this.zincObject, this.currentIndex);
|
|
157
158
|
}
|
|
158
159
|
},
|
|
159
160
|
immediate: true,
|
|
160
161
|
},
|
|
161
162
|
},
|
|
162
|
-
mounted: function () {
|
|
163
|
-
this._zincObject = undefined;
|
|
164
|
-
},
|
|
165
163
|
methods: {
|
|
166
164
|
changeIndex: function(increment) {
|
|
167
165
|
if (increment) {
|
|
168
|
-
const dist = getLineDistance(this.
|
|
166
|
+
const dist = getLineDistance(this.zincObject, this.currentIndex + 1);
|
|
169
167
|
if (dist > 0) {
|
|
170
168
|
this.currentIndex++;
|
|
171
169
|
this.reset();
|
|
@@ -179,7 +177,7 @@ export default {
|
|
|
179
177
|
if (this.newDistance !== 0) {
|
|
180
178
|
this.distance = this.newDistance;
|
|
181
179
|
this.edited = moveAndExtendLine(
|
|
182
|
-
this.
|
|
180
|
+
this.zincObject, this.currentIndex, this.newDistance, true) || this.edited;
|
|
183
181
|
} else {
|
|
184
182
|
this.newDistance = this.distance;
|
|
185
183
|
}
|
|
@@ -187,22 +185,22 @@ export default {
|
|
|
187
185
|
onLengthSliding: function() {
|
|
188
186
|
this.newDistance = Math.pow(10, this.lengthScale) * this.distance;
|
|
189
187
|
this.edited = moveAndExtendLine(
|
|
190
|
-
this.
|
|
188
|
+
this.zincObject, this.currentIndex, this.newDistance, true) || this.edited;
|
|
191
189
|
},
|
|
192
190
|
onMoveSliding: function() {
|
|
193
191
|
const diff = (this.adjust - this.pAdjust) * this.distance;
|
|
194
192
|
this.edited = moveAndExtendLine(
|
|
195
|
-
this.
|
|
193
|
+
this.zincObject, this.currentIndex, diff, false) || this.edited;
|
|
196
194
|
this.pAdjust = this.adjust;
|
|
197
195
|
},
|
|
198
196
|
reset: function() {
|
|
199
197
|
this.adjust = 0;
|
|
200
198
|
this.pAdjust = 0;
|
|
201
199
|
this.lengthScale = 0;
|
|
202
|
-
this.distance = getLineDistance(this.
|
|
200
|
+
this.distance = getLineDistance(this.zincObject, this.currentIndex);
|
|
203
201
|
this.newDistance = this.distance;
|
|
204
202
|
if (this.edited) {
|
|
205
|
-
this.$emit("primitivesUpdated", this.
|
|
203
|
+
this.$emit("primitivesUpdated", this.zincObject);
|
|
206
204
|
this.edited = false;
|
|
207
205
|
}
|
|
208
206
|
},
|
|
@@ -210,19 +208,19 @@ export default {
|
|
|
210
208
|
this.currentIndex = -1;
|
|
211
209
|
this.distance = 0;
|
|
212
210
|
if (object.isLines2) {
|
|
213
|
-
this.
|
|
214
|
-
this.width = this.
|
|
211
|
+
this.zincObject = markRaw(object);
|
|
212
|
+
this.width = this.zincObject.getMorph().material.linewidth;
|
|
215
213
|
if (object.isEditable) {
|
|
216
214
|
this.currentIndex = 0;
|
|
217
215
|
this.distance = getLineDistance(object, this.currentIndex);
|
|
218
216
|
}
|
|
219
217
|
} else {
|
|
220
|
-
this.
|
|
221
|
-
this.
|
|
218
|
+
this.zincObject = undefined;
|
|
219
|
+
this.width = 10;
|
|
222
220
|
}
|
|
223
221
|
},
|
|
224
222
|
modifyWidth: function () {
|
|
225
|
-
this.
|
|
223
|
+
this.zincObject.setWidth(this.width);
|
|
226
224
|
},
|
|
227
225
|
},
|
|
228
226
|
};
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
|
|
126
126
|
<script>
|
|
127
127
|
/* eslint-disable no-alert, no-console */
|
|
128
|
-
import { shallowRef } from 'vue';
|
|
128
|
+
import { markRaw, shallowRef } from 'vue';
|
|
129
129
|
import {
|
|
130
130
|
movePoint,
|
|
131
131
|
} from "../scripts/Utilities.js";
|
|
@@ -184,11 +184,9 @@ export default {
|
|
|
184
184
|
ElIconArrowLeft: shallowRef(ElIconArrowLeft),
|
|
185
185
|
ElIconArrowRight: shallowRef(ElIconArrowRight),
|
|
186
186
|
edited: false,
|
|
187
|
+
zincObject: undefined,
|
|
187
188
|
};
|
|
188
189
|
},
|
|
189
|
-
mounted: function () {
|
|
190
|
-
this._zincObject = undefined;
|
|
191
|
-
},
|
|
192
190
|
watch: {
|
|
193
191
|
boundingDims: {
|
|
194
192
|
handler: function (value) {
|
|
@@ -211,7 +209,7 @@ export default {
|
|
|
211
209
|
methods: {
|
|
212
210
|
changeIndex: function(increment) {
|
|
213
211
|
if (increment) {
|
|
214
|
-
if (this.
|
|
212
|
+
if (this.zincObject.drawRange > this.currentIndex + 1) {
|
|
215
213
|
this.currentIndex++;
|
|
216
214
|
this.reset();
|
|
217
215
|
}
|
|
@@ -226,7 +224,7 @@ export default {
|
|
|
226
224
|
this.translation[1] - this.pTranslation[1],
|
|
227
225
|
this.translation[2] - this.pTranslation[2],
|
|
228
226
|
];
|
|
229
|
-
this.edited = movePoint(this.
|
|
227
|
+
this.edited = movePoint(this.zincObject, this.currentIndex, diff) || this.edited;
|
|
230
228
|
for (let i = 0; i < 3; i++) {
|
|
231
229
|
this.pTranslation[i] = this.translation[i];
|
|
232
230
|
}
|
|
@@ -235,33 +233,33 @@ export default {
|
|
|
235
233
|
this.translation = [0, 0, 0];
|
|
236
234
|
this.pTranslation = [0, 0, 0];
|
|
237
235
|
if (this.edited) {
|
|
238
|
-
this.$emit("primitivesUpdated", this.
|
|
236
|
+
this.$emit("primitivesUpdated", this.zincObject);
|
|
239
237
|
this.edited = false;
|
|
240
238
|
}
|
|
241
239
|
},
|
|
242
240
|
setObject: function (object) {
|
|
243
241
|
this.currentIndex = -1;
|
|
244
242
|
if (object.isPointset) {
|
|
245
|
-
this.
|
|
246
|
-
this.size = this.
|
|
247
|
-
this.attenuation = this.
|
|
243
|
+
this.zincObject = markRaw(object);
|
|
244
|
+
this.size = this.zincObject.morph.material.size;
|
|
245
|
+
this.attenuation = this.zincObject.morph.material.sizeAttenuation;
|
|
248
246
|
if (object.isEditable) {
|
|
249
|
-
if (this.
|
|
247
|
+
if (this.zincObject.drawRange > 0) {
|
|
250
248
|
this.currentIndex = 0;
|
|
251
249
|
}
|
|
252
250
|
}
|
|
253
251
|
} else {
|
|
254
|
-
this.
|
|
252
|
+
this.zincObject = undefined;
|
|
255
253
|
this.size = 10;
|
|
256
254
|
this.attenuation = false;
|
|
257
255
|
}
|
|
258
256
|
},
|
|
259
257
|
modifyAttenuation: function(flag) {
|
|
260
258
|
this.attenuation = flag;
|
|
261
|
-
this.
|
|
259
|
+
this.zincObject.setSizeAttenuation(flag);
|
|
262
260
|
},
|
|
263
261
|
modifySize: function () {
|
|
264
|
-
this.
|
|
262
|
+
this.zincObject.setSize(this.size);
|
|
265
263
|
},
|
|
266
264
|
},
|
|
267
265
|
};
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
|
|
52
52
|
<script>
|
|
53
53
|
/* eslint-disable no-alert, no-console */
|
|
54
|
-
import {
|
|
54
|
+
import { markRaw } from 'vue';
|
|
55
55
|
import {
|
|
56
56
|
ArrowRight as ElIconArrowRight,
|
|
57
57
|
} from '@element-plus/icons-vue';
|
|
@@ -96,6 +96,7 @@ export default {
|
|
|
96
96
|
drawerOpen: true,
|
|
97
97
|
zincObject: undefined,
|
|
98
98
|
isEditable: false,
|
|
99
|
+
displayString: "100%"
|
|
99
100
|
};
|
|
100
101
|
},
|
|
101
102
|
methods: {
|
|
@@ -108,7 +109,7 @@ export default {
|
|
|
108
109
|
},
|
|
109
110
|
setObject: function(object) {
|
|
110
111
|
if (object) {
|
|
111
|
-
this.zincObject =
|
|
112
|
+
this.zincObject = markRaw(object);
|
|
112
113
|
} else {
|
|
113
114
|
this.zincObject = undefined;
|
|
114
115
|
}
|
|
@@ -136,7 +137,7 @@ export default {
|
|
|
136
137
|
}
|
|
137
138
|
}
|
|
138
139
|
if (object && object.getMorph()) {
|
|
139
|
-
this.material =
|
|
140
|
+
this.material = object.getMorph().material;
|
|
140
141
|
} else {
|
|
141
142
|
this.material = undefined;
|
|
142
143
|
}
|
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
} from "../scripts/Utilities.js";
|
|
38
38
|
import { TreeControls } from "@abi-software/map-utilities";
|
|
39
39
|
import "@abi-software/map-utilities/dist/style.css";
|
|
40
|
+
import { markRaw } from "vue";
|
|
40
41
|
|
|
41
42
|
const nameSorting = (a, b) => {
|
|
42
43
|
const labelA = a.label.toUpperCase();
|
|
@@ -74,6 +75,8 @@ export default {
|
|
|
74
75
|
active: [],
|
|
75
76
|
hover: [],
|
|
76
77
|
drawerOpen: true,
|
|
78
|
+
nodeNumbers: 0,
|
|
79
|
+
module: undefined,
|
|
77
80
|
};
|
|
78
81
|
},
|
|
79
82
|
computed: {
|
|
@@ -104,7 +107,7 @@ export default {
|
|
|
104
107
|
parentContainer.sort((a, b) => {
|
|
105
108
|
return nameSorting(a, b);
|
|
106
109
|
});
|
|
107
|
-
this.
|
|
110
|
+
this.nodeNumbers++;
|
|
108
111
|
this.$nextTick(() => {
|
|
109
112
|
const checked =
|
|
110
113
|
this.$refs.treeControls.$refs.regionTree.getCheckedKeys();
|
|
@@ -117,8 +120,8 @@ export default {
|
|
|
117
120
|
// '__r/'
|
|
118
121
|
findOrCreateRegion: function (data, paths, prefix) {
|
|
119
122
|
//check if root region has been set
|
|
120
|
-
if (this.
|
|
121
|
-
this.treeData[0].id = this
|
|
123
|
+
if (this.module && this.module.scene) {
|
|
124
|
+
this.treeData[0].id = this.module.scene.getRootRegion().uuid;
|
|
122
125
|
this.treeData[0].isRegion = true;
|
|
123
126
|
}
|
|
124
127
|
if (paths.length > 0) {
|
|
@@ -127,7 +130,7 @@ export default {
|
|
|
127
130
|
(child) => child.label == _paths[0]
|
|
128
131
|
);
|
|
129
132
|
const path = prefix + "/" + paths[0];
|
|
130
|
-
const region = this
|
|
133
|
+
const region = this.module.scene
|
|
131
134
|
.getRootRegion()
|
|
132
135
|
.findChildFromPath(path);
|
|
133
136
|
if (!childRegionItem) {
|
|
@@ -185,7 +188,7 @@ export default {
|
|
|
185
188
|
for (let i = 0; i < regionData.children.length; i++) {
|
|
186
189
|
if (regionData.children[i].label === group) {
|
|
187
190
|
regionData.children.splice(i, 1);
|
|
188
|
-
this.
|
|
191
|
+
this.nodeNumbers--;
|
|
189
192
|
return;
|
|
190
193
|
}
|
|
191
194
|
}
|
|
@@ -196,7 +199,7 @@ export default {
|
|
|
196
199
|
const isRegion = node.isRegion;
|
|
197
200
|
const isPrimitives = node.isPrimitives;
|
|
198
201
|
const isChecked = data.checkedKeys.includes(node.id);
|
|
199
|
-
const region = this
|
|
202
|
+
const region = this.module.scene
|
|
200
203
|
.getRootRegion()
|
|
201
204
|
.findChildFromPath(node.regionPath);
|
|
202
205
|
if (isRegion) {
|
|
@@ -238,7 +241,7 @@ export default {
|
|
|
238
241
|
* Select a region by its name.
|
|
239
242
|
*/
|
|
240
243
|
changeActiveByNames: function (names, regionPath, propagate) {
|
|
241
|
-
const rootRegion = this
|
|
244
|
+
const rootRegion = this.module.scene.getRootRegion();
|
|
242
245
|
const targetObjects = findObjectsWithNames(
|
|
243
246
|
rootRegion,
|
|
244
247
|
names,
|
|
@@ -251,7 +254,7 @@ export default {
|
|
|
251
254
|
* Hover a region by its name.
|
|
252
255
|
*/
|
|
253
256
|
changeHoverByNames: function (names, regionPath, propagate) {
|
|
254
|
-
const rootRegion = this
|
|
257
|
+
const rootRegion = this.module.scene.getRootRegion();
|
|
255
258
|
const targetObjects = findObjectsWithNames(
|
|
256
259
|
rootRegion,
|
|
257
260
|
names,
|
|
@@ -293,7 +296,7 @@ export default {
|
|
|
293
296
|
clear: function () {
|
|
294
297
|
this.active.length = 0;
|
|
295
298
|
this.hover.length = 0;
|
|
296
|
-
this.
|
|
299
|
+
this.nodeNumbers = 0;
|
|
297
300
|
this.$refs.treeControls.$refs.regionTree.updateKeyChildren(
|
|
298
301
|
this.treeData[0].id,
|
|
299
302
|
[]
|
|
@@ -315,7 +318,7 @@ export default {
|
|
|
315
318
|
return "#FFFFFF";
|
|
316
319
|
},
|
|
317
320
|
getZincObjectsFromNode: function (node, transverse) {
|
|
318
|
-
const rootRegion = this
|
|
321
|
+
const rootRegion = this.module.scene.getRootRegion();
|
|
319
322
|
if (node.isPrimitives) {
|
|
320
323
|
return findObjectsWithNames(
|
|
321
324
|
rootRegion,
|
|
@@ -335,14 +338,14 @@ export default {
|
|
|
335
338
|
},
|
|
336
339
|
//Set this right at the beginning.
|
|
337
340
|
setModule: function (moduleIn) {
|
|
338
|
-
this
|
|
339
|
-
this.
|
|
340
|
-
const objects = this
|
|
341
|
+
this.module = markRaw(moduleIn);
|
|
342
|
+
this.nodeNumbers = 0;
|
|
343
|
+
const objects = this.module.scene.getRootRegion().getAllObjects(true);
|
|
341
344
|
objects.forEach((zincObject) => {
|
|
342
345
|
this.zincObjectAdded(zincObject);
|
|
343
346
|
});
|
|
344
|
-
this
|
|
345
|
-
this
|
|
347
|
+
this.module.addOrganPartAddedCallback(this.zincObjectAdded);
|
|
348
|
+
this.module.addOrganPartRemovedCallback(this.zincObjectRemoved);
|
|
346
349
|
},
|
|
347
350
|
setColourField: function (treeData, nodeData = undefined) {
|
|
348
351
|
treeData
|
|
@@ -382,7 +385,7 @@ export default {
|
|
|
382
385
|
}
|
|
383
386
|
},
|
|
384
387
|
visibilityToggle: function (item, event) {
|
|
385
|
-
this
|
|
388
|
+
this.module.changeOrganPartsVisibility(item, event);
|
|
386
389
|
if (event == false) {
|
|
387
390
|
if (this.activeRegion === item) {
|
|
388
391
|
this.removeActive(true);
|
|
@@ -414,7 +417,7 @@ export default {
|
|
|
414
417
|
list.splice(index, 1);
|
|
415
418
|
ids.push(node.id);
|
|
416
419
|
}
|
|
417
|
-
const region = this
|
|
420
|
+
const region = this.module.scene
|
|
418
421
|
.getRootRegion()
|
|
419
422
|
.findChildFromPath(node.regionPath);
|
|
420
423
|
if (nodeName && nodeName !== "__r") {
|
|
@@ -444,13 +447,13 @@ export default {
|
|
|
444
447
|
getState: function () {
|
|
445
448
|
let checkedItems =
|
|
446
449
|
this.$refs.treeControls.$refs.regionTree.getCheckedKeys();
|
|
447
|
-
if (checkedItems.length === this.
|
|
450
|
+
if (checkedItems.length === this.nodeNumbers) {
|
|
448
451
|
return { checkAll: true, version: "2.0" };
|
|
449
452
|
} else {
|
|
450
453
|
//We cannot use the generated uuid as the identifier for permastate,
|
|
451
454
|
//convert it back to paths
|
|
452
455
|
let paths = convertUUIDsToFullPaths(
|
|
453
|
-
this
|
|
456
|
+
this.module.scene.getRootRegion(),
|
|
454
457
|
checkedItems
|
|
455
458
|
);
|
|
456
459
|
return { checkedItems: paths, version: "2.0" };
|
|
@@ -299,7 +299,7 @@
|
|
|
299
299
|
placeholder="Select"
|
|
300
300
|
class="scaffold-select-box viewing-mode"
|
|
301
301
|
popper-class="scaffold_viewer_dropdown"
|
|
302
|
-
@change="
|
|
302
|
+
@change="changeViewingMode"
|
|
303
303
|
>
|
|
304
304
|
<el-option v-for="item in viewingModes" :key="item" :label="item" :value="item">
|
|
305
305
|
<el-row>
|
|
@@ -1864,8 +1864,11 @@ export default {
|
|
|
1864
1864
|
/**
|
|
1865
1865
|
* Callback on viewing mode change
|
|
1866
1866
|
*/
|
|
1867
|
-
|
|
1867
|
+
changeViewingMode: function (modeName) {
|
|
1868
1868
|
if (this.$module) {
|
|
1869
|
+
if (modeName) {
|
|
1870
|
+
this.viewingMode = modeName
|
|
1871
|
+
}
|
|
1869
1872
|
if (this.viewingMode === "Annotation") {
|
|
1870
1873
|
let authenticated = false;
|
|
1871
1874
|
if (this.userInformation) {
|
|
@@ -79,6 +79,7 @@ import {
|
|
|
79
79
|
ElSlider as Slider,
|
|
80
80
|
ElOption as Option,
|
|
81
81
|
} from "element-plus";
|
|
82
|
+
import { markRaw } from 'vue';
|
|
82
83
|
|
|
83
84
|
/**
|
|
84
85
|
* A component to control the opacity of the target object.
|
|
@@ -116,39 +117,37 @@ export default {
|
|
|
116
117
|
label: "z",
|
|
117
118
|
},
|
|
118
119
|
],
|
|
120
|
+
zincObject: undefined,
|
|
119
121
|
};
|
|
120
122
|
},
|
|
121
|
-
mounted: function () {
|
|
122
|
-
this._zincObject = undefined;
|
|
123
|
-
},
|
|
124
123
|
methods: {
|
|
125
124
|
setObject: function (object) {
|
|
126
125
|
if (object.isTextureSlides) {
|
|
127
|
-
this.
|
|
128
|
-
this.settings = this.
|
|
126
|
+
this.zincObject = markRaw(object);
|
|
127
|
+
this.settings = this.zincObject.getTextureSettings();
|
|
129
128
|
} else {
|
|
130
|
-
this.
|
|
129
|
+
this.zincObject = undefined;
|
|
131
130
|
this.settings = [];
|
|
132
131
|
}
|
|
133
132
|
},
|
|
134
133
|
addNewSlide: function () {
|
|
135
134
|
const newSettings = { direction: "x", value: 0 };
|
|
136
|
-
const returnSettings = this.
|
|
135
|
+
const returnSettings = this.zincObject.createSlide(newSettings);
|
|
137
136
|
this.settings.push(returnSettings);
|
|
138
137
|
},
|
|
139
138
|
modifyDirection: function(direction, slide) {
|
|
140
139
|
if (slide) {
|
|
141
140
|
slide.direction = direction;
|
|
142
|
-
this.
|
|
141
|
+
this.zincObject.modifySlideSettings(slide);
|
|
143
142
|
}
|
|
144
143
|
},
|
|
145
144
|
modifySlide: function (slide) {
|
|
146
145
|
if (slide) {
|
|
147
|
-
this.
|
|
146
|
+
this.zincObject.modifySlideSettings(slide);
|
|
148
147
|
}
|
|
149
148
|
},
|
|
150
149
|
removeSlide: function (index, slide) {
|
|
151
|
-
this.
|
|
150
|
+
this.zincObject.removeSlideWithId(slide.id);
|
|
152
151
|
this.settings.splice(index, 1);
|
|
153
152
|
},
|
|
154
153
|
},
|
|
@@ -119,6 +119,7 @@ import {
|
|
|
119
119
|
ElMain as Main,
|
|
120
120
|
ElSlider as Slider,
|
|
121
121
|
} from "element-plus";
|
|
122
|
+
import { markRaw } from "vue";
|
|
122
123
|
|
|
123
124
|
/**
|
|
124
125
|
* A component to control the opacity of the target object.
|
|
@@ -141,6 +142,7 @@ export default {
|
|
|
141
142
|
scale: 1,
|
|
142
143
|
min: [0, 0, 0],
|
|
143
144
|
max: [1, 1, 1],
|
|
145
|
+
zincObject: undefined,
|
|
144
146
|
};
|
|
145
147
|
},
|
|
146
148
|
watch: {
|
|
@@ -163,14 +165,11 @@ export default {
|
|
|
163
165
|
deep: true,
|
|
164
166
|
},
|
|
165
167
|
},
|
|
166
|
-
mounted: function () {
|
|
167
|
-
this._zincObject = undefined;
|
|
168
|
-
},
|
|
169
168
|
methods: {
|
|
170
169
|
setObject: function (object) {
|
|
171
170
|
if (object.isZincObject) {
|
|
172
|
-
this.
|
|
173
|
-
const morph = this.
|
|
171
|
+
this.zincObject = markRaw(object);
|
|
172
|
+
const morph = this.zincObject.getGroup();
|
|
174
173
|
if (morph && morph.position) {
|
|
175
174
|
this.x = morph.position.x;
|
|
176
175
|
this.y = morph.position.y;
|
|
@@ -178,7 +177,7 @@ export default {
|
|
|
178
177
|
this.scale = morph.scale.x;
|
|
179
178
|
}
|
|
180
179
|
} else {
|
|
181
|
-
this.
|
|
180
|
+
this.zincObject = undefined;
|
|
182
181
|
this.x = 0;
|
|
183
182
|
this.y = 0;
|
|
184
183
|
this.z = 0;
|
|
@@ -186,10 +185,10 @@ export default {
|
|
|
186
185
|
}
|
|
187
186
|
},
|
|
188
187
|
modifyPosition: function() {
|
|
189
|
-
this.
|
|
188
|
+
this.zincObject.setPosition(this.x, this.y, this.z);
|
|
190
189
|
},
|
|
191
190
|
modifyScale: function() {
|
|
192
|
-
this.
|
|
191
|
+
this.zincObject.setScaleAll(this.scale);
|
|
193
192
|
},
|
|
194
193
|
},
|
|
195
194
|
};
|