Add option to zoom in viewport using mouse cursor
This commit is contained in:
parent
67464ef621
commit
49a15b26a5
@ -1270,6 +1270,10 @@ const BARS = {
|
||||
category: 'navigate',
|
||||
keybind: new Keybind({key: 3})
|
||||
})
|
||||
new KeybindItem('preview_zoom', {
|
||||
category: 'navigate',
|
||||
keybind: new Keybind({key: 1, shift: true})
|
||||
})
|
||||
|
||||
new KeybindItem('confirm', {
|
||||
category: 'navigate',
|
||||
|
@ -248,8 +248,8 @@ THREE.OrbitControls = function ( object, preview ) {
|
||||
|
||||
}
|
||||
|
||||
function getZoomScale() {
|
||||
return Math.pow( 0.95, scope.zoomSpeed );
|
||||
function getZoomScale(modifier = 1) {
|
||||
return Math.pow( 0.95, scope.zoomSpeed * modifier);
|
||||
|
||||
}
|
||||
|
||||
@ -418,9 +418,9 @@ THREE.OrbitControls = function ( object, preview ) {
|
||||
dollyDelta.subVectors( dollyEnd, dollyStart );
|
||||
|
||||
if ( dollyDelta.y > 0 ) {
|
||||
dollyIn( getZoomScale() );
|
||||
dollyIn( getZoomScale(0.12 * dollyDelta.y) );
|
||||
} else if ( dollyDelta.y < 0 ) {
|
||||
dollyOut( getZoomScale() );
|
||||
dollyOut( getZoomScale(0.12 * -dollyDelta.y) );
|
||||
}
|
||||
|
||||
dollyStart.copy( dollyEnd );
|
||||
@ -617,6 +617,15 @@ THREE.OrbitControls = function ( object, preview ) {
|
||||
}
|
||||
handleMouseDownPan( event );
|
||||
state = STATE.PAN;
|
||||
|
||||
} else if ( Keybinds.extra.preview_zoom.keybind.isTriggered(event) ) {
|
||||
|
||||
if ( scope.enableZoom === false ) return;
|
||||
if (event.which === 1 && Canvas.raycast(event) && display_mode === false) {
|
||||
return;
|
||||
}
|
||||
handleMouseDownDolly( event );
|
||||
state = STATE.DOLLY;
|
||||
}
|
||||
|
||||
if ( state !== STATE.NONE ) {
|
||||
|
@ -67,8 +67,8 @@ const Canvas = {
|
||||
varying float lift;
|
||||
|
||||
float AMBIENT = 0.1;
|
||||
float XFAC = -0.25;
|
||||
float ZFAC = 0.2;
|
||||
float XFAC = -0.05;
|
||||
float ZFAC = 0.05;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ var gizmo_colors = {
|
||||
b: new THREE.Color(0x2d5ee8),
|
||||
grid: new THREE.Color(0x495061),
|
||||
wire: new THREE.Color(0x576f82),
|
||||
solid: new THREE.Color(0xcecece),
|
||||
solid: new THREE.Color(0xc1c1c1),
|
||||
outline: new THREE.Color(0x3e90ff)
|
||||
}
|
||||
const DefaultCameraPresets = [
|
||||
|
@ -655,6 +655,7 @@
|
||||
"keybind.preview_select": "Select",
|
||||
"keybind.preview_rotate": "Rotate View",
|
||||
"keybind.preview_drag": "Drag View",
|
||||
"keybind.preview_zoom": "Zoom View",
|
||||
"keybind.confirm": "Confirm",
|
||||
"keybind.cancel": "Cancel",
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user