Comments (5)
OrbitControls
like other control classes rely on KeyboardEvent.code
which represents the physical key on the keyboard. This is ideal for all use cases where the user is supposed to control an object/camera with fixes keys on the keyboard (think of games which rely on WASD or arrow keys).
Add keycodes PLUS: 107, MINUS: 109 to this.keys.
Regarding plus and minus, using the numeric key code values doesn't work since the control classes check for KeyboardEvent.code
. So the +
and -
signs are e.g. NumpadAdd
and NumpadSubtract
when using the numpad. However, not all keyboards have a numpad so their plus and minus keys might be at different positions. I wonder if it is better to make a second switch
statement in handleKeyDown()
and check for KeyboardEvent.key
instead. Meaning:
switch ( event.key ) {
case '+':
dollyOut( getZoomScale() );
needsUpdate = true;
break;
case '-':
dollyIn( getZoomScale() );
needsUpdate = true;
break;
}
@felixmariotto Plus and minus signs are not that established as WASD or arrow keys in context of gaming. It seems checking for the actual character seems better in this case, imo. What do you think?
from three.js.
I like the idea of support keys for zoom but the suggested change does not work for me. E.g. on macOS the code for plus on the numpad is NumpadAdd
.
from three.js.
Wouldn't it be even better to replace all usages of KeyboardEvent.code
with KeyboardEvent.key
? The second would be more understandable because of comparing with the character instead of some abstract keycode.
from three.js.
KeyboardEvent.code
is the better default for controls with has been approved in #21056. I don't think there is a need to question this policy. It definitely makes sense for many use cases. There might be exceptions like this issue though.
from three.js.
Closing, see #26862 (comment).
from three.js.
Related Issues (20)
- Typescript - CSS2DRenderer, CSS3DRenderer does not inherit from Renderer HOT 3
- 成功上传一个模型后,会发现它的颜色不见了,变灰了 HOT 3
- GLTFLoader min/max accessor implementation HOT 1
- Alternate GroundProjectedSkybox HOT 4
- Regression: Nodes not working anymore in r160
- WebGLRenderer: warn on invalid or unsupported texture filtering HOT 3
- Shader rendering black pixels on Mac M2 HOT 1
- Modifying the position of the scene can cause misalignment of the SpotLight and SpotLightHelper positions HOT 2
- anisotropy effect looks not that correct HOT 4
- Is it possible to add a setColorAt method for BatchedMesh? HOT 3
- OrbitControls: Infinite Return of getZoomScale When window.devicePixelRatio < 1 HOT 2
- MaterialX: Default input values not being specified results in errors every frame HOT 1
- SVGLoader pointsToStroke incorrect UV mapping when texture applied HOT 2
- Use `Object.keys(…)` to iterate over "own" properties? HOT 3
- WebGPURenderer: Resize breaks post FX setup in `webgpu_rtt` example HOT 1
- Addons.js is incomplete
- Points rendering glitch in iOS Safari HOT 5
- bug in Audio.js setDetune HOT 3
- THREE.BufferGeometryUtils.mergeAttributes fails to merge LineGeometry HOT 1
- Does three.js currently provide adjustment hubs similar to babylon.js: when dragging the model, the current option is used to determine the hub position of the model. HOT 2
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 three.js.