mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-24 04:54:29 +08:00
Merge branch 'dk_notif_stable' into stable
This commit is contained in:
commit
f78051aefd
@ -413,12 +413,15 @@ void NotificationManager::PopNotification::init()
|
||||
if (ImGui::CalcTextSize(text.substr(last_end).c_str()).x >= m_window_width - m_window_width_offset) {
|
||||
// more than one line till end
|
||||
int next_space = text.find_first_of(' ', last_end);
|
||||
if (next_space > 0) {
|
||||
if (next_space > 0 && next_space < text.length()) {
|
||||
int next_space_candidate = text.find_first_of(' ', next_space + 1);
|
||||
while (next_space_candidate > 0 && ImGui::CalcTextSize(text.substr(last_end, next_space_candidate - last_end).c_str()).x < m_window_width - m_window_width_offset) {
|
||||
next_space = next_space_candidate;
|
||||
next_space_candidate = text.find_first_of(' ', next_space + 1);
|
||||
}
|
||||
} else {
|
||||
next_space = text.length();
|
||||
}
|
||||
// when one word longer than line.
|
||||
if (ImGui::CalcTextSize(text.substr(last_end, next_space - last_end).c_str()).x > m_window_width - m_window_width_offset) {
|
||||
float width_of_a = ImGui::CalcTextSize("a").x;
|
||||
@ -433,7 +436,6 @@ void NotificationManager::PopNotification::init()
|
||||
last_end = next_space + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_endlines.push_back(text.length());
|
||||
last_end = text.length();
|
||||
|
Loading…
x
Reference in New Issue
Block a user