@@ -3055,43 +3055,34 @@ function _beaconTuneTab(ctx, el, cs, calData) {
30553055
30563056 const pickerRow = el ( "div" , { style : "display:flex;gap:8px;align-items:center;flex-wrap:wrap" } ) ;
30573057
3058- // Map selector for beacon placement (with floor groups, matching Setup tab)
3058+ // Floor selector for beacon placement
30593059 const bkMapSel = document . createElement ( "select" ) ;
30603060 bkMapSel . style . cssText = "min-width:120px;" ;
30613061 {
30623062 const _fl = ctx . state . model ?. floors || [ ] ;
30633063 const _floorMaps = new Map ( ) ;
30643064 for ( const m of sorted ) {
3065- const z = m . stack ?. z_level ?? 0 ;
3066- if ( ! _floorMaps . has ( z ) ) _floorMaps . set ( z , [ ] ) ;
3067- _floorMaps . get ( z ) . push ( m ) ;
3065+ const fid = m . floor_id || "main" ;
3066+ if ( ! _floorMaps . has ( fid ) ) _floorMaps . set ( fid , [ ] ) ;
3067+ _floorMaps . get ( fid ) . push ( m ) ;
30683068 }
3069- const _sortedZ = [ ..._floorMaps . keys ( ) ] . sort ( ( a , b ) => a - b ) ;
3070- if ( _sortedZ . length > 1 ) {
3071- const floorGroup = document . createElement ( "optgroup" ) ;
3072- floorGroup . label = "Floors" ;
3073- for ( const z of _sortedZ ) {
3074- const fObj = _fl . find ( f => f . level === z ) ;
3075- const fName = fObj ? ( fObj . name || `Floor ${ z } ` ) : `Floor ${ z } ` ;
3076- const opt = document . createElement ( "option" ) ;
3077- opt . value = `__floor__${ z } ` ;
3078- opt . textContent = `${ fName } (${ _floorMaps . get ( z ) . length } map${ _floorMaps . get ( z ) . length > 1 ? "s" : "" } )` ;
3079- floorGroup . appendChild ( opt ) ;
3080- }
3081- bkMapSel . appendChild ( floorGroup ) ;
3069+ // Floor entries only
3070+ for ( const f of _fl ) {
3071+ const fMaps = _floorMaps . get ( f . id ) || [ ] ;
3072+ if ( ! fMaps . length ) continue ;
3073+ const opt = document . createElement ( "option" ) ;
3074+ opt . value = `__floor__${ f . id } ` ;
3075+ opt . textContent = f . name || f . id ;
3076+ bkMapSel . appendChild ( opt ) ;
30823077 }
3083- const mapGroup = _sortedZ . length > 1 ? document . createElement ( "optgroup" ) : null ;
3084- if ( mapGroup ) mapGroup . label = "Maps" ;
3085- for ( const m of sorted ) {
3086- const z = m . stack ?. z_level ?? 0 ;
3087- const fObj = _fl . find ( f => f . level === z ) ;
3088- const fLabel = fObj ? ` (${ fObj . name || `Floor ${ z } ` } )` : "" ;
3078+ // Floors in maps but not in model
3079+ for ( const [ fid , fMaps ] of _floorMaps ) {
3080+ if ( _fl . some ( f => f . id === fid ) ) continue ;
30893081 const opt = document . createElement ( "option" ) ;
3090- opt . value = m . id ;
3091- opt . textContent = ( m . name || m . id ) + fLabel ;
3092- ( mapGroup || bkMapSel ) . appendChild ( opt ) ;
3082+ opt . value = `__floor__ ${ fid } ` ;
3083+ opt . textContent = fid ;
3084+ bkMapSel . appendChild ( opt ) ;
30933085 }
3094- if ( mapGroup ) bkMapSel . appendChild ( mapGroup ) ;
30953086 }
30963087
30973088 const bkSel = document . createElement ( "select" ) ;
@@ -3117,8 +3108,8 @@ function _beaconTuneTab(ctx, el, cs, calData) {
31173108 let targetMapId = bkMapSel . value ;
31183109 // Resolve floor selection to best map on that floor
31193110 if ( targetMapId . startsWith ( "__floor__" ) ) {
3120- const z = Number ( targetMapId . replace ( "__floor__" , "" ) ) ;
3121- const candidates = sorted . filter ( m => ( m . stack ?. z_level ?? 0 ) === z ) ;
3111+ const fid = targetMapId . replace ( "__floor__" , "" ) ;
3112+ const candidates = sorted . filter ( m => ( m . floor_id || "main" ) === fid ) ;
31223113 const best = candidates . slice ( ) . sort ( ( a , b ) => {
31233114 const ra = ( a . receivers || [ ] ) . length + Object . keys ( a . room_bounds || { } ) . length ;
31243115 const rb = ( b . receivers || [ ] ) . length + Object . keys ( b . room_bounds || { } ) . length ;
0 commit comments