When testing for a key press, rather check for the modifier keys
(alt, ctrl) always. Also if a key event is not processed, pass it for further processing.
This commit is contained in:
parent
53d08d1883
commit
dabcff1c07
@ -52,18 +52,24 @@ sub new {
|
||||
});
|
||||
EVT_KEY_DOWN($canvas, sub {
|
||||
my ($s, $event) = @_;
|
||||
my $key = $event->GetKeyCode;
|
||||
if ($key == ord('D') || $key == WXK_LEFT) {
|
||||
# Keys: 'D' or WXK_LEFT
|
||||
$slider->SetValue($slider->GetValue - 1);
|
||||
$self->set_z($self->{layers_z}[$slider->GetValue]);
|
||||
} elsif ($key == ord('U') || $key == WXK_RIGHT) {
|
||||
# Keys: 'U' or WXK_RIGHT
|
||||
$slider->SetValue($slider->GetValue + 1);
|
||||
$self->set_z($self->{layers_z}[$slider->GetValue]);
|
||||
} elsif ($key >= ord('1') && $key <= ord('3')) {
|
||||
# Keys: '1' to '3'
|
||||
$canvas->set_simulation_mode($key - ord('1'));
|
||||
if ($event->HasModifiers) {
|
||||
$event->Skip;
|
||||
} else {
|
||||
my $key = $event->GetKeyCode;
|
||||
if ($key == ord('D') || $key == WXK_LEFT) {
|
||||
# Keys: 'D' or WXK_LEFT
|
||||
$slider->SetValue($slider->GetValue - 1);
|
||||
$self->set_z($self->{layers_z}[$slider->GetValue]);
|
||||
} elsif ($key == ord('U') || $key == WXK_RIGHT) {
|
||||
# Keys: 'U' or WXK_RIGHT
|
||||
$slider->SetValue($slider->GetValue + 1);
|
||||
$self->set_z($self->{layers_z}[$slider->GetValue]);
|
||||
} elsif ($key >= ord('1') && $key <= ord('3')) {
|
||||
# Keys: '1' to '3'
|
||||
$canvas->set_simulation_mode($key - ord('1'));
|
||||
} else {
|
||||
$event->Skip;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -89,20 +89,26 @@ sub new {
|
||||
EVT_KEY_DOWN($canvas, sub {
|
||||
my ($s, $event) = @_;
|
||||
my $key = $event->GetKeyCode;
|
||||
if ($key == ord('U') || $key == WXK_RIGHT) {
|
||||
$slider_high->SetValue($slider_high->GetValue + 1);
|
||||
$slider_low->SetValue($slider_high->GetValue) if ($event->ShiftDown());
|
||||
$self->set_z_idx_high($slider_high->GetValue);
|
||||
} elsif ($key == ord('D') || $key == WXK_LEFT) {
|
||||
$slider_high->SetValue($slider_high->GetValue - 1);
|
||||
$slider_low->SetValue($slider_high->GetValue) if ($event->ShiftDown());
|
||||
$self->set_z_idx_high($slider_high->GetValue);
|
||||
} elsif ($key == ord('S')) {
|
||||
$checkbox_singlelayer->SetValue(! $checkbox_singlelayer->GetValue());
|
||||
$self->single_layer($checkbox_singlelayer->GetValue());
|
||||
if ($self->single_layer) {
|
||||
$slider_low->SetValue($slider_high->GetValue);
|
||||
if ($event->HasModifiers) {
|
||||
$event->Skip;
|
||||
} else {
|
||||
if ($key == ord('U') || $key == WXK_RIGHT) {
|
||||
$slider_high->SetValue($slider_high->GetValue + 1);
|
||||
$slider_low->SetValue($slider_high->GetValue) if ($event->ShiftDown());
|
||||
$self->set_z_idx_high($slider_high->GetValue);
|
||||
} elsif ($key == ord('D') || $key == WXK_LEFT) {
|
||||
$slider_high->SetValue($slider_high->GetValue - 1);
|
||||
$slider_low->SetValue($slider_high->GetValue) if ($event->ShiftDown());
|
||||
$self->set_z_idx_high($slider_high->GetValue);
|
||||
} elsif ($key == ord('S')) {
|
||||
$checkbox_singlelayer->SetValue(! $checkbox_singlelayer->GetValue());
|
||||
$self->single_layer($checkbox_singlelayer->GetValue());
|
||||
if ($self->single_layer) {
|
||||
$slider_low->SetValue($slider_high->GetValue);
|
||||
$self->set_z_idx_high($slider_high->GetValue);
|
||||
}
|
||||
} else {
|
||||
$event->Skip;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -50,14 +50,19 @@ sub new {
|
||||
});
|
||||
EVT_KEY_DOWN($canvas, sub {
|
||||
my ($s, $event) = @_;
|
||||
|
||||
my $key = $event->GetKeyCode;
|
||||
if ($key == 85 || $key == 315) {
|
||||
$slider->SetValue($slider->GetValue + 1);
|
||||
$self->set_z($self->{layers_z}[$slider->GetValue]);
|
||||
} elsif ($key == 68 || $key == 317) {
|
||||
$slider->SetValue($slider->GetValue - 1);
|
||||
$self->set_z($self->{layers_z}[$slider->GetValue]);
|
||||
if ($event->HasModifiers) {
|
||||
$event->Skip;
|
||||
} else {
|
||||
my $key = $event->GetKeyCode;
|
||||
if ($key == 85 || $key == 315) {
|
||||
$slider->SetValue($slider->GetValue + 1);
|
||||
$self->set_z($self->{layers_z}[$slider->GetValue]);
|
||||
} elsif ($key == 68 || $key == 317) {
|
||||
$slider->SetValue($slider->GetValue - 1);
|
||||
$self->set_z($self->{layers_z}[$slider->GetValue]);
|
||||
} else {
|
||||
$event->Skip;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user