aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/Scale.hpp2
-rw-r--r--src/plugins/Matrix.cpp10
2 files changed, 8 insertions, 4 deletions
diff --git a/include/Scale.hpp b/include/Scale.hpp
index e7e1b27..375ddff 100644
--- a/include/Scale.hpp
+++ b/include/Scale.hpp
@@ -2,6 +2,8 @@
#include <SFML/System/Vector2.hpp>
+// TODO: Check if size is 0 before dividing to prevent division by 0?
+
namespace QuickMedia {
template<typename T>
static T wrap_to_size_x(const T &size, const T &clamp_size) {
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index d3e8117..a47b588 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -418,8 +418,8 @@ namespace QuickMedia {
void body_set_selected_item(Body *body, BodyItem *selected_item) {
for(size_t i = 0; i < body->items.size(); ++i) {
if(body->items[i]->url == selected_item->url) {
- body->set_selected_item(i);
- body->reset_prev_selected_item();
+ body->select_first_item();
+ body->set_selected_item(i, false);
return;
}
}
@@ -683,8 +683,10 @@ namespace QuickMedia {
body->items.insert(body->items.begin() + i, std::move(body_item_to_insert));
else
body->items.insert(body->items.begin() + (i - 1), std::move(body_item_to_insert));
- if((int)i < selected_item && room_body_index > selected_item && body->items.size() > 1 && i != body->items.size() - 1)
- body->set_selected_item(selected_item + 1);
+ if((int)i < selected_item && room_body_index > selected_item && body->items.size() > 1 && i != body->items.size() - 1) {
+ body->select_first_item();
+ body->set_selected_item(selected_item + 1, false);
+ }
return;
}
}