Notifications: hovering eject button will show tooltip even with idle mouse
This commit is contained in:
parent
4865ca65e8
commit
7831b4bd07
@ -789,6 +789,7 @@ void NotificationManager::ExportFinishedNotification::render_eject_button(ImGuiW
|
|||||||
ImVec2(win_pos.x - m_line_height * 2.5f, win_pos.y + win_size.y),
|
ImVec2(win_pos.x - m_line_height * 2.5f, win_pos.y + win_size.y),
|
||||||
true))
|
true))
|
||||||
{
|
{
|
||||||
|
|
||||||
button_text = ImGui::EjectHoverButton;
|
button_text = ImGui::EjectHoverButton;
|
||||||
// tooltip
|
// tooltip
|
||||||
long time_now = wxGetLocalTime();
|
long time_now = wxGetLocalTime();
|
||||||
@ -798,12 +799,21 @@ void NotificationManager::ExportFinishedNotification::render_eject_button(ImGuiW
|
|||||||
imgui.text(_u8L("Eject drive") + " " + GUI::shortkey_ctrl_prefix() + "T");
|
imgui.text(_u8L("Eject drive") + " " + GUI::shortkey_ctrl_prefix() + "T");
|
||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
|
// somehow the tooltip wont show if the render doesnt run twice
|
||||||
|
if (m_hover_once) {
|
||||||
|
wxGetApp().plater()->get_current_canvas3D()->schedule_extra_frame(0);
|
||||||
|
m_hover_once = false;
|
||||||
}
|
}
|
||||||
if (m_hover_time == 0)
|
}
|
||||||
|
if (m_hover_time == 0) {
|
||||||
m_hover_time = time_now;
|
m_hover_time = time_now;
|
||||||
} else
|
m_hover_once = true;
|
||||||
|
wxGetApp().plater()->get_current_canvas3D()->schedule_extra_frame(1500);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
m_hover_time = 0;
|
m_hover_time = 0;
|
||||||
|
m_hover_once = false;
|
||||||
|
}
|
||||||
ImVec2 button_pic_size = ImGui::CalcTextSize(button_text.c_str());
|
ImVec2 button_pic_size = ImGui::CalcTextSize(button_text.c_str());
|
||||||
ImVec2 button_size(button_pic_size.x * 1.25f, button_pic_size.y * 1.25f);
|
ImVec2 button_size(button_pic_size.x * 1.25f, button_pic_size.y * 1.25f);
|
||||||
ImGui::SetCursorPosX(win_size.x - m_line_height * 5.0f);
|
ImGui::SetCursorPosX(win_size.x - m_line_height * 5.0f);
|
||||||
@ -828,6 +838,15 @@ void NotificationManager::ExportFinishedNotification::render_eject_button(ImGuiW
|
|||||||
}
|
}
|
||||||
ImGui::PopStyleColor(5);
|
ImGui::PopStyleColor(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NotificationManager::ExportFinishedNotification::update_state(bool paused, const int64_t delta)
|
||||||
|
{
|
||||||
|
bool ret = PopNotification::update_state(paused, delta);
|
||||||
|
if (!ret && m_hover_time != 0 && m_hover_time < wxGetLocalTime())
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool NotificationManager::ExportFinishedNotification::on_text_click()
|
bool NotificationManager::ExportFinishedNotification::on_text_click()
|
||||||
{
|
{
|
||||||
open_folder(m_export_dir_path);
|
open_folder(m_export_dir_path);
|
||||||
|
@ -668,6 +668,8 @@ private:
|
|||||||
bool m_to_removable;
|
bool m_to_removable;
|
||||||
std::string m_export_path;
|
std::string m_export_path;
|
||||||
std::string m_export_dir_path;
|
std::string m_export_dir_path;
|
||||||
|
|
||||||
|
bool update_state(bool paused, const int64_t delta) override;
|
||||||
protected:
|
protected:
|
||||||
// Reserves space on right for more buttons
|
// Reserves space on right for more buttons
|
||||||
void count_spaces() override;
|
void count_spaces() override;
|
||||||
@ -687,6 +689,7 @@ private:
|
|||||||
void on_eject_click();
|
void on_eject_click();
|
||||||
// local time of last hover for showing tooltip
|
// local time of last hover for showing tooltip
|
||||||
long m_hover_time { 0 };
|
long m_hover_time { 0 };
|
||||||
|
bool m_hover_once { false };
|
||||||
bool m_eject_pending { false };
|
bool m_eject_pending { false };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user