diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-05-18 22:05:19 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-05-18 22:08:41 +0200 |
commit | d123c41cd3ad4f0d55ae134be69e7ffd144dbb74 (patch) | |
tree | f46a8e6daea5b757f4b66363c64aea6269dd83a9 /src/Body.cpp | |
parent | f6a39afa8bfd869ba661799897ac37e7d1ff7c34 (diff) |
Add mention autocomplete
Diffstat (limited to 'src/Body.cpp')
-rw-r--r-- | src/Body.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Body.cpp b/src/Body.cpp index 2e267c5..4f2e816 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -484,6 +484,11 @@ namespace QuickMedia { // TODO: Use a render target for the whole body so all images can be put into one. // TODO: Load thumbnails with more than one thread. void Body::draw(sf::RenderWindow &window, sf::Vector2f pos, sf::Vector2f size, const Json::Value &content_progress) { + if(items_dirty) { + items_dirty = false; + filter_search_fuzzy(current_filter); + } + sf::Vector2f scissor_pos = pos; sf::Vector2f scissor_size = size; const float start_y = pos.y; @@ -1486,10 +1491,14 @@ namespace QuickMedia { } void Body::filter_search_fuzzy(const std::string &text) { + current_filter = text; + if(text.empty()) { for(auto &item : items) { item->visible = true; } + + select_first_item(); return; } @@ -1531,4 +1540,8 @@ namespace QuickMedia { page_scroll = scroll; clamp_selected_item_to_body_count = 1; } + + void Body::items_set_dirty() { + items_dirty = true; + } } |