mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
few adjustments
This commit is contained in:
parent
e47f6094e8
commit
e92a62b45b
@ -13,15 +13,7 @@ export default {
|
||||
// can't use setup because it will not be used in sub components
|
||||
// setup() {},
|
||||
unmounted() {
|
||||
// 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;
|
||||
}
|
||||
if (this._parent) this._parent.remove(this.o3d);
|
||||
},
|
||||
methods: {
|
||||
initObject3D(o3d) {
|
||||
@ -31,19 +23,20 @@ export default {
|
||||
bindProp(this, 'rotation', this.o3d);
|
||||
bindProp(this, 'scale', this.o3d);
|
||||
|
||||
// fix lookat.x
|
||||
// TODO : fix lookat.x
|
||||
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 });
|
||||
|
||||
// traverse ancestors until we find something we can add to
|
||||
let parent = this.$parent;
|
||||
while (parent) {
|
||||
if (parent.add) {
|
||||
parent.add(this.o3d);
|
||||
this._parent = parent;
|
||||
break;
|
||||
}
|
||||
parent = parent.$parent;
|
||||
}
|
||||
if (!this._parent) console.error('Missing parent (Scene, Group...)');
|
||||
},
|
||||
add(o) { this.o3d.add(o); },
|
||||
remove(o) { this.o3d.remove(o); },
|
||||
|
Loading…
Reference in New Issue
Block a user