Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get camera movement from a button child of the canvas element #1

Open
frastlin opened this issue Sep 11, 2019 · 0 comments
Open

Comments

@frastlin
Copy link

Hello,
I am trying to get Babylon working using this template, but for some reason, I am unable to move the camera with the arrow keys.
I am unable to access any keyboard input without the following code:

src/BabylonScene/index.js line 86:

	<canvas
		{...opts}
		ref={this.onCanvasLoaded}
		role="image"
	>
		<button>Focus button</button>
	</canvas>

src/Viewer/index.js, line 26:

canvas.addEventListener("keydown", e=>{
	if(e.key === "f") console.log(camera.position)
})

With the above code I can get "f" to work and log the camera.position, but none of the arrow keys work.
Are you able to reproduce this?
I opened an issue on the forums, but there has been no solution yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant