notifications: avoid collision with gizmos on same position by moving to left

This commit is contained in:
David Kocik 2020-10-02 10:26:11 +02:00
parent ec6599da98
commit 092a9f80b6
5 changed files with 50 additions and 10 deletions

View file

@ -215,6 +215,8 @@ void GLCanvas3D::LayersEditing::set_enabled(bool enabled)
m_enabled = is_allowed() && enabled;
}
float GLCanvas3D::LayersEditing::s_overelay_window_width;
void GLCanvas3D::LayersEditing::render_overlay(const GLCanvas3D& canvas) const
{
if (!m_enabled)
@ -297,6 +299,7 @@ void GLCanvas3D::LayersEditing::render_overlay(const GLCanvas3D& canvas) const
if (imgui.button(_L("Reset")))
wxPostEvent((wxEvtHandler*)canvas.get_wxglcanvas(), SimpleEvent(EVT_GLCANVAS_RESET_LAYER_HEIGHT_PROFILE));
GLCanvas3D::LayersEditing::s_overelay_window_width = ImGui::GetWindowSize().x /*+ (float)m_layers_texture.width/4*/;
imgui.end();
const Rect& bar_rect = get_bar_rect_viewport(canvas);
@ -1426,6 +1429,16 @@ void GLCanvas3D::Tooltip::render(const Vec2d& mouse_position, GLCanvas3D& canvas
}
#if ENABLE_SLOPE_RENDERING
float GLCanvas3D::Slope::s_window_width;
void GLCanvas3D::Slope::show_dialog(bool show) {
if (show && is_used())
return; use(show);
m_dialog_shown = show;
wxGetApp().plater()->get_notification_manager()->set_move_from_slope(show);
}
void GLCanvas3D::Slope::render() const
{
if (m_dialog_shown) {
@ -1482,6 +1495,8 @@ void GLCanvas3D::Slope::render() const
if (ImGui::GetWindowContentRegionWidth() + 2.0f * ImGui::GetStyle().WindowPadding.x != ImGui::CalcWindowExpectedSize(ImGui::GetCurrentWindow()).x)
m_canvas.request_extra_frame();
s_window_width = ImGui::GetWindowSize().x;
imgui.end();
if (modified)
@ -2151,7 +2166,7 @@ void GLCanvas3D::render()
wxGetApp().plater()->get_mouse3d_controller().render_settings_dialog(*this);
wxGetApp().plater()->get_notification_manager()->render_notifications(*this);
wxGetApp().plater()->get_notification_manager()->render_notifications(*this, get_overelay_window_width(), get_slope_window_width());
wxGetApp().imgui()->render();