Set outer bounds on MapControls? (Restrict further panning) #2205
-
Hi, hope someone can lead me into the right directions for this, I'm pretty new to three.
Please see the frustum image from the docs: https://threejs.org/manual/resources/frustum-3d.svg So if I open the browser with 2000x2000px and with zoom="1" I wouldn't be able to move/pan the camera in any direction. Also the background would be fully visible. After zooming into the scene I can start moving/panning the camera around (until it hits the bounds). To start I tried something like this, but the event listener never fires.
The second challenge might be pretty simple as the background size could be calculated out of the fov and the fixed "near" size. I really appreciate any help or hint. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
You can bind the change event like this:
There are also "onStart" and "onEnd" events. If you don't need that background to pan/zoom, you could set it as a background image outside of the canvas using CSS. |
Beta Was this translation helpful? Give feedback.
You can bind the change event like this:
<MapControls onChange={myFunction} /* etc */ />
There are also "onStart" and "onEnd" events.
If you don't need that background to pan/zoom, you could set it as a background image outside of the canvas using CSS.