mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
add onClick to renderer
This commit is contained in:
parent
e5fa85515f
commit
d86b243df6
@ -100,6 +100,7 @@ export default defineComponent({
|
||||
height: String,
|
||||
xr: Boolean,
|
||||
onReady: Function as PropType<(r: RendererInterface) => void>,
|
||||
onClick: Function as PropType<(this: HTMLCanvasElement, ev: MouseEvent) => any>,
|
||||
},
|
||||
setup(props): RendererSetupInterface {
|
||||
const initCallbacks: InitCallbackType[] = []
|
||||
@ -126,6 +127,11 @@ export default defineComponent({
|
||||
|
||||
const renderFn: {(): void} = () => {}
|
||||
|
||||
// we have to handle canvas events ourself (it is not rendered by vue)
|
||||
if (props.onClick) {
|
||||
canvas.addEventListener('click', props.onClick)
|
||||
}
|
||||
|
||||
return {
|
||||
canvas,
|
||||
three,
|
||||
|
Loading…
Reference in New Issue
Block a user