Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove inspector component to properly unregister keydown listener #774

Merged
merged 1 commit into from
Nov 14, 2024

Conversation

vincentfretin
Copy link
Contributor

Remove inspector component to properly unregister the keydown listener registered in the inspector component when the inspector is loaded via a script tag like here

<script src="../dist/aframe-inspector.js"></script>

otherwise the listener will be registered twice and we can't toggle the inspector from viewer mode with the shortcut (it will toggle the inspector and toggle back to viewer mode right away)
When loaded via script tag, removeEventListeners is not executed
https://github.com/aframevr/aframe/blob/9cdc30465247685a69067eb5beb0d177367eebc9/src/components/scene/inspector.js#L104
removing the component will execute removeEventListeners
https://github.com/aframevr/aframe/blob/9cdc30465247685a69067eb5beb0d177367eebc9/src/components/scene/inspector.js#L57

…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.
@vincentfretin
Copy link
Contributor Author

@dmarcos

@dmarcos
Copy link
Member

dmarcos commented Nov 14, 2024

Thanks!

@dmarcos dmarcos merged commit a432918 into aframevr:master Nov 14, 2024
1 check passed
@vincentfretin vincentfretin deleted the fix-toggle-from-viewer-mode branch November 14, 2024 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants