mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-24 05:28:04 +08:00
GLCanvas on_idle changes to do updates on notifications correctly. Changed updating separators in GLToolbar.
This commit is contained in:
parent
2659ac567a
commit
3f11b7dea5
@ -2382,7 +2382,7 @@ void GLCanvas3D::on_size(wxSizeEvent& evt)
|
|||||||
{
|
{
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas3D::on_idle(wxIdleEvent& evt)
|
void GLCanvas3D::on_idle(wxIdleEvent& evt)
|
||||||
{
|
{
|
||||||
if (!m_initialized)
|
if (!m_initialized)
|
||||||
@ -2395,7 +2395,7 @@ void GLCanvas3D::on_idle(wxIdleEvent& evt)
|
|||||||
|
|
||||||
m_dirty |= notification_mgr->requires_render();
|
m_dirty |= notification_mgr->requires_render();
|
||||||
#endif // ENABLE_NEW_NOTIFICATIONS_FADE_OUT
|
#endif // ENABLE_NEW_NOTIFICATIONS_FADE_OUT
|
||||||
|
// FIXME
|
||||||
m_dirty |= m_main_toolbar.update_items_state();
|
m_dirty |= m_main_toolbar.update_items_state();
|
||||||
m_dirty |= m_undoredo_toolbar.update_items_state();
|
m_dirty |= m_undoredo_toolbar.update_items_state();
|
||||||
m_dirty |= wxGetApp().plater()->get_view_toolbar().update_items_state();
|
m_dirty |= wxGetApp().plater()->get_view_toolbar().update_items_state();
|
||||||
@ -2404,23 +2404,17 @@ void GLCanvas3D::on_idle(wxIdleEvent& evt)
|
|||||||
m_dirty |= mouse3d_controller_applied;
|
m_dirty |= mouse3d_controller_applied;
|
||||||
|
|
||||||
#if ENABLE_NEW_NOTIFICATIONS_FADE_OUT
|
#if ENABLE_NEW_NOTIFICATIONS_FADE_OUT
|
||||||
if (!m_dirty) {
|
if (notification_mgr->requires_update()) {
|
||||||
if (notification_mgr->requires_update())
|
evt.RequestMore();
|
||||||
evt.RequestMore();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
#else
|
#endif // ENABLE_NEW_NOTIFICATIONS_FADE_OUT
|
||||||
|
|
||||||
if (!m_dirty)
|
if (!m_dirty)
|
||||||
return;
|
return;
|
||||||
#endif // ENABLE_NEW_NOTIFICATIONS_FADE_OUT
|
|
||||||
|
|
||||||
_refresh_if_shown_on_screen();
|
_refresh_if_shown_on_screen();
|
||||||
|
|
||||||
#if ENABLE_NEW_NOTIFICATIONS_FADE_OUT
|
|
||||||
if (m_extra_frame_requested || mouse3d_controller_applied || notification_mgr->requires_update()) {
|
|
||||||
#else
|
|
||||||
if (m_extra_frame_requested || mouse3d_controller_applied) {
|
if (m_extra_frame_requested || mouse3d_controller_applied) {
|
||||||
#endif // ENABLE_NEW_NOTIFICATIONS_FADE_OUT
|
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
m_extra_frame_requested = false;
|
m_extra_frame_requested = false;
|
||||||
evt.RequestMore();
|
evt.RequestMore();
|
||||||
|
@ -70,8 +70,8 @@ bool GLToolbarItem::update_visibility()
|
|||||||
bool ret = (m_data.visible != visible);
|
bool ret = (m_data.visible != visible);
|
||||||
if (ret)
|
if (ret)
|
||||||
m_data.visible = visible;
|
m_data.visible = visible;
|
||||||
|
// Return false for separator as it would always return true.
|
||||||
return ret;
|
return is_separator() ? false : ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GLToolbarItem::update_enabled_state()
|
bool GLToolbarItem::update_enabled_state()
|
||||||
|
@ -20,6 +20,8 @@ static constexpr float GAP_WIDTH = 10.0f;
|
|||||||
static constexpr float SPACE_RIGHT_PANEL = 10.0f;
|
static constexpr float SPACE_RIGHT_PANEL = 10.0f;
|
||||||
#if ENABLE_NEW_NOTIFICATIONS_FADE_OUT
|
#if ENABLE_NEW_NOTIFICATIONS_FADE_OUT
|
||||||
static constexpr float FADING_OUT_DURATION = 2.0f;
|
static constexpr float FADING_OUT_DURATION = 2.0f;
|
||||||
|
// Time in Miliseconds after next render is requested
|
||||||
|
static constexpr int FADING_OUT_TIMEOUT = 100;
|
||||||
#endif // ENABLE_NEW_NOTIFICATIONS_FADE_OUT
|
#endif // ENABLE_NEW_NOTIFICATIONS_FADE_OUT
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
@ -781,7 +783,7 @@ void NotificationManager::PopNotification::update_state()
|
|||||||
wxMilliClock_t curr_time = wxGetLocalTimeMillis() - m_fading_start;
|
wxMilliClock_t curr_time = wxGetLocalTimeMillis() - m_fading_start;
|
||||||
wxMilliClock_t no_render_time = wxGetLocalTimeMillis() - m_last_render_fading;
|
wxMilliClock_t no_render_time = wxGetLocalTimeMillis() - m_last_render_fading;
|
||||||
m_current_fade_opacity = std::clamp(1.0f - 0.001f * static_cast<float>(curr_time.GetValue()) / FADING_OUT_DURATION, 0.0f, 1.0f);
|
m_current_fade_opacity = std::clamp(1.0f - 0.001f * static_cast<float>(curr_time.GetValue()) / FADING_OUT_DURATION, 0.0f, 1.0f);
|
||||||
if (no_render_time > 100) {
|
if (no_render_time > FADING_OUT_TIMEOUT) {
|
||||||
m_last_render_fading = wxGetLocalTimeMillis();
|
m_last_render_fading = wxGetLocalTimeMillis();
|
||||||
m_state = EState::FadingOutRender;
|
m_state = EState::FadingOutRender;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user