mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 17:15:53 +08:00
ImguiDoubleSlider: Notifications placement to avoid overlapping with sliders
This commit is contained in:
parent
f90ea2e8be
commit
b02e0e6fd1
@ -334,6 +334,20 @@ void Preview::render_sliders(GLCanvas3D& canvas, float extra_scale/* = 0.1f*/)
|
|||||||
m_moves_slider->Render(canvas_width, canvas_height, extra_scale);
|
m_moves_slider->Render(canvas_width, canvas_height, extra_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float Preview::get_moves_slider_height()
|
||||||
|
{
|
||||||
|
if (m_moves_slider && m_moves_slider->IsShown())
|
||||||
|
return m_moves_slider->GetHeight();
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
float Preview::get_layers_slider_width()
|
||||||
|
{
|
||||||
|
if (m_layers_slider && m_layers_slider->IsShown())
|
||||||
|
return m_layers_slider->GetWidth();
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
void Preview::bind_event_handlers()
|
void Preview::bind_event_handlers()
|
||||||
{
|
{
|
||||||
Bind(wxEVT_SIZE, &Preview::on_size, this);
|
Bind(wxEVT_SIZE, &Preview::on_size, this);
|
||||||
|
@ -136,6 +136,8 @@ public:
|
|||||||
void msw_rescale();
|
void msw_rescale();
|
||||||
|
|
||||||
void render_sliders(GLCanvas3D& canvas, float extra_scale = 0.1f);
|
void render_sliders(GLCanvas3D& canvas, float extra_scale = 0.1f);
|
||||||
|
float get_layers_slider_width();
|
||||||
|
float get_moves_slider_height();
|
||||||
|
|
||||||
bool is_loaded() const { return m_loaded; }
|
bool is_loaded() const { return m_loaded; }
|
||||||
|
|
||||||
|
@ -67,6 +67,8 @@ public:
|
|||||||
m_size = size;
|
m_size = size;
|
||||||
m_draw_opts.scale = scale;
|
m_draw_opts.scale = scale;
|
||||||
}
|
}
|
||||||
|
ImVec2 GetCtrlSize() { return m_size; }
|
||||||
|
ImVec2 GetCtrlPos() { return m_pos; }
|
||||||
|
|
||||||
void Show(bool show) { m_is_shown = show; }
|
void Show(bool show) { m_is_shown = show; }
|
||||||
void Hide() { m_is_shown = false; }
|
void Hide() { m_is_shown = false; }
|
||||||
@ -239,6 +241,8 @@ public:
|
|||||||
void SetEmUnit(int em_unit) { m_em = em_unit; }
|
void SetEmUnit(int em_unit) { m_em = em_unit; }
|
||||||
void ShowLowerThumb(bool show) { m_ctrl.ShowLowerThumb(show); }
|
void ShowLowerThumb(bool show) { m_ctrl.ShowLowerThumb(show); }
|
||||||
|
|
||||||
|
float GetWidth() { return m_ctrl.GetCtrlSize().x; }
|
||||||
|
float GetHeight() { return m_ctrl.GetCtrlSize().y; }
|
||||||
virtual void Render(const int canvas_width, const int canvas_height, float extra_scale = 1.f) = 0;
|
virtual void Render(const int canvas_width, const int canvas_height, float extra_scale = 1.f) = 0;
|
||||||
|
|
||||||
void set_callback_on_thumb_move(std::function<void()> cb) { m_cb_thumb_move = cb; };
|
void set_callback_on_thumb_move(std::function<void()> cb) { m_cb_thumb_move = cb; };
|
||||||
|
@ -174,6 +174,14 @@ void NotificationManager::PopNotification::render(GLCanvas3D& canvas, float init
|
|||||||
m_top_y = initial_y + m_window_height;
|
m_top_y = initial_y + m_window_height;
|
||||||
|
|
||||||
ImVec2 win_pos(1.0f * (float)cnv_size.get_width() - right_gap, 1.0f * (float)cnv_size.get_height() - m_top_y);
|
ImVec2 win_pos(1.0f * (float)cnv_size.get_width() - right_gap, 1.0f * (float)cnv_size.get_height() - m_top_y);
|
||||||
|
|
||||||
|
if (wxGetApp().plater()->is_preview_shown()) {
|
||||||
|
if (Preview* preview = dynamic_cast<Preview*>(canvas.get_wxglcanvas()->GetParent())) {
|
||||||
|
win_pos.y -= 1.5f * preview->get_moves_slider_height();
|
||||||
|
win_pos.x -= preview->get_layers_slider_width();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ImGuiPureWrap::set_next_window_pos(win_pos.x, win_pos.y, ImGuiCond_Always, 1.0f, 0.0f);
|
ImGuiPureWrap::set_next_window_pos(win_pos.x, win_pos.y, ImGuiCond_Always, 1.0f, 0.0f);
|
||||||
ImGuiPureWrap::set_next_window_size(m_window_width, m_window_height, ImGuiCond_Always);
|
ImGuiPureWrap::set_next_window_size(m_window_width, m_window_height, ImGuiCond_Always);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user