File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -539,6 +539,10 @@ THREE.OrbitControls = function ( object, domElement ) {
539539
540540 //console.log( 'handleKeyDown' );
541541
542+ // prevent the browser from scrolling on cursor up/down
543+
544+ event . preventDefault ( ) ;
545+
542546 switch ( event . keyCode ) {
543547
544548 case scope . keys . UP :
@@ -673,8 +677,15 @@ THREE.OrbitControls = function ( object, domElement ) {
673677
674678 if ( scope . enabled === false ) return ;
675679
680+ // Prevent the browser from scrolling.
681+
676682 event . preventDefault ( ) ;
677683
684+ // Manually set the focus since calling preventDefault above
685+ // prevents the browser from setting it automatically.
686+
687+ scope . domElement . focus ? scope . domElement . focus ( ) : window . focus ( ) ;
688+
678689 switch ( event . button ) {
679690
680691 case scope . mouseButtons . LEFT :
You can’t perform that action at this time.
0 commit comments