Focus bugfix

This commit is contained in:
Synthasmagoria 2026-08-01 14:14:51 +02:00
commit 16d456a10f
2 changed files with 12 additions and 11 deletions

12
ui.odin
View file

@ -119,18 +119,14 @@ same_line :: proc() {
ctx.same_line = true
}
focus_next_element :: proc(id: ElementId, allowed_focus: bit_set[ElementType]) -> ElementId {
focus_next_element :: proc(id: ElementId, elements: []Element, allowed_focus: bit_set[ElementType]) -> ElementId {
if id == element_id_invalid() {
return element_id_invalid()
}
element_index := int(id.element_index)
if element_index + 1 >= len(ctx.elements) {
return element_id_invalid()
}
element_index += 1
for element_index < len(ctx.elements) {
if ctx.elements[element_index].type in allowed_focus {
return ctx.elements[element_index].id
for element_index < len(elements) {
if elements[element_index].type in allowed_focus {
return elements[element_index].id
}
element_index += 1
}