From 2e1c8ad7251eb87ea93a27b3631e4b3393a589b7 Mon Sep 17 00:00:00 2001 From: Michael Mainguy Date: Fri, 7 Nov 2025 13:07:15 -0600 Subject: [PATCH] Fix inspector 'i' key registration in KeyboardInput MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: - main.ts registered inspector with window.addEventListener - keyboardInput.ts used document.onkeydown which replaces event handler - This caused the inspector key binding to be overridden Solution: - Moved inspector 'i' key handling into KeyboardInput class - Removed duplicate setupInspector() method from main.ts - Inspector now opens correctly when 'i' is pressed Changes: - src/keyboardInput.ts: Added 'i' key case to open Babylon Inspector - src/main.ts: Removed setupInspector() method (no longer needed) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- public/assets/themes/default/models/ship.glb | Bin 531936 -> 535368 bytes src/keyboardInput.ts | 9 +++++++++ src/main.ts | 15 --------------- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/public/assets/themes/default/models/ship.glb b/public/assets/themes/default/models/ship.glb index cd81881e4fe78629ae0f69ca80eed2472aec51e9..51f1f882c1f9eda577c05254c877ec998f0e3c71 100644 GIT binary patch delta 3051 zcma)6TWAz#6h515uI3&SV>HQTOuZzN&0KbFYcdl}Gzx8k5=79b(IzI43z#jvr0H0s zl-g1%Q>rg5*ggrRQbJowY&R9!S`b<&wbF-TL4B%kc`fvunSa*VWG80Gf6jL<|2f|| zGn)rXu{-x-73Zgh59R^Dp^joWQ+K7}ZXPdQ`RiMopXa8><|eqL$a6EJ(_>tc>wD?! z7{_xLW>cf7$=Mk$c|zbjg}9)Kx?%`&LJ&k<(xe10@Iu@$bU{xTf~2Xktg6}w&&{11 zox(aNgt#b*f+{O|Le&*nQd9{qWcx;QInjq@QWr*N=B6?f;t5e!3|$u#RaFet&=s#c z_Lp>7lQkrz@||)#k-)gFsk$U5Bt>4l5_vaTfnx@ybH0wY^PSUi(3n?7dlI&RT0Dap|H7ElXz}=^c5UZ;@o&VrUew|&7q;YS62XW_Rmu3Ls5wuP z(Aw;LQdXKT3i{%WvWHP;u%dB`t|oZy?5nA!Ih5-aay1U)J;D579dF1$4)%8&vwNuM{Q`XPVBq`7+IfpK*@T%+ zqt7JlH^x|+Eb<2jU_Q4F;gzV8#*8s(&Wq9 zD63;Yt`;rsQ@eFPER0Yg|n)&$2TQmyO%Vv4W0`AGv$Ns!+!o9Ed zhUuGw%O;#`N-iZM^j=KgKJ_vB@h4SL(q#4C>an{S$mj^1v8b`H0b-Wd*we>8Y_{MJ zY#gF*+;6d{@sTf2BiW1QQycx*_%RNwx213>(zXv$$Z9z=sW*AHO_Lr!@|qc@AMIQ= zf9ikJ4AbQ}F*VN8Hacj+hwiF#>tURf8i(ok{%x`DVB;_yfhcT(2%ci7fF@`|*#>n` z56^+U8`W;u3XQM_Vkl!!4SRtH8Kn&Sp$`(Eq150Y41f+@D7(OfO6UX?r3wwO1r(4_ zO0XGfL4*#J9Z(M4& { switch (ev.key) { + case 'i': + // Open Babylon Inspector + import("@babylonjs/inspector").then((inspector) => { + inspector.Inspector.Show(this._scene, { + overlay: true, + showExplorer: true, + }); + }); + break; case '1': this._onCameraChangeObservable.notifyObservers(1); break; diff --git a/src/main.ts b/src/main.ts index 5768993..55436df 100644 --- a/src/main.ts +++ b/src/main.ts @@ -256,7 +256,6 @@ export class Main { this._audioEngine = await CreateAudioEngineAsync(); - this.setupInspector(); window.setTimeout(()=>{ if (!this._started) { this._started = true; @@ -286,20 +285,6 @@ export class Main { DefaultScene.MainScene.collisionsEnabled = true; } - - private setupInspector() { - setLoadingMessage("Initializing Inspector..."); - window.addEventListener("keydown", (ev) => { - if (ev.key == 'i') { - import ("@babylonjs/inspector").then((inspector) => { - inspector.Inspector.Show(DefaultScene.MainScene, { - overlay: true, - showExplorer: true - }); - }); - } - }); - } } // Setup router