未验证 提交 f4569ee8 编写于 作者: M Michael Herzog 提交者: GitHub

Controls: Remove preventDefault() from mouse handlers. (#21935)

上级 0db8d994
......@@ -81,8 +81,6 @@
function onPointerMove( event ) {
event.preventDefault();
switch ( event.pointerType ) {
case 'mouse':
......@@ -173,8 +171,6 @@
function onPointerDown( event ) {
event.preventDefault();
switch ( event.pointerType ) {
case 'mouse':
......@@ -187,9 +183,8 @@
}
function onMouseDown( event ) {
function onMouseDown() {
event.preventDefault();
_intersections.length = 0;
_raycaster.setFromCamera( _mouse, _camera );
......@@ -220,8 +215,6 @@
function onPointerCancel( event ) {
event.preventDefault();
switch ( event.pointerType ) {
case 'mouse':
......@@ -234,9 +227,7 @@
}
function onMouseCancel( event ) {
event.preventDefault();
function onMouseCancel() {
if ( _selected ) {
......
......@@ -72,8 +72,6 @@
}
event.preventDefault();
if ( this.activeLook ) {
switch ( event.button ) {
......@@ -96,8 +94,6 @@
this.onMouseUp = function ( event ) {
event.preventDefault();
if ( this.activeLook ) {
switch ( event.button ) {
......@@ -136,7 +132,6 @@
this.onKeyDown = function ( event ) {
//event.preventDefault();
switch ( event.code ) {
case 'ArrowUp':
......
......@@ -55,8 +55,7 @@
return;
} //event.preventDefault();
}
switch ( event.code ) {
......@@ -186,14 +185,6 @@
this.mousedown = function ( event ) {
if ( this.domElement !== document ) {
this.domElement.focus();
}
event.preventDefault();
if ( this.dragToLook ) {
this.mouseStatus ++;
......@@ -235,8 +226,6 @@
this.mouseup = function ( event ) {
event.preventDefault();
if ( this.dragToLook ) {
this.mouseStatus --;
......
......@@ -741,11 +741,6 @@
function onMouseDown( event ) {
// Prevent the browser from scrolling.
event.preventDefault(); // Manually set the focus since calling preventDefault above
// prevents the browser from setting it automatically.
scope.domElement.focus ? scope.domElement.focus() : window.focus();
let mouseAction;
switch ( event.button ) {
......@@ -827,7 +822,6 @@
function onMouseMove( event ) {
if ( scope.enabled === false ) return;
event.preventDefault();
switch ( state ) {
......
......@@ -462,8 +462,6 @@
function onMouseDown( event ) {
event.preventDefault();
if ( _state === STATE.NONE ) {
switch ( event.button ) {
......@@ -518,7 +516,6 @@
function onMouseMove( event ) {
if ( scope.enabled === false ) return;
event.preventDefault();
const state = _keyState !== STATE.NONE ? _keyState : _state;
if ( state === STATE.ROTATE && ! scope.noRotate ) {
......@@ -539,10 +536,9 @@
}
function onMouseUp( event ) {
function onMouseUp() {
if ( scope.enabled === false ) return;
event.preventDefault();
_state = STATE.NONE;
scope.domElement.ownerDocument.removeEventListener( 'pointermove', onPointerMove );
scope.domElement.ownerDocument.removeEventListener( 'pointerup', onPointerUp );
......
......@@ -70,8 +70,6 @@ class DragControls extends EventDispatcher {
function onPointerMove( event ) {
event.preventDefault();
switch ( event.pointerType ) {
case 'mouse':
......@@ -154,8 +152,6 @@ class DragControls extends EventDispatcher {
function onPointerDown( event ) {
event.preventDefault();
switch ( event.pointerType ) {
case 'mouse':
......@@ -169,9 +165,7 @@ class DragControls extends EventDispatcher {
}
function onMouseDown( event ) {
event.preventDefault();
function onMouseDown() {
_intersections.length = 0;
......@@ -200,8 +194,6 @@ class DragControls extends EventDispatcher {
function onPointerCancel( event ) {
event.preventDefault();
switch ( event.pointerType ) {
case 'mouse':
......@@ -215,9 +207,7 @@ class DragControls extends EventDispatcher {
}
function onMouseCancel( event ) {
event.preventDefault();
function onMouseCancel() {
if ( _selected ) {
......
......@@ -91,8 +91,6 @@ class FirstPersonControls {
}
event.preventDefault();
if ( this.activeLook ) {
switch ( event.button ) {
......@@ -110,8 +108,6 @@ class FirstPersonControls {
this.onMouseUp = function ( event ) {
event.preventDefault();
if ( this.activeLook ) {
switch ( event.button ) {
......@@ -145,8 +141,6 @@ class FirstPersonControls {
this.onKeyDown = function ( event ) {
//event.preventDefault();
switch ( event.code ) {
case 'ArrowUp':
......
......@@ -57,8 +57,6 @@ class FlyControls extends EventDispatcher {
}
//event.preventDefault();
switch ( event.code ) {
case 'ShiftLeft':
......@@ -123,14 +121,6 @@ class FlyControls extends EventDispatcher {
this.mousedown = function ( event ) {
if ( this.domElement !== document ) {
this.domElement.focus();
}
event.preventDefault();
if ( this.dragToLook ) {
this.mouseStatus ++;
......@@ -169,8 +159,6 @@ class FlyControls extends EventDispatcher {
this.mouseup = function ( event ) {
event.preventDefault();
if ( this.dragToLook ) {
this.mouseStatus --;
......
......@@ -841,14 +841,6 @@ class OrbitControls extends EventDispatcher {
function onMouseDown( event ) {
// Prevent the browser from scrolling.
event.preventDefault();
// Manually set the focus since calling preventDefault above
// prevents the browser from setting it automatically.
scope.domElement.focus ? scope.domElement.focus() : window.focus();
let mouseAction;
switch ( event.button ) {
......@@ -951,8 +943,6 @@ class OrbitControls extends EventDispatcher {
if ( scope.enabled === false ) return;
event.preventDefault();
switch ( state ) {
case STATE.ROTATE:
......
......@@ -491,8 +491,6 @@ class TrackballControls extends EventDispatcher {
function onMouseDown( event ) {
event.preventDefault();
if ( _state === STATE.NONE ) {
switch ( event.button ) {
......@@ -546,8 +544,6 @@ class TrackballControls extends EventDispatcher {
if ( scope.enabled === false ) return;
event.preventDefault();
const state = ( _keyState !== STATE.NONE ) ? _keyState : _state;
if ( state === STATE.ROTATE && ! scope.noRotate ) {
......@@ -567,12 +563,10 @@ class TrackballControls extends EventDispatcher {
}
function onMouseUp( event ) {
function onMouseUp() {
if ( scope.enabled === false ) return;
event.preventDefault();
_state = STATE.NONE;
scope.domElement.ownerDocument.removeEventListener( 'pointermove', onPointerMove );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册