mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-15 02:37:51 -06:00
Object updated by rotate gizmo
This commit is contained in:
parent
a3949b9f01
commit
b9ce19b07c
10 changed files with 180 additions and 36 deletions
|
@ -140,7 +140,7 @@ void GLGizmoBase::on_start_dragging()
|
|||
|
||||
void GLGizmoBase::render_grabbers() const
|
||||
{
|
||||
for (unsigned int i = 0; i < (unsigned int)m_grabbers.size(); ++i)
|
||||
for (int i = 0; i < (int)m_grabbers.size(); ++i)
|
||||
{
|
||||
m_grabbers[i].render(m_hover_id == i);
|
||||
}
|
||||
|
@ -165,6 +165,19 @@ GLGizmoRotate::GLGizmoRotate()
|
|||
{
|
||||
}
|
||||
|
||||
float GLGizmoRotate::get_angle_z() const
|
||||
{
|
||||
return m_angle_z;
|
||||
}
|
||||
|
||||
void GLGizmoRotate::set_angle_z(float angle_z)
|
||||
{
|
||||
if (std::abs(angle_z - 2.0f * PI) < EPSILON)
|
||||
angle_z = 0.0f;
|
||||
|
||||
m_angle_z = angle_z;
|
||||
}
|
||||
|
||||
bool GLGizmoRotate::on_init()
|
||||
{
|
||||
std::string path = resources_dir() + "/icons/overlay/";
|
||||
|
@ -194,6 +207,7 @@ void GLGizmoRotate::on_update(const Pointf& mouse_pos)
|
|||
if (cross(orig_dir, new_dir) < 0.0)
|
||||
theta = 2.0 * (coordf_t)PI - theta;
|
||||
|
||||
// snap
|
||||
if (length(m_center.vector_to(mouse_pos)) < 2.0 * (double)m_radius / 3.0)
|
||||
{
|
||||
coordf_t step = 2.0 * (coordf_t)PI / (coordf_t)SnapRegionsCount;
|
||||
|
@ -202,7 +216,7 @@ void GLGizmoRotate::on_update(const Pointf& mouse_pos)
|
|||
|
||||
if (theta == 2.0 * (coordf_t)PI)
|
||||
theta = 0.0;
|
||||
|
||||
|
||||
m_angle_z = (float)theta;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue