1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-23 20:02:32 +08:00

created event for geometries

This commit is contained in:
Kevin Levron 2022-02-16 19:52:11 +01:00
parent 4a8f8d9608
commit 39d71b3ef7

View File

@ -22,6 +22,7 @@ export interface GeometryAttributeInterface {
// } // }
const Geometry = defineComponent({ const Geometry = defineComponent({
emits: ['created'],
props: { props: {
rotateX: Number, rotateX: Number,
rotateY: Number, rotateY: Number,
@ -64,7 +65,9 @@ const Geometry = defineComponent({
} }
}) })
geometry.computeBoundingBox() geometry.computeBoundingBox()
geometry.userData.component = this
this.geometry = geometry this.geometry = geometry
this.$emit('created', geometry)
}, },
rotateGeometry() { rotateGeometry() {
if (!this.geometry) return if (!this.geometry) return
@ -98,6 +101,8 @@ export function geometryComponent<P extends Readonly<ComponentPropsOptions>>(
methods: { methods: {
createGeometry() { createGeometry() {
this.geometry = createGeometry(this) this.geometry = createGeometry(this)
this.geometry.userData.component = this
this.$emit('created', this.geometry)
}, },
}, },
}) })