@@ -109,23 +109,7 @@ float MeshCraftApplication::drawToolbar(float menuBarH, int screenW)
109109
110110 UI::Toolbar::drawSurfaceSnap (surfaceSnapEnabled_);
111111
112- // Proportional editing toggle + radius (H1)
113- { bool was = propEditEnabled_;
114- if (was) ImGui::PushStyleColor (ImGuiCol_Button, ImVec4 (0 .45f , 0 .20f , 0 .45f , 1 .f ));
115- if (ImGui::Button (" Prop" , ImVec2 (40 , 30 ))) propEditEnabled_ = !propEditEnabled_;
116- if (was) ImGui::PopStyleColor (); }
117- if (ImGui::IsItemHovered ())
118- ImGui::SetTooltip (" Proportional editing: Move influences nearby objects (Gaussian falloff)\n Radius: %.2f u" , propEditRadius_);
119- if (propEditEnabled_) {
120- ImGui::SameLine ();
121- ImGui::SetNextItemWidth (70 );
122- // AlwaysClamp (AUDIT-0046): same Ctrl+Click out-of-bounds risk; a
123- // zero/negative proportional-edit radius would break the Gaussian
124- // falloff math with no other downstream guard.
125- ImGui::SliderFloat (" ##propR" , &propEditRadius_, 0 .5f , 50 .0f , " R:%.1f" , ImGuiSliderFlags_AlwaysClamp);
126- if (ImGui::IsItemHovered ()) ImGui::SetTooltip (" Proportional edit radius (world units)" );
127- }
128- ImGui::SameLine ();
112+ UI::Toolbar::drawProportionalEdit (propEditEnabled_, propEditRadius_);
129113
130114 // Grid cell size button (right-click to configure)
131115 if (ImGui::Button (" Grid" , ImVec2 (40 , 30 ))) {}
@@ -258,4 +242,20 @@ void Toolbar::drawSnapToggle(bool& enabled, float translate, float rotate, float
258242 translate, rotate, scale);
259243}
260244
245+ void Toolbar::drawProportionalEdit (bool & enabled, float & radius) {
246+ const bool wasEnabled = enabled;
247+ if (wasEnabled) ImGui::PushStyleColor (ImGuiCol_Button, ImVec4 (0 .45f , 0 .20f , 0 .45f , 1 .f ));
248+ if (ImGui::Button (" Prop" , ImVec2 (40 , 30 ))) enabled = !enabled;
249+ if (wasEnabled) ImGui::PopStyleColor ();
250+ if (ImGui::IsItemHovered ())
251+ ImGui::SetTooltip (" Proportional editing: Move influences nearby objects (Gaussian falloff)\n Radius: %.2f u" , radius);
252+ if (enabled) {
253+ ImGui::SameLine ();
254+ ImGui::SetNextItemWidth (70 );
255+ ImGui::SliderFloat (" ##propR" , &radius, 0 .5f , 50 .0f , " R:%.1f" , ImGuiSliderFlags_AlwaysClamp);
256+ if (ImGui::IsItemHovered ()) ImGui::SetTooltip (" Proportional edit radius (world units)" );
257+ }
258+ ImGui::SameLine ();
259+ }
260+
261261} // namespace MeshCraft::Application::UI
0 commit comments