How to move MapControls on mouse move

Hello.

In MapControls example, It can only be moved with mouse drag but I wanna move the controls with damping when mouse cursor moves.

How can I achieve such a function?

Thank you in advance.

I have followed the instructions answered by this stackoverflow answer but nothing happened. There is no error showing in the console.

app.js

     controls = new OrbitControls(camera, renderer.domElement);

     document.addEventListener('mousemove',function(event){
                    if(controls)controls.handleMouseMoveRotate(event);
            });
 
     animate() {
            requestAnimationFrame(this.animate);
            let dt=clock.getDelta();
            if (camera) {
                renderer.render(scene, camera);
            }
            if(controls)controls.update();
           }

OrbitControls.js

this.handleMouseMoveRotate = function( event ) {

		rotateEnd.set( event.clientX, event.clientY );

		rotateDelta.subVectors( rotateEnd, rotateStart ).multiplyScalar( scope.rotateSpeed );

		var element = scope.domElement;

		rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientHeight ); // yes, height

		rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight );

		rotateStart.copy( rotateEnd );

		scope.update();

	}

console.log(controls.handleMouseMoveRotate) give the following.

Ć’ ( event ) {

		rotateEnd.set( event.clientX, event.clientY );

		rotateDelta.subVectors( rotateEnd, rotateStart ).multiplyScalar( scope.rotateSpeed );

		var element = scope.domElement;

		rotateLeft…

Please can someone help me?