aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-03-22 10:40:21 +0100
committerdec05eba <dec05eba@protonmail.com>2021-03-22 10:40:21 +0100
commit9ba59929c23c71a5231670a50c3fcb1165111c90 (patch)
treeddc7ff719f76c009410c96c09a34be5b75b9bc92 /include
parent4aec31515ff6f61f41dfd66551a3fce44f243535 (diff)
Fix touch scroll clamping to selected item, making it appear laggy. Fix emoji offset for non 1.0 scaling
Diffstat (limited to 'include')
-rw-r--r--include/Body.hpp13
-rw-r--r--include/Entry.hpp1
-rw-r--r--include/SearchBar.hpp1
-rw-r--r--include/Utils.hpp3
4 files changed, 12 insertions, 6 deletions
diff --git a/include/Body.hpp b/include/Body.hpp
index 869ce0b..53622e8 100644
--- a/include/Body.hpp
+++ b/include/Body.hpp
@@ -176,10 +176,10 @@ namespace QuickMedia {
bool select_next_page();
// Select previous item, ignoring invisible items. Returns true if the item was changed or if the item scrolled. This can be used to check if the top was hit when wrap_around is set to false
- bool select_previous_item(bool scroll_page_if_large_item = true);
+ bool select_previous_item(bool scroll_page_if_large_item = true, bool reset_select_scroll = true);
// Select next item, ignoring invisible items. Returns true if the item was changed or if the item scrolled. This can be used to check if the bottom was hit when wrap_around is set to false
- bool select_next_item(bool scroll_page_if_large_item = true);
+ bool select_next_item(bool scroll_page_if_large_item = true, bool reset_select_scroll = true);
void set_selected_item(int item, bool reset_prev_selected_item = true);
void reset_prev_selected_item();
@@ -214,7 +214,7 @@ namespace QuickMedia {
// This happens because of |draw| sets thumbnails as unreferenced at the beginning and cleans them up at the end if they are not drawn in the same function call.
// TODO: Right now drawing an item that also exists in the body will cause the text to update geometry every frame if the text is wrapping text and the items are drawn at different sizes,
// because of Text::setMaxWidth
- void draw_item(sf::RenderWindow &window, BodyItem *item, sf::Vector2f pos, sf::Vector2f size, bool include_embedded_item = true);
+ void draw_item(sf::RenderWindow &window, BodyItem *item, sf::Vector2f pos, sf::Vector2f size, bool include_embedded_item = true, bool is_embedded = false);
float get_item_height(BodyItem *item, float width, bool load_texture = true, bool include_embedded_item = true);
float get_spacing_y() const;
@@ -232,7 +232,7 @@ namespace QuickMedia {
int get_selected_item() const { return selected_item; }
bool is_selected_item_last_visible_item() const;
- void set_page_scroll(float scroll) { page_scroll = scroll; }
+ void set_page_scroll(float scroll);
float get_page_scroll() const { return page_scroll; }
// This is the item we can see the end of
bool is_last_item_fully_visible() const { return last_item_fully_visible; }
@@ -270,6 +270,7 @@ namespace QuickMedia {
sf::Sprite image;
sf::Sprite loading_icon;
int num_visible_items;
+ bool first_item_fully_visible;
bool last_item_fully_visible;
int first_fully_visible_item;
int last_fully_visible_item;
@@ -281,10 +282,10 @@ namespace QuickMedia {
bool items_cut_off = false;
float offset_to_top = 0.0f;
float offset_to_bottom = 0.0f;
- bool experimental_use_touch = false;
- bool mouse_state_set = false;
+ int clamp_selected_item_to_body_count = 1;
bool mouse_left_pressed = false;
bool mouse_left_clicked = false;
+ bool has_scrolled_with_input = false;
sf::Vector2f mouse_click_pos;
sf::Vector2f mouse_release_pos;
double mouse_press_pixels_moved_abs;
diff --git a/include/Entry.hpp b/include/Entry.hpp
index 32dcda2..10210f8 100644
--- a/include/Entry.hpp
+++ b/include/Entry.hpp
@@ -37,5 +37,6 @@ namespace QuickMedia {
float width;
sf::RoundedRectangleShape background;
sf::Text placeholder;
+ bool mouse_left_inside;
};
} \ No newline at end of file
diff --git a/include/SearchBar.hpp b/include/SearchBar.hpp
index 4c9757c..b2cdf4d 100644
--- a/include/SearchBar.hpp
+++ b/include/SearchBar.hpp
@@ -67,6 +67,7 @@ namespace QuickMedia {
bool input_masked;
bool typing;
bool backspace_pressed;
+ bool mouse_left_inside;
float vertical_pos;
sf::Clock time_since_search_update;
};
diff --git a/include/Utils.hpp b/include/Utils.hpp
index 7ca409c..c1448f4 100644
--- a/include/Utils.hpp
+++ b/include/Utils.hpp
@@ -2,4 +2,7 @@
namespace QuickMedia {
float get_ui_scale();
+ void show_virtual_keyboard();
+ void hide_virtual_keyboard();
+ bool is_touch_enabled();
} \ No newline at end of file