Skip to content

Commit

Permalink
feature(View): Add option viewer to enable/disable focus on start.
Browse files Browse the repository at this point in the history
  • Loading branch information
gchoqueux committed May 11, 2022
1 parent 3c3f041 commit 88d7c93
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Core/View.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ class View extends THREE.EventDispatcher {
* @param {?Scene} [options.scene3D] - [THREE.Scene](https://threejs.org/docs/#api/en/scenes/Scene) instance to use, otherwise a default one will be constructed
* @param {?Color} options.diffuse - [THREE.Color](https://threejs.org/docs/?q=color#api/en/math/Color) Diffuse color terrain material.
* This color is applied to terrain if there isn't color layer on terrain extent (by example on pole).
* @param {boolean} [options.enableFocusOnStart=true] - enable focus on dom element on start.
*
* @constructor
*/
Expand Down Expand Up @@ -241,7 +242,9 @@ class View extends THREE.EventDispatcher {
// focused sequentially using tab key). Focus is needed to capture some key events.
this.domElement.tabIndex = -1;
// Set focus on view's domElement.
this.domElement.focus();
if (!options.disableFocusOnStart) {
this.domElement.focus();
}

// Create a custom `dblclick-right` event that is triggered when double right-clicking
let rightClickTimeStamp;
Expand Down

0 comments on commit 88d7c93

Please sign in to comment.