mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
Removes successfully
This commit is contained in:
parent
5bc13469f1
commit
e47f6094e8
@ -13,7 +13,15 @@ export default {
|
|||||||
// can't use setup because it will not be used in sub components
|
// can't use setup because it will not be used in sub components
|
||||||
// setup() {},
|
// setup() {},
|
||||||
unmounted() {
|
unmounted() {
|
||||||
if (this.$parent.remove) this.$parent.remove(this.o3d);
|
// traverse ancestors until we find something we can remove from
|
||||||
|
let parent = this.$parent;
|
||||||
|
while (parent) {
|
||||||
|
if (parent.remove) {
|
||||||
|
parent.remove(this.o3d);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
parent = parent.$parent;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initObject3D(o3d) {
|
initObject3D(o3d) {
|
||||||
@ -27,7 +35,7 @@ export default {
|
|||||||
if (this.lookAt) this.o3d.lookAt(this.lookAt.x, this.lookAt.y, this.lookAt.z);
|
if (this.lookAt) this.o3d.lookAt(this.lookAt.x, this.lookAt.y, this.lookAt.z);
|
||||||
watch(() => this.lookAt, (v) => { this.o3d.lookAt(v.x, v.y, v.z); }, { deep: true });
|
watch(() => this.lookAt, (v) => { this.o3d.lookAt(v.x, v.y, v.z); }, { deep: true });
|
||||||
|
|
||||||
// traverse parents until we find something we can add to
|
// traverse ancestors until we find something we can add to
|
||||||
let parent = this.$parent;
|
let parent = this.$parent;
|
||||||
while (parent) {
|
while (parent) {
|
||||||
if (parent.add) {
|
if (parent.add) {
|
||||||
|
Loading…
Reference in New Issue
Block a user