未验证 提交 f696458d 编写于 作者: E Elias Hasle 提交者: GitHub

Merge pull request #11 from greggman/orbitcontrols-use-element

OrbitControls: get keydown events from scope.domElement
......@@ -258,7 +258,7 @@ THREE.OrbitControls = function ( object, domElement ) {
document.removeEventListener( 'mousemove', onMouseMove, false );
document.removeEventListener( 'mouseup', onMouseUp, false );
window.removeEventListener( 'keydown', onKeyDown, false );
scope.domElement.removeEventListener( 'keydown', onKeyDown, false );
//scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?
......@@ -1136,7 +1136,15 @@ THREE.OrbitControls = function ( object, domElement ) {
scope.domElement.addEventListener( 'touchend', onTouchEnd, false );
scope.domElement.addEventListener( 'touchmove', onTouchMove, false );
window.addEventListener( 'keydown', onKeyDown, false );
scope.domElement.addEventListener( 'keydown', onKeyDown, false );
// make sure element can receive keys.
if ( scope.domElement !== document && scope.domElement.tabIndex === -1) {
scope.domElement.tabIndex = 0;
}
// force an update at start
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册