diff options
author | Enrico Turri <enricoturri@seznam.cz> | 2018-09-10 15:10:08 +0300 |
---|---|---|
committer | Enrico Turri <enricoturri@seznam.cz> | 2018-09-10 15:10:08 +0300 |
commit | 781df150a13a4ae3b55109fb728ef469cfbc8f7a (patch) | |
tree | 3746a75e1d2c761c317318e369d049c28dc262d9 /lib | |
parent | 1516c46d0b0f0428f7ff49a1860437f07e48beee (diff) |
Added perl callback for gizmo flatten
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Slic3r/GUI/Plater.pm | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index 9b3457ef4..951f3bd0f 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -153,16 +153,15 @@ sub new { }; # callback to react to gizmo rotate - # omitting last three parameters means rotation around Z - # otherwise they are the components of the rotation axis vector my $on_gizmo_rotate = sub { + my ($angle) = @_; + $self->rotate(rad2deg($angle), Z, 'absolute'); + }; + + # callback to react to gizmo flatten + my $on_gizmo_flatten = sub { my ($angle, $axis_x, $axis_y, $axis_z) = @_; - if (!defined $axis_x) { - $self->rotate(rad2deg($angle), Z, 'absolute'); - } - else { - $self->rotate(rad2deg($angle), undef, 'absolute', $axis_x, $axis_y, $axis_z) if $angle != 0; - } + $self->rotate(rad2deg($angle), undef, 'absolute', $axis_x, $axis_y, $axis_z) if $angle != 0; }; # callback to update object's geometry info while using gizmos @@ -263,6 +262,7 @@ sub new { Slic3r::GUI::_3DScene::register_on_enable_action_buttons_callback($self->{canvas3D}, $enable_action_buttons); Slic3r::GUI::_3DScene::register_on_gizmo_scale_uniformly_callback($self->{canvas3D}, $on_gizmo_scale_uniformly); Slic3r::GUI::_3DScene::register_on_gizmo_rotate_callback($self->{canvas3D}, $on_gizmo_rotate); + Slic3r::GUI::_3DScene::register_on_gizmo_flatten_callback($self->{canvas3D}, $on_gizmo_flatten); Slic3r::GUI::_3DScene::register_on_update_geometry_info_callback($self->{canvas3D}, $on_update_geometry_info); Slic3r::GUI::_3DScene::register_action_add_callback($self->{canvas3D}, $on_action_add); Slic3r::GUI::_3DScene::register_action_delete_callback($self->{canvas3D}, $on_action_delete); |