mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 04:06:14 +00:00
Add is_valid() check for InputEventKey in CanvasItemEditor.
This commit is contained in:
parent
efe5c250d5
commit
7941235e06
@ -479,22 +479,24 @@ void CanvasItemEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (k->get_keycode() == KEY_CONTROL || k->get_keycode() == KEY_ALT || k->get_keycode() == KEY_SHIFT) {
|
||||
viewport->update();
|
||||
}
|
||||
if (k.is_valid()) {
|
||||
if (k->get_keycode() == KEY_CONTROL || k->get_keycode() == KEY_ALT || k->get_keycode() == KEY_SHIFT) {
|
||||
viewport->update();
|
||||
}
|
||||
|
||||
if (k->is_pressed() && !k->get_control() && !k->is_echo()) {
|
||||
if ((grid_snap_active || show_grid) && multiply_grid_step_shortcut.is_valid() && multiply_grid_step_shortcut->is_shortcut(p_ev)) {
|
||||
// Multiply the grid size
|
||||
grid_step_multiplier = MIN(grid_step_multiplier + 1, 12);
|
||||
viewport->update();
|
||||
} else if ((grid_snap_active || show_grid) && divide_grid_step_shortcut.is_valid() && divide_grid_step_shortcut->is_shortcut(p_ev)) {
|
||||
// Divide the grid size
|
||||
Point2 new_grid_step = grid_step * Math::pow(2.0, grid_step_multiplier - 1);
|
||||
if (new_grid_step.x >= 1.0 && new_grid_step.y >= 1.0) {
|
||||
grid_step_multiplier--;
|
||||
if (k->is_pressed() && !k->get_control() && !k->is_echo()) {
|
||||
if ((grid_snap_active || show_grid) && multiply_grid_step_shortcut.is_valid() && multiply_grid_step_shortcut->is_shortcut(p_ev)) {
|
||||
// Multiply the grid size
|
||||
grid_step_multiplier = MIN(grid_step_multiplier + 1, 12);
|
||||
viewport->update();
|
||||
} else if ((grid_snap_active || show_grid) && divide_grid_step_shortcut.is_valid() && divide_grid_step_shortcut->is_shortcut(p_ev)) {
|
||||
// Divide the grid size
|
||||
Point2 new_grid_step = grid_step * Math::pow(2.0, grid_step_multiplier - 1);
|
||||
if (new_grid_step.x >= 1.0 && new_grid_step.y >= 1.0) {
|
||||
grid_step_multiplier--;
|
||||
}
|
||||
viewport->update();
|
||||
}
|
||||
viewport->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ MenuButton::MenuButton() {
|
||||
set_toggle_mode(true);
|
||||
set_disable_shortcuts(false);
|
||||
set_process_unhandled_key_input(true);
|
||||
set_enabled_focus_mode(FOCUS_NONE);
|
||||
set_focus_mode(FOCUS_NONE);
|
||||
set_action_mode(ACTION_MODE_BUTTON_PRESS);
|
||||
|
||||
popup = memnew(PopupMenu);
|
||||
|
Loading…
Reference in New Issue
Block a user