Skip to content

Commit

Permalink
fix(examples): fix key events in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mgermerie authored and gchoqueux committed Dec 16, 2020
1 parent b56aaaf commit c187616
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Core/Prefab/PlanarView.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ class PlanarView extends View {
placement.heading = placement.heading || 0;
placement.range = placement.range || max;

CameraUtils.transformCameraToLookAtTarget(this, camera3D, placement);

if (!options.noControls) {
this.controls = new PlanarControls(this, options.controls);
}

CameraUtils.transformCameraToLookAtTarget(this, camera3D, placement);

this.tileLayer = tileLayer;
}

Expand Down
5 changes: 4 additions & 1 deletion src/Core/View.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,10 @@ class View extends THREE.EventDispatcher {
this._fullSizeDepthBuffer = new Uint8Array(4 * this.camera.width * this.camera.height);
this._pixelDepthBuffer = new Uint8Array(4);

// Focus needed to capture some key events.
// Indicates that view's domElement can be focused (the negative value indicates that domElement can't be
// 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();

// push all viewer to keep source.cache
Expand Down

0 comments on commit c187616

Please sign in to comment.