File tree Expand file tree Collapse file tree
crates/renzora_inspector/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -117,6 +117,36 @@ impl EditorPanel for InspectorPanel {
117117 }
118118 }
119119
120+ // Component search/filter bar
121+ ui. add_space ( 4.0 ) ;
122+ ui. horizontal ( |ui| {
123+ ui. add_space ( 4.0 ) ;
124+ let has_filter = !state. component_filter . is_empty ( ) ;
125+ let clear_width = if has_filter { 20.0 } else { 0.0 } ;
126+ let search_width = ui. available_width ( ) - clear_width - 12.0 ;
127+ ui. add (
128+ egui:: TextEdit :: singleline ( & mut state. component_filter )
129+ . desired_width ( search_width)
130+ . hint_text ( format ! ( "{} Filter components..." , regular:: MAGNIFYING_GLASS ) ) ,
131+ ) ;
132+ if has_filter
133+ && ui
134+ . add (
135+ egui:: Button :: new (
136+ RichText :: new ( regular:: X )
137+ . size ( 11.0 )
138+ . color ( theme. text . muted . to_color32 ( ) ) ,
139+ )
140+ . frame ( false ) ,
141+ )
142+ . clicked ( )
143+ {
144+ state. component_filter . clear ( ) ;
145+ }
146+ } ) ;
147+
148+ let filter = state. component_filter . to_lowercase ( ) ;
149+
120150 // Render each component section
121151 egui:: ScrollArea :: vertical ( )
122152 . id_salt ( "inspector_scroll" )
@@ -129,6 +159,12 @@ impl EditorPanel for InspectorPanel {
129159 if !( entry. has_fn ) ( world, entity) {
130160 continue ;
131161 }
162+ if !filter. is_empty ( )
163+ && !entry. display_name . to_lowercase ( ) . contains ( & filter)
164+ && !entry. category . to_lowercase ( ) . contains ( & filter)
165+ {
166+ continue ;
167+ }
132168 any_shown = true ;
133169
134170 if let Some ( remove_fn) = entry. remove_fn {
Original file line number Diff line number Diff line change 33pub struct InspectorState {
44 pub show_add_overlay : bool ,
55 pub add_search : String ,
6+ pub component_filter : String ,
67}
You can’t perform that action at this time.
0 commit comments