mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-27 12:29:41 +00:00
Traverse item front to back for input events
This commit is contained in:
parent
d9c776eb57
commit
36243ccdf7
12 changed files with 97 additions and 47 deletions
|
@ -31,6 +31,7 @@ using internal::ComponentVTable;
|
|||
using ItemTreeNode = internal::ItemTreeNode<uint8_t>;
|
||||
using ComponentRef = VRef<ComponentVTable>;
|
||||
using ItemVisitorRefMut = VRefMut<internal::ItemVisitorVTable>;
|
||||
using internal::TraversalOrder;
|
||||
using internal::EasingCurve;
|
||||
using internal::TextHorizontalAlignment;
|
||||
using internal::TextVerticalAlignment;
|
||||
|
@ -177,12 +178,13 @@ struct Repeater
|
|||
}
|
||||
}
|
||||
|
||||
intptr_t visit(ItemVisitorRefMut visitor) const
|
||||
intptr_t visit(TraversalOrder order, ItemVisitorRefMut visitor) const
|
||||
{
|
||||
for (std::size_t i = 0; i < data.size(); ++i) {
|
||||
VRef<ComponentVTable> ref = item_at(i);
|
||||
if (ref.vtable->visit_children_item(ref, -1, visitor) != -1) {
|
||||
return i;
|
||||
int index = order == TraversalOrder::BackToFront ? i : data.size() - 1 - i;
|
||||
VRef<ComponentVTable> ref = item_at(index);
|
||||
if (ref.vtable->visit_children_item(ref, -1, order, visitor) != -1) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue