aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-06-07 16:34:55 +0200
committerdec05eba <dec05eba@protonmail.com>2021-06-07 16:34:55 +0200
commitda95623137f85b07abf9f56035c23819af1e7fe9 (patch)
treed8bf7bf3ed22e3ec0f7e65598b79bb98c91e59b3 /src
parenta35a344697c4ccdda0a87960d058f8ede2bb2cd2 (diff)
Revert back to instant move on low fps as before (idle fps), fix top offset for bottom attach
Diffstat (limited to 'src')
-rw-r--r--src/Body.cpp13
-rw-r--r--src/QuickMedia.cpp6
2 files changed, 11 insertions, 8 deletions
diff --git a/src/Body.cpp b/src/Body.cpp
index e04bc56..3df816c 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -564,8 +564,11 @@ namespace QuickMedia {
size.x = std::max(0.0f, size.x - body_spacing[body_theme].body_padding_horizontal * 2.0f);
float frame_time = frame_timer.restart().asSeconds();
- if(frame_time > 0.01666f)
- frame_time = 0.01666f;
+ if(frame_time > 1.0f)
+ frame_time = 1.0f;
+ // TODO: Remove the need for this. This is needed because fps is changed to 20 or 2 when idle. That idle handler should be removed
+ //if(frame_time > 0.01666f)
+ // frame_time = 0.01666f;
if(selected_item >= (int)items.size())
selected_item = (int)items.size() - 1;
@@ -714,8 +717,8 @@ namespace QuickMedia {
const float item_background_move_speed = instant_move ? 1000.0f : speed;
sf::Vector2f item_background_new_pos = item_background_prev_pos + (item_background_pos_diff * std::min(1.0f, frame_time * item_background_move_speed));
if(selected_item_fits_in_body) {
- item_background_new_pos.y = std::min(item_background_new_pos.y, size.y - item_background_new_size.y - body_spacing[body_theme].spacing_y);
- item_background_new_pos.y = std::max(item_background_new_pos.y, body_spacing[body_theme].body_padding_vertical);
+ item_background_new_pos.y = std::min(item_background_new_pos.y, size.y - item_background_new_size.y);
+ item_background_new_pos.y = std::max(item_background_new_pos.y, 0.0f);
}
item_background_prev_pos = item_background_new_pos;
@@ -754,7 +757,7 @@ namespace QuickMedia {
if(is_touch_enabled())
return;
- const float item_target_top_diff = item_background_target_pos.y - selected_scrolled - body_spacing[body_theme].body_padding_vertical;
+ const float item_target_top_diff = item_background_target_pos.y - selected_scrolled - (attach_side == AttachSide::TOP ? body_spacing[body_theme].body_padding_vertical : 0.0f);
const float item_target_bottom_diff = (item_background_target_pos.y - selected_scrolled + item_background_target_size.y + body_spacing[body_theme].spacing_y) - size.y;
if(item_target_top_diff < 0.0f || !selected_item_fits_in_body) {
//extra_scroll_target -= item_target_top_diff;
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index dccdf11..3338048 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -5633,7 +5633,7 @@ namespace QuickMedia {
tab_vertical_offset = std::floor(10.0f * get_ui_scale());
}
- tab_shade_height = std::floor(tab_vertical_offset) + Tabs::get_height() + room_name_padding_y;
+ tab_shade_height = std::floor(tab_vertical_offset) + Tabs::get_shade_height() + room_name_padding_y;
const float body_width = window_size.x;
@@ -6740,8 +6740,8 @@ namespace QuickMedia {
if(redraw) {
redraw = false;
get_body_dimensions(window_size, search_bar.get(), body_pos, body_size);
- body_pos.y += std::floor(10.0f * get_ui_scale()) + Tabs::get_height();
- body_size.y -= std::floor(10.0f * get_ui_scale()) + Tabs::get_height();
+ body_pos.y += Tabs::get_shade_height();
+ body_size.y -= Tabs::get_shade_height();
save_button.set_position(window_size - sf::Vector2f(save_button.get_width(), save_button.get_height()) - sf::Vector2f(bottom_panel_padding, bottom_panel_padding));
cancel_button.set_position(save_button.get_position() - sf::Vector2f(cancel_button.get_width() + bottom_panel_spacing, 0.0f));
file_name_label.setPosition(sf::Vector2f(bottom_panel_spacing, std::floor(window_size.y - bottom_panel_padding - file_name_entry.get_height() * 0.5f - file_name_label.getLocalBounds().height * 0.5f - 5.0f * get_ui_scale())));