@@ -45,7 +45,6 @@ const state = {
4545 objects : new Map ( )
4646} ;
4747
48- // console.log('Panel script loaded');
4948
5049// Create a connection to the background page
5150const backgroundPageConnection = chrome . runtime . connect ( {
@@ -81,7 +80,6 @@ backgroundPageConnection.onDisconnect.addListener( () => {
8180
8281} ) ;
8382
84- // console.log('Connected to background page with tab ID:', chrome.devtools.inspectedWindow.tabId);
8583
8684// Store renderer collapse states
8785const rendererCollapsedState = new Map ( ) ;
@@ -138,9 +136,6 @@ function handleThreeEvent( message ) {
138136 // Also update the generic objects map if renderers are stored there too
139137 state . objects . set ( detail . uuid , detail ) ;
140138
141- // The DOM update logic previously here is redundant because updateUI()
142- // rebuilds the entire renderer element anyway, using the updated data
143- // from state.renderers and the persisted open/closed state.
144139
145140 break ;
146141
@@ -397,23 +392,16 @@ function renderObject( obj, container, level = 0 ) {
397392 . filter ( child => child !== undefined )
398393 . sort ( ( a , b ) => {
399394
400- // Sort order: Cameras, Lights, Groups, Meshes, Others
401- const typeOrder = {
402- isCamera : 1 ,
403- isLight : 2 ,
404- isGroup : 3 ,
405- isMesh : 4
395+ const getTypeOrder = ( obj ) => {
396+ if ( obj . isCamera ) return 1 ;
397+ if ( obj . isLight ) return 2 ;
398+ if ( obj . isGroup ) return 3 ;
399+ if ( obj . isMesh ) return 4 ;
400+ return 5 ;
406401 } ;
407- // Refactored to avoid optional chaining parser error
408- const findOrder = ( obj ) => {
409402
410- const entry = Object . entries ( typeOrder ) . find ( ( [ key ] ) => obj [ key ] ) ;
411- return entry ? entry [ 1 ] : 5 ; // Check if entry exists, then access index 1 (value)
412-
413- } ;
414-
415- const aOrder = findOrder ( a ) ;
416- const bOrder = findOrder ( b ) ;
403+ const aOrder = getTypeOrder ( a ) ;
404+ const bOrder = getTypeOrder ( b ) ;
417405
418406 return aOrder - bOrder ;
419407
0 commit comments