f240c66ab6d8e661c6d73e975f1afa71ffc22e9f

Author
outfoxxed <outfoxxed@outfoxxed.me>
Committer
outfoxxed <outfoxxed@outfoxxed.me>
Date

Message

Fix tab spawn offset

Diff

 1diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp
 2index 6374163838111ecc84f0a91d7be9bf46e669ab5a..6d24aa9b58b5d072caf8a4f8a0794a9ab387ba1e 100644
 3--- a/src/TabGroup.cpp
 4+++ b/src/TabGroup.cpp
 5@@ -215,6 +215,7 @@ void Hy3TabBar::updateAnimations(bool warp) {
 6 
 7 	float entry_width = active_entries == 0 ? 0.0 : 1.0 / active_entries;
 8 	float offset = 0.0;
 9+	float real_offset = 0.0;
10 
11 	auto entry = this->entries.begin();
12 	while (entry != this->entries.end()) {
13@@ -230,11 +231,7 @@ void Hy3TabBar::updateAnimations(bool warp) {
14 			auto warp_init = entry->offset.goalf() == -1.0;
15 
16 			if (warp_init) {
17-				float start_offset = offset;
18-				if (entry == std::prev(this->entries.end())) start_offset += entry_width;
19-				else if (entry != this->entries.begin()) start_offset += (entry_width * 0.5);
20-
21-				entry->offset.setValueAndWarp(start_offset);
22+				entry->offset.setValueAndWarp(real_offset);
23 				entry->width.setValueAndWarp(0.0);
24 			}
25 
26@@ -243,6 +240,7 @@ void Hy3TabBar::updateAnimations(bool warp) {
27 		}
28 
29 		offset += entry->width.goalf();
30+		real_offset += entry->width.fl();
31 		entry = std::next(entry);
32 	}
33 }