Separate GizmoManager on_move into gizmo itself
This commit is contained in:
parent
2ab44546bd
commit
c751d6327d
22 changed files with 614 additions and 469 deletions
|
@ -39,6 +39,10 @@ std::string GLGizmoMove3D::get_tooltip() const
|
|||
return "";
|
||||
}
|
||||
|
||||
bool GLGizmoMove3D::on_mouse(const wxMouseEvent &mouse_event) {
|
||||
return use_grabbers(mouse_event);
|
||||
}
|
||||
|
||||
bool GLGizmoMove3D::on_init()
|
||||
{
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
|
@ -62,22 +66,23 @@ bool GLGizmoMove3D::on_is_activable() const
|
|||
|
||||
void GLGizmoMove3D::on_start_dragging()
|
||||
{
|
||||
if (m_hover_id != -1) {
|
||||
m_displacement = Vec3d::Zero();
|
||||
const BoundingBoxf3& box = m_parent.get_selection().get_bounding_box();
|
||||
m_starting_drag_position = m_grabbers[m_hover_id].center;
|
||||
m_starting_box_center = box.center();
|
||||
m_starting_box_bottom_center = box.center();
|
||||
m_starting_box_bottom_center(2) = box.min(2);
|
||||
}
|
||||
assert(m_hover_id != -1);
|
||||
|
||||
m_displacement = Vec3d::Zero();
|
||||
const BoundingBoxf3& box = m_parent.get_selection().get_bounding_box();
|
||||
m_starting_drag_position = m_grabbers[m_hover_id].center;
|
||||
m_starting_box_center = box.center();
|
||||
m_starting_box_bottom_center = box.center();
|
||||
m_starting_box_bottom_center(2) = box.min(2);
|
||||
}
|
||||
|
||||
void GLGizmoMove3D::on_stop_dragging()
|
||||
{
|
||||
m_parent.do_move(L("Gizmo-Move"));
|
||||
m_displacement = Vec3d::Zero();
|
||||
}
|
||||
|
||||
void GLGizmoMove3D::on_update(const UpdateData& data)
|
||||
void GLGizmoMove3D::on_dragging(const UpdateData& data)
|
||||
{
|
||||
if (m_hover_id == 0)
|
||||
m_displacement.x() = calc_projection(data);
|
||||
|
@ -85,6 +90,9 @@ void GLGizmoMove3D::on_update(const UpdateData& data)
|
|||
m_displacement.y() = calc_projection(data);
|
||||
else if (m_hover_id == 2)
|
||||
m_displacement.z() = calc_projection(data);
|
||||
|
||||
Selection &selection = m_parent.get_selection();
|
||||
selection.translate(m_displacement);
|
||||
}
|
||||
|
||||
void GLGizmoMove3D::on_render()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue