New hot key for auto arrange: 'a'.

This commit is contained in:
bubnikv 2017-11-30 17:45:03 +01:00
parent bff7065360
commit a617e02ae6
2 changed files with 10 additions and 2 deletions

View File

@ -99,6 +99,7 @@ sub new {
$self->{canvas3D}->set_on_select_object($on_select_object); $self->{canvas3D}->set_on_select_object($on_select_object);
$self->{canvas3D}->set_on_double_click($on_double_click); $self->{canvas3D}->set_on_double_click($on_double_click);
$self->{canvas3D}->set_on_right_click(sub { $on_right_click->($self->{canvas3D}, @_); }); $self->{canvas3D}->set_on_right_click(sub { $on_right_click->($self->{canvas3D}, @_); });
$self->{canvas3D}->set_on_arrange(sub { $self->arrange });
$self->{canvas3D}->set_on_rotate_object_left(sub { $self->rotate(-45, Z, 'relative') }); $self->{canvas3D}->set_on_rotate_object_left(sub { $self->rotate(-45, Z, 'relative') });
$self->{canvas3D}->set_on_rotate_object_right(sub { $self->rotate( 45, Z, 'relative') }); $self->{canvas3D}->set_on_rotate_object_right(sub { $self->rotate( 45, Z, 'relative') });
$self->{canvas3D}->set_on_scale_object_uniformly(sub { $self->changescale(undef) }); $self->{canvas3D}->set_on_scale_object_uniformly(sub { $self->changescale(undef) });

View File

@ -9,7 +9,7 @@ use Wx::Event qw(EVT_KEY_DOWN EVT_CHAR);
use base qw(Slic3r::GUI::3DScene Class::Accessor); use base qw(Slic3r::GUI::3DScene Class::Accessor);
__PACKAGE__->mk_accessors(qw( __PACKAGE__->mk_accessors(qw(
on_rotate_object_left on_rotate_object_right on_scale_object_uniformly on_arrange on_rotate_object_left on_rotate_object_right on_scale_object_uniformly
on_remove_object on_increase_objects on_decrease_objects)); on_remove_object on_increase_objects on_decrease_objects));
sub new { sub new {
@ -88,7 +88,9 @@ sub new {
$event->Skip; $event->Skip;
} else { } else {
my $key = $event->GetKeyCode; my $key = $event->GetKeyCode;
if ($key == ord('l')) { if ($key == ord('a')) {
$self->on_arrange->() if $self->on_arrange;
} elsif ($key == ord('l')) {
$self->on_rotate_object_left->() if $self->on_rotate_object_left; $self->on_rotate_object_left->() if $self->on_rotate_object_left;
} elsif ($key == ord('r')) { } elsif ($key == ord('r')) {
$self->on_rotate_object_right->() if $self->on_rotate_object_right; $self->on_rotate_object_right->() if $self->on_rotate_object_right;
@ -122,6 +124,11 @@ sub set_on_right_click {
$self->on_right_click($cb); $self->on_right_click($cb);
} }
sub set_on_arrange {
my ($self, $cb) = @_;
$self->on_arrange($cb);
}
sub set_on_rotate_object_left { sub set_on_rotate_object_left {
my ($self, $cb) = @_; my ($self, $cb) = @_;
$self->on_rotate_object_left($cb); $self->on_rotate_object_left($cb);