Prevented the sla gizmo dialog to overlap the bottom toolbar

This commit is contained in:
Lukas Matena 2019-03-04 14:52:08 +01:00
parent 58e4ace699
commit 02c68ed895
3 changed files with 26 additions and 16 deletions

View file

@ -769,7 +769,7 @@ void GLGizmoRotate3D::on_render(const GLCanvas3D::Selection& selection) const
}
#if ENABLE_IMGUI
void GLGizmoRotate3D::on_render_input_window(float x, float y, const GLCanvas3D::Selection& selection)
void GLGizmoRotate3D::on_render_input_window(float x, float y, float bottom_limit, const GLCanvas3D::Selection& selection)
{
#if !DISABLE_MOVE_ROTATE_SCALE_GIZMOS_IMGUI
Vec3d rotation(Geometry::rad2deg(m_gizmos[0].get_angle()), Geometry::rad2deg(m_gizmos[1].get_angle()), Geometry::rad2deg(m_gizmos[2].get_angle()));
@ -1056,7 +1056,7 @@ void GLGizmoScale3D::on_render_for_picking(const GLCanvas3D::Selection& selectio
}
#if ENABLE_IMGUI
void GLGizmoScale3D::on_render_input_window(float x, float y, const GLCanvas3D::Selection& selection)
void GLGizmoScale3D::on_render_input_window(float x, float y, float bottom_limit, const GLCanvas3D::Selection& selection)
{
#if !DISABLE_MOVE_ROTATE_SCALE_GIZMOS_IMGUI
bool single_instance = selection.is_single_full_instance();
@ -1307,7 +1307,7 @@ void GLGizmoMove3D::on_render_for_picking(const GLCanvas3D::Selection& selection
}
#if ENABLE_IMGUI
void GLGizmoMove3D::on_render_input_window(float x, float y, const GLCanvas3D::Selection& selection)
void GLGizmoMove3D::on_render_input_window(float x, float y, float bottom_limit, const GLCanvas3D::Selection& selection)
{
#if !DISABLE_MOVE_ROTATE_SCALE_GIZMOS_IMGUI
bool show_position = selection.is_single_full_instance();
@ -2272,7 +2272,7 @@ std::vector<ConfigOption*> GLGizmoSlaSupports::get_config_options(const std::vec
#if ENABLE_IMGUI
void GLGizmoSlaSupports::on_render_input_window(float x, float y, const GLCanvas3D::Selection& selection)
void GLGizmoSlaSupports::on_render_input_window(float x, float y, float bottom_limit, const GLCanvas3D::Selection& selection)
{
if (!m_model_object)
return;
@ -2281,8 +2281,13 @@ void GLGizmoSlaSupports::on_render_input_window(float x, float y, const GLCanvas
// so it is not delayed until the background process finishes.
RENDER_AGAIN:
m_imgui->set_next_window_pos(x, y, ImGuiCond_Always);
static const ImVec2 window_size(285.f, 260.f);
ImGui::SetNextWindowPos(ImVec2(x, y - std::max(0.f, y+window_size.y-bottom_limit) ));
ImGui::SetNextWindowSize(ImVec2(window_size));
m_imgui->set_next_window_bg_alpha(0.5f);
m_imgui->begin(on_get_name(), ImGuiWindowFlags_NoMove |/* ImGuiWindowFlags_NoResize | */ImGuiWindowFlags_NoCollapse);
m_imgui->begin(on_get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse);
ImGui::PushItemWidth(100.0f);
@ -2538,6 +2543,7 @@ void GLGizmoSlaSupports::editing_mode_reload_cache()
m_editing_mode_cache.clear();
for (const sla::SupportPoint& point : m_model_object->sla_support_points)
m_editing_mode_cache.push_back(std::make_pair(point, false));
m_unsaved_changes = false;
}
@ -2585,7 +2591,9 @@ void GLGizmoSlaSupports::auto_generate()
void GLGizmoSlaSupports::switch_to_editing_mode()
{
editing_mode_reload_cache();
if (m_model_object->sla_points_status != sla::PointsStatus::AutoGenerated)
editing_mode_reload_cache();
m_unsaved_changes = false;
m_editing_mode = true;
}
@ -2801,7 +2809,7 @@ void GLGizmoCut::on_render_for_picking(const GLCanvas3D::Selection& selection) c
}
#if ENABLE_IMGUI
void GLGizmoCut::on_render_input_window(float x, float y, const GLCanvas3D::Selection& selection)
void GLGizmoCut::on_render_input_window(float x, float y, float bottom_limit, const GLCanvas3D::Selection& selection)
{
m_imgui->set_next_window_pos(x, y, ImGuiCond_Always);
m_imgui->set_next_window_bg_alpha(0.5f);