Skip to content

Commit

Permalink
remove automatically injected inspector component to fix shortcut con…
Browse files Browse the repository at this point in the history
…flict
  • Loading branch information
vincentfretin committed Nov 14, 2024
1 parent 3761bac commit 94ffe84
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,30 @@ require('./components/street-environment.js');
require('./components/intersection.js');
require('./components/obb-clipping.js');
require('./editor/index.js');
// import { inspector } from './editor/index.js';

// Remove automatically injected inspector component to fix shortcut conflict.
function removeInspectorComponent() {
setTimeout(() => {
document.querySelector('a-scene')?.removeAttribute('inspector');
}, 0);
}

function waitForDocumentReadyStateToRemoveInspectorComponent() {
if (document.readyState === 'complete') {
removeInspectorComponent();
return;
}

document.addEventListener('readystatechange', function onReadyStateChange() {
if (document.readyState !== 'complete') {
return;
}
document.removeEventListener('readystatechange', onReadyStateChange);
removeInspectorComponent();
});
}

waitForDocumentReadyStateToRemoveInspectorComponent();

const state = useStore.getState();

Expand Down

0 comments on commit 94ffe84

Please sign in to comment.