فهرست منبع

Controls reset touch-action to empty string instead of 'auto' (#33144)

Kodub 1 ماه پیش
والد
کامیت
24cbbb7dc7

+ 4 - 1
examples/jsm/controls/ArcballControls.js

@@ -453,7 +453,6 @@ class ArcballControls extends Controls {
 
 		super.connect( element );
 
-		this.domElement.style.touchAction = 'none';
 		this._devPxRatio = window.devicePixelRatio;
 
 		this.domElement.addEventListener( 'contextmenu', this._onContextMenu );
@@ -463,6 +462,8 @@ class ArcballControls extends Controls {
 
 		window.addEventListener( 'resize', this._onWindowResize );
 
+		this.domElement.style.touchAction = 'none'; // Disable touch scroll
+
 	}
 
 	disconnect() {
@@ -477,6 +478,8 @@ class ArcballControls extends Controls {
 
 		window.removeEventListener( 'resize', this._onWindowResize );
 
+		this.domElement.style.touchAction = ''; // Restore touch scroll
+
 	}
 
 	onSinglePanStart( event, operation ) {

+ 2 - 2
examples/jsm/controls/DragControls.js

@@ -139,7 +139,7 @@ class DragControls extends Controls {
 		this.domElement.addEventListener( 'pointerleave', this._onPointerCancel );
 		this.domElement.addEventListener( 'contextmenu', this._onContextMenu );
 
-		this.domElement.style.touchAction = 'none'; // disable touch scroll
+		this.domElement.style.touchAction = 'none'; // Disable touch scroll
 
 	}
 
@@ -151,7 +151,7 @@ class DragControls extends Controls {
 		this.domElement.removeEventListener( 'pointerleave', this._onPointerCancel );
 		this.domElement.removeEventListener( 'contextmenu', this._onContextMenu );
 
-		this.domElement.style.touchAction = 'auto';
+		this.domElement.style.touchAction = ''; // Restore touch scroll
 		this.domElement.style.cursor = '';
 
 	}

+ 2 - 2
examples/jsm/controls/FirstPersonControls.js

@@ -179,7 +179,7 @@ class FirstPersonControls extends Controls {
 		this.domElement.addEventListener( 'pointerup', this._onPointerUp );
 		this.domElement.addEventListener( 'contextmenu', this._onContextMenu );
 
-		this.domElement.style.touchAction = 'none'; // disable touch scroll
+		this.domElement.style.touchAction = 'none'; // Disable touch scroll
 
 	}
 
@@ -193,7 +193,7 @@ class FirstPersonControls extends Controls {
 		this.domElement.removeEventListener( 'pointerup', this._onPointerUp );
 		this.domElement.removeEventListener( 'contextmenu', this._onContextMenu );
 
-		this.domElement.style.touchAction = 'auto';
+		this.domElement.style.touchAction = ''; // Restore touch scroll
 
 	}
 

+ 4 - 0
examples/jsm/controls/FlyControls.js

@@ -109,6 +109,8 @@ class FlyControls extends Controls {
 		this.domElement.addEventListener( 'pointercancel', this._onPointerCancel );
 		this.domElement.addEventListener( 'contextmenu', this._onContextMenu );
 
+		this.domElement.style.touchAction = 'none'; // Disable touch scroll
+
 	}
 
 	disconnect() {
@@ -122,6 +124,8 @@ class FlyControls extends Controls {
 		this.domElement.removeEventListener( 'pointercancel', this._onPointerCancel );
 		this.domElement.removeEventListener( 'contextmenu', this._onContextMenu );
 
+		this.domElement.style.touchAction = ''; // Restore touch scroll
+
 	}
 
 	dispose() {

+ 2 - 2
examples/jsm/controls/OrbitControls.js

@@ -505,7 +505,7 @@ class OrbitControls extends Controls {
 		const document = this.domElement.getRootNode(); // offscreen canvas compatibility
 		document.addEventListener( 'keydown', this._interceptControlDown, { passive: true, capture: true } );
 
-		this.domElement.style.touchAction = 'none'; // disable touch scroll
+		this.domElement.style.touchAction = 'none'; // Disable touch scroll
 
 	}
 
@@ -524,7 +524,7 @@ class OrbitControls extends Controls {
 		const document = this.domElement.getRootNode(); // offscreen canvas compatibility
 		document.removeEventListener( 'keydown', this._interceptControlDown, { capture: true } );
 
-		this.domElement.style.touchAction = 'auto';
+		this.domElement.style.touchAction = ''; // Restore touch scroll
 
 	}
 

+ 2 - 2
examples/jsm/controls/TrackballControls.js

@@ -281,7 +281,7 @@ class TrackballControls extends Controls {
 		this.domElement.addEventListener( 'wheel', this._onMouseWheel, { passive: false } );
 		this.domElement.addEventListener( 'contextmenu', this._onContextMenu );
 
-		this.domElement.style.touchAction = 'none'; // disable touch scroll
+		this.domElement.style.touchAction = 'none'; // Disable touch scroll
 
 	}
 
@@ -297,7 +297,7 @@ class TrackballControls extends Controls {
 		this.domElement.removeEventListener( 'wheel', this._onMouseWheel );
 		this.domElement.removeEventListener( 'contextmenu', this._onContextMenu );
 
-		this.domElement.style.touchAction = 'auto'; // disable touch scroll
+		this.domElement.style.touchAction = ''; // Restore touch scroll
 
 	}
 

+ 2 - 2
examples/jsm/controls/TransformControls.js

@@ -373,7 +373,7 @@ class TransformControls extends Controls {
 		this.domElement.addEventListener( 'pointermove', this._onPointerHover );
 		this.domElement.addEventListener( 'pointerup', this._onPointerUp );
 
-		this.domElement.style.touchAction = 'none'; // disable touch scroll
+		this.domElement.style.touchAction = 'none'; // Disable touch scroll
 
 	}
 
@@ -384,7 +384,7 @@ class TransformControls extends Controls {
 		this.domElement.removeEventListener( 'pointermove', this._onPointerMove );
 		this.domElement.removeEventListener( 'pointerup', this._onPointerUp );
 
-		this.domElement.style.touchAction = 'auto';
+		this.domElement.style.touchAction = ''; // Restore touch scroll
 
 	}
 

粤ICP备19079148号