mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	ENH: Optimize the overall Gizmo layout
Change-Id: Ic773fa45d163d598f4510d981c11d4f9f5858495
This commit is contained in:
		
							parent
							
								
									1569909cc3
								
							
						
					
					
						commit
						83010a0d85
					
				
					 5 changed files with 50 additions and 61 deletions
				
			
		|  | @ -209,6 +209,7 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l | |||
|     GizmoImguiBegin(get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar); | ||||
| 
 | ||||
|     // First calculate width of all the texts that are could possibly be shown. We will decide set the dialog width based on that:
 | ||||
|     const float space_size = m_imgui->get_style_scaling() * 8; | ||||
|     const float clipping_slider_left    = m_imgui->calc_text_size(m_desc.at("clipping_of_view")).x + m_imgui->scaled(1.5f); | ||||
|     const float cursor_slider_left      = m_imgui->calc_text_size(m_desc.at("cursor_size")).x + m_imgui->scaled(1.5f); | ||||
|     const float gap_fill_slider_left    = m_imgui->calc_text_size(m_desc.at("gap_fill")).x + m_imgui->scaled(1.5f); | ||||
|  | @ -220,7 +221,6 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l | |||
| 
 | ||||
|     const float tips_width           = m_imgui->calc_text_size(_L("Auto support threshold angle: ") + " 90 ").x + m_imgui->scaled(1.5f); | ||||
|     const float minimal_slider_width = m_imgui->scaled(4.f); | ||||
|     float slider_width_times = 1.5; | ||||
| 
 | ||||
|     float caption_max    = 0.f; | ||||
|     float total_text_max = 0.f; | ||||
|  | @ -233,12 +233,10 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l | |||
| 
 | ||||
|     const float sliders_left_width = std::max(std::max(cursor_slider_left, clipping_slider_left), std::max(highlight_slider_left, gap_fill_slider_left)); | ||||
|     const float slider_icon_width  = m_imgui->get_slider_icon_size().x; | ||||
|     float       window_width       = minimal_slider_width + sliders_left_width + slider_icon_width; | ||||
|     const float max_tooltip_width = ImGui::GetFontSize() * 20.0f; | ||||
| 
 | ||||
|     window_width = std::max(window_width, total_text_max); | ||||
|     window_width = std::max(window_width, buttons_width); | ||||
|     window_width = std::max(window_width, tips_width); | ||||
|     const float sliders_width = m_imgui->scaled(7.0f); | ||||
|     const float drag_left_width = ImGui::GetStyle().WindowPadding.x + sliders_left_width + sliders_width - space_size; | ||||
| 
 | ||||
|     float drag_pos_times     = 0.7; | ||||
| 
 | ||||
|  | @ -294,9 +292,9 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l | |||
|         ImGui::AlignTextToFramePadding(); | ||||
|         m_imgui->text(m_desc.at("cursor_size")); | ||||
|         ImGui::SameLine(sliders_left_width); | ||||
|         ImGui::PushItemWidth(window_width - sliders_left_width - slider_icon_width); | ||||
|         ImGui::PushItemWidth(sliders_width); | ||||
|         m_imgui->bbl_slider_float_style("##cursor_radius", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f", 1.0f, true); | ||||
|         ImGui::SameLine(window_width - drag_pos_times * slider_icon_width); | ||||
|         ImGui::SameLine(drag_left_width); | ||||
|         ImGui::PushItemWidth(1.5 * slider_icon_width); | ||||
|         ImGui::BBLDragFloat("##cursor_radius_input", &m_cursor_radius, 0.05f, 0.0f, 0.0f, "%.2f"); | ||||
|     } else if (m_current_tool == ImGui::SphereButtonIcon) { | ||||
|  | @ -306,9 +304,9 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l | |||
|         ImGui::AlignTextToFramePadding(); | ||||
|         m_imgui->text(m_desc.at("cursor_size")); | ||||
|         ImGui::SameLine(sliders_left_width); | ||||
|         ImGui::PushItemWidth(window_width - sliders_left_width - slider_icon_width); | ||||
|         ImGui::PushItemWidth(sliders_width); | ||||
|         m_imgui->bbl_slider_float_style("##cursor_radius", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f", 1.0f, true); | ||||
|         ImGui::SameLine(window_width - drag_pos_times * slider_icon_width); | ||||
|         ImGui::SameLine(drag_left_width); | ||||
|         ImGui::PushItemWidth(1.5 * slider_icon_width); | ||||
|         ImGui::BBLDragFloat("##cursor_radius_input", &m_cursor_radius, 0.05f, 0.0f, 0.0f, "%.2f"); | ||||
|     } else if (m_current_tool == ImGui::FillButtonIcon) { | ||||
|  | @ -319,13 +317,13 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l | |||
|         m_imgui->text(m_desc.at("smart_fill_angle")); | ||||
|         std::string format_str = std::string("%.f") + I18N::translate_utf8("", "Face angle threshold, placed after the number with no whitespace in between."); | ||||
|         ImGui::SameLine(sliders_left_width); | ||||
|         ImGui::PushItemWidth(window_width - sliders_left_width - slider_icon_width); | ||||
|         ImGui::PushItemWidth(sliders_width); | ||||
|         if (m_imgui->bbl_slider_float_style("##smart_fill_angle", &m_smart_fill_angle, SmartFillAngleMin, SmartFillAngleMax, format_str.data(), 1.0f, true)) | ||||
|             for (auto& triangle_selector : m_triangle_selectors) { | ||||
|                 triangle_selector->seed_fill_unselect_all_triangles(); | ||||
|                 triangle_selector->request_update_render_data(); | ||||
|             } | ||||
|         ImGui::SameLine(window_width - drag_pos_times * slider_icon_width); | ||||
|         ImGui::SameLine(drag_left_width); | ||||
|         ImGui::PushItemWidth(1.5 * slider_icon_width); | ||||
|         ImGui::BBLDragFloat("##smart_fill_angle_input", &m_smart_fill_angle, 0.05f, 0.0f, 0.0f, "%.2f"); | ||||
|     } else if (m_current_tool == ImGui::GapFillIcon) { | ||||
|  | @ -335,10 +333,10 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l | |||
|         ImGui::AlignTextToFramePadding(); | ||||
|         m_imgui->text(m_desc["gap_area"] + ":"); | ||||
|         ImGui::SameLine(sliders_left_width); | ||||
|         ImGui::PushItemWidth(window_width - sliders_left_width - slider_icon_width); | ||||
|         ImGui::PushItemWidth(sliders_width); | ||||
|         std::string format_str = std::string("%.2f") + I18N::translate_utf8("", "Triangle patch area threshold,""triangle patch will be merged to neighbor if its area is less than threshold"); | ||||
|         m_imgui->bbl_slider_float_style("##gap_area", &TriangleSelectorPatch::gap_area, TriangleSelectorPatch::GapAreaMin, TriangleSelectorPatch::GapAreaMax, format_str.data(), 1.0f, true); | ||||
|         ImGui::SameLine(window_width - drag_pos_times * slider_icon_width); | ||||
|         ImGui::SameLine(drag_left_width); | ||||
|         ImGui::PushItemWidth(1.5 * slider_icon_width); | ||||
|         ImGui::BBLDragFloat("##gap_area_input", &TriangleSelectorPatch::gap_area, 0.05f, 0.0f, 0.0f, "%.2f"); | ||||
|     } | ||||
|  | @ -356,7 +354,7 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l | |||
|     ImGui::SetCursorPosY(slider_start_position_y); | ||||
| 
 | ||||
|     std::string format_str = std::string("%.f"); | ||||
|     ImGui::PushItemWidth(window_width - sliders_left_width - slider_icon_width); | ||||
|     ImGui::PushItemWidth(sliders_width); | ||||
|     wxString tooltip = _L("Highlight faces according to overhang angle."); | ||||
|     if (m_imgui->bbl_slider_float_style("##angle_threshold_deg", &m_highlight_by_angle_threshold_deg, 0.f, 90.f, format_str.data(), 1.0f, true, tooltip)) { | ||||
|         m_parent.set_slope_normal_angle(90.f - m_highlight_by_angle_threshold_deg); | ||||
|  | @ -376,7 +374,7 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l | |||
|         } | ||||
|         ImGui::EndTooltip(); | ||||
|     } | ||||
|     ImGui::SameLine(window_width - drag_pos_times * slider_icon_width); | ||||
|     ImGui::SameLine(drag_left_width); | ||||
|     ImGui::PushItemWidth(1.5 * slider_icon_width); | ||||
|     ImGui::BBLDragFloat("##angle_threshold_deg_input", &m_highlight_by_angle_threshold_deg, 0.05f, 0.0f, 0.0f, "%.2f"); | ||||
|      | ||||
|  | @ -387,10 +385,10 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l | |||
| 
 | ||||
|         auto clp_dist = float(m_c->object_clipper()->get_position()); | ||||
|         ImGui::SameLine(sliders_left_width); | ||||
|         ImGui::PushItemWidth(window_width - sliders_left_width - slider_icon_width); | ||||
|         ImGui::PushItemWidth(sliders_width); | ||||
|         bool b_bbl_slider_float = m_imgui->bbl_slider_float_style("##clp_dist", &clp_dist, 0.f, 1.f, "%.2f", 1.0f, true); | ||||
| 
 | ||||
|         ImGui::SameLine(window_width - drag_pos_times * slider_icon_width); | ||||
|         ImGui::SameLine(drag_left_width); | ||||
|         ImGui::PushItemWidth(1.5 * slider_icon_width); | ||||
|         bool b_drag_input = ImGui::BBLDragFloat("##clp_dist_input", &clp_dist, 0.05f, 0.0f, 0.0f, "%.2f"); | ||||
| 
 | ||||
|  |  | |||
|  | @ -331,7 +331,7 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott | |||
|     GizmoImguiBegin(get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar); | ||||
| 
 | ||||
|     // First calculate width of all the texts that are could possibly be shown. We will decide set the dialog width based on that:
 | ||||
|     float space_size = m_imgui->get_style_scaling() * 8; | ||||
|     const float space_size = m_imgui->get_style_scaling() * 8; | ||||
|     const float clipping_slider_left  = m_imgui->calc_text_size(m_desc.at("clipping_of_view")).x + m_imgui->scaled(1.5f); | ||||
|     const float cursor_slider_left = m_imgui->calc_text_size(m_desc.at("cursor_size")).x + m_imgui->scaled(1.5f); | ||||
|     const float smart_fill_slider_left = m_imgui->calc_text_size(m_desc.at("smart_fill_angle")).x + m_imgui->scaled(1.5f); | ||||
|  | @ -369,8 +369,10 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott | |||
|     window_width = std::max(window_width, buttons_width); | ||||
|     window_width = std::max(window_width, max_filament_items_per_line * filament_item_width + +m_imgui->scaled(0.5f)); | ||||
| 
 | ||||
|     const float sliders_width = m_imgui->scaled(7.0f); | ||||
|     const float drag_left_width = ImGui::GetStyle().WindowPadding.x + sliders_width - space_size; | ||||
| 
 | ||||
|     const float max_tooltip_width = ImGui::GetFontSize() * 20.0f; | ||||
|     float slider_width_times = 1.5; | ||||
|     ImDrawList * draw_list = ImGui::GetWindowDrawList(); | ||||
|     ImVec2 pos = ImGui::GetCursorScreenPos(); | ||||
|     static float color_button_high  = 25.0; | ||||
|  | @ -490,9 +492,9 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott | |||
|         ImGui::AlignTextToFramePadding(); | ||||
|         m_imgui->text(m_desc.at("cursor_size")); | ||||
|         ImGui::SameLine(circle_max_width); | ||||
|         ImGui::PushItemWidth(window_width - circle_max_width - slider_width_times * slider_icon_width); | ||||
|         ImGui::PushItemWidth(sliders_width); | ||||
|         m_imgui->bbl_slider_float_style("##cursor_radius", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f", 1.0f, true); | ||||
|         ImGui::SameLine(window_width - slider_icon_width); | ||||
|         ImGui::SameLine(drag_left_width + circle_max_width); | ||||
|         ImGui::PushItemWidth(1.5 * slider_icon_width); | ||||
|         ImGui::BBLDragFloat("##cursor_radius_input", &m_cursor_radius, 0.05f, 0.0f, 0.0f, "%.2f"); | ||||
| 
 | ||||
|  | @ -503,9 +505,9 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott | |||
| 
 | ||||
|         auto clp_dist = float(m_c->object_clipper()->get_position()); | ||||
|         ImGui::SameLine(circle_max_width); | ||||
|         ImGui::PushItemWidth(window_width - circle_max_width - slider_width_times * slider_icon_width); | ||||
|         ImGui::PushItemWidth(sliders_width); | ||||
|         bool slider_clp_dist = m_imgui->bbl_slider_float_style("##clp_dist", &clp_dist, 0.f, 1.f, "%.2f", 1.0f, true); | ||||
|         ImGui::SameLine(window_width - slider_icon_width); | ||||
|         ImGui::SameLine(drag_left_width + circle_max_width); | ||||
|         ImGui::PushItemWidth(1.5 * slider_icon_width); | ||||
|         bool b_clp_dist_input = ImGui::BBLDragFloat("##clp_dist_input", &clp_dist, 0.05f, 0.0f, 0.0f, "%.2f"); | ||||
| 
 | ||||
|  | @ -520,9 +522,9 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott | |||
| 
 | ||||
|         auto clp_dist = float(m_c->object_clipper()->get_position()); | ||||
|         ImGui::SameLine(clipping_slider_left); | ||||
|         ImGui::PushItemWidth(window_width - clipping_slider_left - slider_width_times * slider_icon_width); | ||||
|         ImGui::PushItemWidth(sliders_width); | ||||
|         bool slider_clp_dist = m_imgui->bbl_slider_float_style("##clp_dist", &clp_dist, 0.f, 1.f, "%.2f", 1.0f, true); | ||||
|         ImGui::SameLine(window_width - slider_icon_width); | ||||
|         ImGui::SameLine(drag_left_width + clipping_slider_left); | ||||
|         ImGui::PushItemWidth(1.5 * slider_icon_width); | ||||
|         bool b_clp_dist_input = ImGui::BBLDragFloat("##clp_dist_input", &clp_dist, 0.05f, 0.0f, 0.0f, "%.2f"); | ||||
| 
 | ||||
|  | @ -539,13 +541,13 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott | |||
|             std::string format_str = std::string("%.f") + I18N::translate_utf8("°", "Face angle threshold," | ||||
|                                                                                     "placed after the number with no whitespace in between."); | ||||
|             ImGui::SameLine(sliders_left_width); | ||||
|             ImGui::PushItemWidth(window_width - sliders_left_width - slider_width_times * slider_icon_width); | ||||
|             ImGui::PushItemWidth(sliders_width); | ||||
|             if (m_imgui->bbl_slider_float_style("##smart_fill_angle", &m_smart_fill_angle, SmartFillAngleMin, SmartFillAngleMax, format_str.data(), 1.0f, true)) | ||||
|                 for (auto &triangle_selector : m_triangle_selectors) { | ||||
|                     triangle_selector->seed_fill_unselect_all_triangles(); | ||||
|                     triangle_selector->request_update_render_data(); | ||||
|                 } | ||||
|             ImGui::SameLine(window_width - slider_icon_width); | ||||
|             ImGui::SameLine(drag_left_width + sliders_left_width); | ||||
|             ImGui::PushItemWidth(1.5 * slider_icon_width); | ||||
|             ImGui::BBLDragFloat("##smart_fill_angle_input", &m_smart_fill_angle, 0.05f, 0.0f, 0.0f, "%.2f"); | ||||
|         } else { | ||||
|  | @ -559,9 +561,9 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott | |||
| 
 | ||||
|         auto clp_dist = float(m_c->object_clipper()->get_position()); | ||||
|         ImGui::SameLine(sliders_left_width); | ||||
|         ImGui::PushItemWidth(window_width - sliders_left_width - slider_width_times * slider_icon_width); | ||||
|         ImGui::PushItemWidth(sliders_width); | ||||
|         bool slider_clp_dist = m_imgui->bbl_slider_float_style("##clp_dist", &clp_dist, 0.f, 1.f, "%.2f", 1.0f, true); | ||||
|         ImGui::SameLine(window_width - slider_icon_width); | ||||
|         ImGui::SameLine(drag_left_width + sliders_left_width); | ||||
|         ImGui::PushItemWidth(1.5 * slider_icon_width); | ||||
|         bool b_clp_dist_input = ImGui::BBLDragFloat("##clp_dist_input", &clp_dist, 0.05f, 0.0f, 0.0f, "%.2f"); | ||||
| 
 | ||||
|  | @ -573,10 +575,10 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott | |||
|         ImGui::AlignTextToFramePadding(); | ||||
|         m_imgui->text(m_desc["height_range"] + ":"); | ||||
|         ImGui::SameLine(height_max_width); | ||||
|         ImGui::PushItemWidth(window_width - height_max_width - slider_width_times * slider_icon_width); | ||||
|         ImGui::PushItemWidth(sliders_width); | ||||
|         std::string format_str = std::string("%.2f") + I18N::translate_utf8("mm", "Heigh range," "Facet in [cursor z, cursor z + height] will be selected."); | ||||
|         m_imgui->bbl_slider_float_style("##cursor_height", &m_cursor_height, CursorHeightMin, CursorHeightMax, format_str.data(), 1.0f, true); | ||||
|         ImGui::SameLine(window_width - slider_icon_width); | ||||
|         ImGui::SameLine(drag_left_width + height_max_width); | ||||
|         ImGui::PushItemWidth(1.5 * slider_icon_width); | ||||
|         ImGui::BBLDragFloat("##cursor_height_input", &m_cursor_height, 0.05f, 0.0f, 0.0f, "%.2f"); | ||||
| 
 | ||||
|  | @ -587,9 +589,9 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott | |||
| 
 | ||||
|         auto clp_dist = float(m_c->object_clipper()->get_position()); | ||||
|         ImGui::SameLine(height_max_width); | ||||
|         ImGui::PushItemWidth(window_width - height_max_width - slider_width_times * slider_icon_width); | ||||
|         ImGui::PushItemWidth(sliders_width); | ||||
|         bool slider_clp_dist = m_imgui->bbl_slider_float_style("##clp_dist", &clp_dist, 0.f, 1.f, "%.2f", 1.0f, true); | ||||
|         ImGui::SameLine(window_width - slider_icon_width); | ||||
|         ImGui::SameLine(drag_left_width + height_max_width); | ||||
|         ImGui::PushItemWidth(1.5 * slider_icon_width); | ||||
|         bool b_clp_dist_input = ImGui::BBLDragFloat("##clp_dist_input", &clp_dist, 0.05f, 0.0f, 0.0f, "%.2f"); | ||||
| 
 | ||||
|  | @ -601,10 +603,10 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott | |||
|         ImGui::AlignTextToFramePadding(); | ||||
|         m_imgui->text(m_desc["gap_area"] + ":"); | ||||
|         ImGui::SameLine(gap_area_slider_left); | ||||
|         ImGui::PushItemWidth(window_width - gap_area_slider_left - slider_width_times * slider_icon_width); | ||||
|         ImGui::PushItemWidth(sliders_width); | ||||
|         std::string format_str = std::string("%.2f") + I18N::translate_utf8("", "Triangle patch area threshold,""triangle patch will be merged to neighbor if its area is less than threshold"); | ||||
|         m_imgui->bbl_slider_float_style("##gap_area", &TriangleSelectorPatch::gap_area, TriangleSelectorPatch::GapAreaMin, TriangleSelectorPatch::GapAreaMax, format_str.data(), 1.0f, true); | ||||
|         ImGui::SameLine(window_width - slider_icon_width); | ||||
|         ImGui::SameLine(drag_left_width + gap_area_slider_left); | ||||
|         ImGui::PushItemWidth(1.5 * slider_icon_width); | ||||
|         ImGui::BBLDragFloat("##gap_area_input", &TriangleSelectorPatch::gap_area, 0.05f, 0.0f, 0.0f, "%.2f"); | ||||
|     } | ||||
|  |  | |||
|  | @ -178,17 +178,11 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit) | |||
|     GizmoImguiBegin(get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar); | ||||
| 
 | ||||
|     // First calculate width of all the texts that are could possibly be shown. We will decide set the dialog width based on that:
 | ||||
|     const float space_size = m_imgui->get_style_scaling() * 8; | ||||
|     const float clipping_slider_left = std::max(m_imgui->calc_text_size(m_desc.at("clipping_of_view")).x, | ||||
|                                                 m_imgui->calc_text_size(m_desc.at("reset_direction")).x) | ||||
|                                            + m_imgui->scaled(1.5f); | ||||
|     const float cursor_size_slider_left = m_imgui->calc_text_size(m_desc.at("cursor_size")).x + m_imgui->scaled(1.f); | ||||
| 
 | ||||
|     const float cursor_type_radio_left   = m_imgui->calc_text_size(m_desc["cursor_type"]).x + m_imgui->scaled(1.f); | ||||
|     const float cursor_type_radio_sphere = m_imgui->calc_text_size(m_desc["sphere"]).x + m_imgui->scaled(2.5f); | ||||
|     const float cursor_type_radio_circle = m_imgui->calc_text_size(m_desc["circle"]).x + m_imgui->scaled(2.5f); | ||||
| 
 | ||||
|     const float button_width = m_imgui->calc_text_size(m_desc.at("remove_all")).x + m_imgui->scaled(1.f); | ||||
|     const float minimal_slider_width = m_imgui->scaled(4.f); | ||||
|     const float empty_button_width      = m_imgui->calc_button_size("").x; | ||||
| 
 | ||||
|     float caption_max    = 0.f; | ||||
|  | @ -197,19 +191,12 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit) | |||
|         caption_max    = std::max(caption_max, m_imgui->calc_text_size(m_desc[t + "_caption"]).x); | ||||
|         total_text_max = std::max(total_text_max, m_imgui->calc_text_size(m_desc[t]).x); | ||||
|     } | ||||
|     total_text_max += caption_max + m_imgui->scaled(1.f); | ||||
|     caption_max    += m_imgui->scaled(1.f); | ||||
|     float slider_width_times = 1.5; | ||||
| 
 | ||||
|     const float sliders_left_width = std::max(cursor_size_slider_left, clipping_slider_left); | ||||
| #if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT | ||||
|     const float slider_icon_width  = m_imgui->get_slider_icon_size().x; | ||||
|     float       window_width       = minimal_slider_width + sliders_left_width + slider_icon_width; | ||||
| #else | ||||
|     float       window_width       = minimal_slider_width + sliders_left_width; | ||||
| #endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT
 | ||||
|     window_width = std::max(window_width, total_text_max); | ||||
|     window_width = std::max(window_width, button_width); | ||||
|     window_width = std::max(window_width, cursor_type_radio_left + cursor_type_radio_sphere + cursor_type_radio_circle); | ||||
| 
 | ||||
|     const float sliders_width = m_imgui->scaled(7.0f); | ||||
|     const float drag_left_width = ImGui::GetStyle().WindowPadding.x + sliders_left_width + sliders_width - space_size; | ||||
| 
 | ||||
|     const float max_tooltip_width = ImGui::GetFontSize() * 20.0f; | ||||
| 
 | ||||
|  | @ -268,9 +255,9 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit) | |||
|     m_imgui->text(m_desc.at("cursor_size")); | ||||
|     ImGui::SameLine(sliders_left_width); | ||||
| 
 | ||||
|     ImGui::PushItemWidth(window_width - sliders_left_width - slider_width_times * slider_icon_width); | ||||
|     ImGui::PushItemWidth(sliders_width); | ||||
|     m_imgui->bbl_slider_float_style("##cursor_radius", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f", 1.0f, true); | ||||
|     ImGui::SameLine(window_width - slider_icon_width); | ||||
|     ImGui::SameLine(drag_left_width); | ||||
|     ImGui::PushItemWidth(1.5 * slider_icon_width); | ||||
|     ImGui::BBLDragFloat("##cursor_radius_input", &m_cursor_radius, 0.05f, 0.0f, 0.0f, "%.2f"); | ||||
| 
 | ||||
|  | @ -280,10 +267,10 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit) | |||
|     auto clp_dist = float(m_c->object_clipper()->get_position()); | ||||
|     ImGui::SameLine(sliders_left_width); | ||||
| 
 | ||||
|     ImGui::PushItemWidth(window_width - sliders_left_width - slider_width_times * slider_icon_width); | ||||
|     ImGui::PushItemWidth(sliders_width); | ||||
|     bool slider_clp_dist = m_imgui->bbl_slider_float_style("##clp_dist", &clp_dist, 0.f, 1.f, "%.2f", 1.0f, true); | ||||
| 
 | ||||
|     ImGui::SameLine(window_width - slider_icon_width); | ||||
|     ImGui::SameLine(drag_left_width); | ||||
|     ImGui::PushItemWidth(1.5 * slider_icon_width); | ||||
|     bool b_clp_dist_input = ImGui::BBLDragFloat("##clp_dist_input", &clp_dist, 0.05f, 0.0f, 0.0f, "%.2f"); | ||||
|     if (slider_clp_dist || b_clp_dist_input) { m_c->object_clipper()->set_position(clp_dist, true); } | ||||
|  |  | |||
|  | @ -110,7 +110,7 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit) | |||
|     float caption_size = std::max(std::max(font_cap, size_cap), std::max(thickness_cap, input_cap)) + space_size + ImGui::GetStyle().WindowPadding.x; | ||||
| 
 | ||||
|     float input_text_size = m_imgui->scaled(12.0f); | ||||
|     float button_size = m_imgui->scaled(1.4f); | ||||
|     float button_size = ImGui::GetFrameHeight(); | ||||
|     float input_size = input_text_size - button_size * 2 - ImGui::GetStyle().ItemSpacing.x * 4; | ||||
| 
 | ||||
|     ImTextureID normal_B = m_parent.get_gizmos_manager().get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_TEXT_B); | ||||
|  | @ -158,8 +158,8 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit) | |||
|         ImGui::EndCombo(); | ||||
|     } | ||||
| 
 | ||||
|     ImGui::AlignTextToFramePadding(); | ||||
|     pop_combo_style(); | ||||
|     ImGui::AlignTextToFramePadding(); | ||||
|     m_imgui->text(_L("Size")); | ||||
|     ImGui::SameLine(caption_size); | ||||
|     ImGui::PushItemWidth(input_size); | ||||
|  | @ -168,10 +168,11 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit) | |||
|     ImGui::SameLine(); | ||||
| 
 | ||||
|     ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0); | ||||
|     ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, {0.0,0.0}); | ||||
|     ImGui::BBLImageButton(normal_B,press_B_hover,press_B_press,{button_size,button_size},m_bold); | ||||
|     ImGui::SameLine(); | ||||
|     ImGui::BBLImageButton(normal_T,press_T_hover,press_T_press,{button_size,button_size},m_italic); | ||||
|     ImGui::PopStyleVar(); | ||||
|     ImGui::PopStyleVar(2); | ||||
| 
 | ||||
|     ImGui::AlignTextToFramePadding(); | ||||
|     m_imgui->text(_L("Thickness")); | ||||
|  |  | |||
|  | @ -1643,6 +1643,7 @@ void ImGuiWrapper::push_toolbar_style(const float scale) | |||
|     ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20.0f, 10.0f) * scale); | ||||
|     ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 3.0f * scale); | ||||
|     ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f); | ||||
|     ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 2.0f * scale); | ||||
|     ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(10.0f, 10.0f) * scale); | ||||
|     ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(50/255.0f, 58/255.0f, 61/255.0f, 1.00f));       // 1
 | ||||
|     ImGui::PushStyleColor(ImGuiCol_WindowBg, ImGuiWrapper::COL_WINDOW_BG);          // 2
 | ||||
|  | @ -1665,7 +1666,7 @@ void ImGuiWrapper::pop_toolbar_style() | |||
| { | ||||
|     // size in push toolbar style
 | ||||
|     ImGui::PopStyleColor(15); | ||||
|     ImGui::PopStyleVar(5); | ||||
|     ImGui::PopStyleVar(6); | ||||
| } | ||||
| 
 | ||||
| void ImGuiWrapper::push_menu_style(const float scale) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 xiangdong.yang
						xiangdong.yang