Skip to content

Commit

Permalink
Remove inspector component to properly unregister keydown listener wh…
Browse files Browse the repository at this point in the history
…en the inspector is loaded via a script tag otherwise the listener will be registered twice and we can't toggle the inspector from viewer mode with the shortcut. (#774)
  • Loading branch information
vincentfretin authored Nov 14, 2024
1 parent ec38559 commit a432918
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ Inspector.prototype = {
},

initEvents: function () {
// Remove inspector component to properly unregister keydown listener when the inspector is loaded via a script tag,
// otherwise the listener will be registered twice and we can't toggle the inspector from viewer mode with the shortcut.
this.sceneEl.removeAttribute('inspector');
window.addEventListener('keydown', (evt) => {
// Alt + Ctrl + i: Shorcut to toggle the inspector
const shortcutPressed =
Expand Down

0 comments on commit a432918

Please sign in to comment.