more fixes to name -> color matching; more meta-type-tag usage fixes in reordering path

This commit is contained in:
Ryan Fleury
2025-04-28 17:13:22 -07:00
parent 1f1c4f161b
commit eb3b2572f1
2 changed files with 8 additions and 4 deletions
+1 -1
View File
@@ -3836,7 +3836,7 @@ rd_view_ui(Rng2F32 rect)
String8 group_cfg_name = {0}; String8 group_cfg_name = {0};
{ {
E_IRTreeAndType block_irtree = selection_block->eval.irtree; E_IRTreeAndType block_irtree = selection_block->eval.irtree;
E_TypeKey block_type_key = block_irtree.type_key; E_TypeKey block_type_key = e_type_key_unwrap(block_irtree.type_key, E_TypeUnwrapFlag_AllDecorative);
E_TypeKind block_type_kind = e_type_kind_from_key(block_type_key); E_TypeKind block_type_kind = e_type_kind_from_key(block_type_key);
if(block_type_kind == E_TypeKind_Set) if(block_type_kind == E_TypeKind_Set)
{ {
+7 -3
View File
@@ -2241,6 +2241,7 @@ ui_color_from_tags_key_name(UI_Key key, String8 name)
UI_ThemePattern *p = &theme->patterns[idx]; UI_ThemePattern *p = &theme->patterns[idx];
U64 match_count = 0; U64 match_count = 0;
B32 name_matches = 0; B32 name_matches = 0;
B32 all_p_tags_in_key = 1;
for EachIndex(p_tags_idx, p->tags.count) for EachIndex(p_tags_idx, p->tags.count)
{ {
B32 p_tag_in_key = 0; B32 p_tag_in_key = 0;
@@ -2249,7 +2250,10 @@ ui_color_from_tags_key_name(UI_Key key, String8 name)
String8 key_string = key_tags_idx < tags.count ? tags.v[key_tags_idx] : name; String8 key_string = key_tags_idx < tags.count ? tags.v[key_tags_idx] : name;
if(str8_match(p->tags.v[p_tags_idx], key_string, 0)) if(str8_match(p->tags.v[p_tags_idx], key_string, 0))
{ {
name_matches = (key_tags_idx == tags.count); if(key_tags_idx == tags.count)
{
name_matches = 1;
}
p_tag_in_key = 1; p_tag_in_key = 1;
match_count += 1; match_count += 1;
break; break;
@@ -2257,11 +2261,11 @@ ui_color_from_tags_key_name(UI_Key key, String8 name)
} }
if(!p_tag_in_key) if(!p_tag_in_key)
{ {
name_matches = 0; all_p_tags_in_key = 0;
break; break;
} }
} }
if(name_matches && match_count > best_match_count) if(name_matches && all_p_tags_in_key && match_count > best_match_count)
{ {
pattern = p; pattern = p;
best_match_count = match_count; best_match_count = match_count;