Comments (4)
Long story short:
canvas.setAttribute( 'tabindex', '0' );
canvas.focus();
then KeyboardEvent works.
from camera-controls.
On my side, i'm using threejs InteractiveGroup with CameraControls.
Note that the InteractiveGroup is instanciated after CameraControls.
To make it work i found 2 tricks ( tests ) :
- in InteractiveGroup.js, comment the line
event.stopPropagation()
https://github.com/mrdoob/three.js/blob/01e4eaf0c17c5906a73628576fbe27609ac82618/examples/jsm/interactive/InteractiveGroup.js#L28
OR
- replace
this._domElement.ownerDocument
withthis._domElement
in theses 4 linescamera-controls/src/CameraControls.ts
Line 550 in d63e9b8
from camera-controls.
Actually, that is not a bug at all.
Please read MDN first, or you can just use my keyboard event lib which is used in the example.
from camera-controls.
@yomotsu Why do you say it is not a bug? When using OrbitControls instead of CameraControls, the code above works when binding keyboard event on canvas.
from camera-controls.
Related Issues (20)
- Drag sensitivity on dolly movement HOT 4
- Add back modifier keys to pointer events HOT 1
- setLookAt doesn't trigger an update of the viewport attributes HOT 4
- Slow pinch-zoom when using orthographic camera HOT 7
- problem HOT 1
- Bug with setting interactiveArea top position. HOT 1
- Dolly behavior in first person mode is different when scrolling up and down HOT 1
- How to use CameraControls in react native HOT 2
- camera-controls does not export its types HOT 7
- Lerping min/max zoom set on Orthographic Camera HOT 1
- moveTo function in orthographic mode has inconsistent behaviour on mobile devices/ipad HOT 1
- Best coding pattern for onresize? HOT 1
- Pointer lock behaviour different ? HOT 1
- Speed up setLookAt or lerpLookAt HOT 5
- Invalid "main" entry in v2.8.x HOT 10
- Add focus function HOT 7
- Error 'ThreeCameraControls.install is not a function' HOT 2
- Method to cancel ongoing transitions HOT 5
- Mouse wheel zoom doesn't work with pressed Shift on Mac HOT 1
- The automated release is failing 🚨 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from camera-controls.