-
Notifications
You must be signed in to change notification settings - Fork 289
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
Add middle-click + drag listener for ZOOM on EnvironmentControls #788
Comments
I'm open to adding the feature if you like to make a PR! |
Just did a try, seems like this is working! |
Edit: seems that terrain avoidance makes it not exactly work like mouse-wheel - where the cursor stays at the same spot on the mesh during zooming-in/out, while it slides with the middle-click zoom. Maybe an update that should be disabled or enabled that I am missing - something like zoomDirection or pivot? |
I'll have to try it when I'm on a computer with a mouse but I wouldn't expect this to keep the terrain in the same spot under the mouse since the cursor is being dragged. It should zoom into the point that was originally clicked. |
Yes I agree it should zoom on the spot originally clicked, but this spot seem to slide a little because of the terrain constraint. It's not very noticeable, but still a bit weird. It might be trying to zoom always to where the cursor is, which when middleclicking + sliding vertically, moves towards the top or bottom of the screen. if ( state === ZOOM && zoomDelta !== 0 ) {
this._updateZoom();
this.rotationInertia.set( 0, 0 );
this.dragInertia.set( 0, 0, 0 );
}
else if ( state === ROTATE || state === DRAG ) {
this._updatePosition( deltaTime );
this._updateRotation( deltaTime );
} |
Is your feature request related to a problem? Please describe.
The
EnvironmentControls
parses left and right clicks + mouse-wheel events, (Quick note, theSHIFT + LEFT_CLICK
did not trigger rotate during my tests). It could be nice if these controls could also parse Middle click for zoom - the awy it is done in googleMapsAerial within OrbitControlsDescribe the solution you'd like
Web/API/Pointer_events suggest adding to PointerTracker.js
And then this could probably resort to something like the following addition to EnvironmentControls.js - pointerdownCallback
Finally,
e.deltaY
motion withmovementY
, and apply tozoomDelta
, but build this into pointermoveCallback:Describe alternatives you've considered
Use another controls, like Pivot controls instead of EnvironmentControls to handle middle-mouse click
The text was updated successfully, but these errors were encountered: