mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-18 07:05:56 +08:00
Fix broken rotation rotation.
SPE-2389
This commit is contained in:
parent
7b482ac6bb
commit
98d1892cbe
@ -1909,21 +1909,18 @@ void GLGizmoSVG::draw_rotation()
|
|||||||
// minus create clock-wise roation from CCW
|
// minus create clock-wise roation from CCW
|
||||||
float angle = m_angle.value_or(0.f);
|
float angle = m_angle.value_or(0.f);
|
||||||
float angle_deg = static_cast<float>(-angle * 180 / M_PI);
|
float angle_deg = static_cast<float>(-angle * 180 / M_PI);
|
||||||
if (m_imgui->slider_float("##angle", &angle_deg, limits.angle.min, limits.angle.max, u8"%.2f °", 1.f, false, _L("Rotate text Clock-wise."))){
|
if (m_imgui->slider_float("##angle", &angle_deg, limits.angle.min, limits.angle.max, u8"%.2f °", 1.f, false, _L("Rotate Clock-wise."))){
|
||||||
// convert back to radians and CCW
|
// convert back to radians and CCW
|
||||||
double angle_rad = -angle_deg * M_PI / 180.0;
|
double angle_rad = -angle_deg * M_PI / 180.0;
|
||||||
Geometry::to_range_pi_pi(angle_rad);
|
Geometry::to_range_pi_pi(angle_rad);
|
||||||
|
|
||||||
double diff_angle = angle_rad - angle;
|
double diff_angle = angle_rad - angle;
|
||||||
|
if (!is_approx(diff_angle, 0.)) {
|
||||||
|
do_local_z_rotate(m_parent.get_selection(), diff_angle);
|
||||||
|
|
||||||
do_local_z_rotate(m_parent.get_selection(), diff_angle);
|
// calc angle after rotation
|
||||||
|
m_angle = calc_angle(m_parent.get_selection());
|
||||||
// calc angle after rotation
|
}
|
||||||
m_angle = calc_angle(m_parent.get_selection());
|
|
||||||
|
|
||||||
// recalculate for surface cut
|
|
||||||
if (m_volume->emboss_shape->projection.use_surface)
|
|
||||||
process();
|
|
||||||
}
|
}
|
||||||
bool is_stop_sliding = m_imgui->get_last_slider_status().deactivated_after_edit;
|
bool is_stop_sliding = m_imgui->get_last_slider_status().deactivated_after_edit;
|
||||||
|
|
||||||
@ -1933,20 +1930,20 @@ void GLGizmoSVG::draw_rotation()
|
|||||||
if (reset_button(m_icons)) {
|
if (reset_button(m_icons)) {
|
||||||
do_local_z_rotate(m_parent.get_selection(), -(*m_angle));
|
do_local_z_rotate(m_parent.get_selection(), -(*m_angle));
|
||||||
m_angle.reset();
|
m_angle.reset();
|
||||||
|
|
||||||
// recalculate for surface cut
|
|
||||||
if (m_volume->emboss_shape->projection.use_surface)
|
|
||||||
process();
|
|
||||||
|
|
||||||
is_reseted = true;
|
is_reseted = true;
|
||||||
} else if (ImGui::IsItemHovered())
|
} else if (ImGui::IsItemHovered())
|
||||||
ImGui::SetTooltip("%s", _u8L("Reset rotation").c_str());
|
ImGui::SetTooltip("%s", _u8L("Reset rotation").c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply rotation on model (backend)
|
// Apply rotation on model (backend)
|
||||||
if (is_stop_sliding || is_reseted)
|
if (is_stop_sliding || is_reseted) {
|
||||||
m_parent.do_rotate(rotation_snapshot_name);
|
m_parent.do_rotate(rotation_snapshot_name);
|
||||||
|
|
||||||
|
// recalculate for surface cut
|
||||||
|
if (m_volume->emboss_shape->projection.use_surface)
|
||||||
|
process();
|
||||||
|
}
|
||||||
|
|
||||||
// Keep up - lock button icon
|
// Keep up - lock button icon
|
||||||
if (!m_volume->is_the_only_one_part()) {
|
if (!m_volume->is_the_only_one_part()) {
|
||||||
ImGui::SameLine(m_gui_cfg->lock_offset);
|
ImGui::SameLine(m_gui_cfg->lock_offset);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user