Skip to content

How to Disable Smooth Transitions for Zooming? #551

Answered by yomotsu
mikisf asked this question in Q&A
Discussion options

You must be logged in to vote

sorry for the delay,

The smooth behavior in _zoomInternal cannot be directly modified:

this.zoomTo( zoom, true );

However, you can customize the internal method by extending the CameraControls class.
Here's an example:

class MyCameraControls extends CameraControls {

  protected _zoomInternal = ( delta: number, x: number, y: number ): void => {

		const zoomScale = Math.pow( 0.95, delta * this.dollySpeed );
		const lastZoom = this._zoom;
		const zoom = this._zoom * zoomScale;

		this.zoomTo( zoom, false ); // change here

		if ( this.dollyToCursor ) {

			this._changedZoom += zoom - lastZoom;
			this._dollyContro…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mikisf
Comment options

Answer selected by mikisf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants