Allow using numpad for zoom shortcuts in the 2D/code editors
This behavior is consistent with GIMP.
This commit is contained in:
parent
9e3b2561a4
commit
ccf088b40b
2 changed files with 32 additions and 12 deletions
|
@ -1869,7 +1869,8 @@ CodeTextEditor::CodeTextEditor() {
|
|||
code_complete_func = nullptr;
|
||||
ED_SHORTCUT("script_editor/zoom_in", TTR("Zoom In"), KeyModifierMask::CMD | Key::EQUAL);
|
||||
ED_SHORTCUT("script_editor/zoom_out", TTR("Zoom Out"), KeyModifierMask::CMD | Key::MINUS);
|
||||
ED_SHORTCUT("script_editor/reset_zoom", TTR("Reset Zoom"), KeyModifierMask::CMD | Key::KEY_0);
|
||||
ED_SHORTCUT_ARRAY("script_editor/reset_zoom", TTR("Reset Zoom"),
|
||||
{ int32_t(KeyModifierMask::CMD | Key::KEY_0), int32_t(KeyModifierMask::CMD | Key::KP_0) });
|
||||
|
||||
text_editor = memnew(CodeEdit);
|
||||
add_child(text_editor);
|
||||
|
|
|
@ -5020,17 +5020,36 @@ CanvasItemEditor::CanvasItemEditor() {
|
|||
controls_vb->set_begin(Point2(5, 5));
|
||||
|
||||
// To ensure that scripts can parse the list of shortcuts correctly, we have to define
|
||||
// those shortcuts one by one. Define shortcut before using it (by EditorZoomWidget)
|
||||
ED_SHORTCUT("canvas_item_editor/zoom_3.125_percent", TTR("Zoom to 3.125%"), KeyModifierMask::SHIFT | Key::KEY_5);
|
||||
ED_SHORTCUT("canvas_item_editor/zoom_6.25_percent", TTR("Zoom to 6.25%"), KeyModifierMask::SHIFT | Key::KEY_4);
|
||||
ED_SHORTCUT("canvas_item_editor/zoom_12.5_percent", TTR("Zoom to 12.5%"), KeyModifierMask::SHIFT | Key::KEY_3);
|
||||
ED_SHORTCUT("canvas_item_editor/zoom_25_percent", TTR("Zoom to 25%"), KeyModifierMask::SHIFT | Key::KEY_2);
|
||||
ED_SHORTCUT("canvas_item_editor/zoom_50_percent", TTR("Zoom to 50%"), KeyModifierMask::SHIFT | Key::KEY_1);
|
||||
ED_SHORTCUT_ARRAY("canvas_item_editor/zoom_100_percent", TTR("Zoom to 100%"), { (int32_t)Key::KEY_1, (int32_t)(KeyModifierMask::CMD | Key::KEY_0) });
|
||||
ED_SHORTCUT("canvas_item_editor/zoom_200_percent", TTR("Zoom to 200%"), Key::KEY_2);
|
||||
ED_SHORTCUT("canvas_item_editor/zoom_400_percent", TTR("Zoom to 400%"), Key::KEY_3);
|
||||
ED_SHORTCUT("canvas_item_editor/zoom_800_percent", TTR("Zoom to 800%"), Key::KEY_4);
|
||||
ED_SHORTCUT("canvas_item_editor/zoom_1600_percent", TTR("Zoom to 1600%"), Key::KEY_5);
|
||||
// those shortcuts one by one. Define shortcut before using it (by EditorZoomWidget).
|
||||
ED_SHORTCUT_ARRAY("canvas_item_editor/zoom_3.125_percent", TTR("Zoom to 3.125%"),
|
||||
{ int32_t(KeyModifierMask::SHIFT | Key::KEY_5), int32_t(KeyModifierMask::SHIFT | Key::KP_5) });
|
||||
|
||||
ED_SHORTCUT_ARRAY("canvas_item_editor/zoom_6.25_percent", TTR("Zoom to 6.25%"),
|
||||
{ int32_t(KeyModifierMask::SHIFT | Key::KEY_4), int32_t(KeyModifierMask::SHIFT | Key::KP_4) });
|
||||
|
||||
ED_SHORTCUT_ARRAY("canvas_item_editor/zoom_12.5_percent", TTR("Zoom to 12.5%"),
|
||||
{ int32_t(KeyModifierMask::SHIFT | Key::KEY_3), int32_t(KeyModifierMask::SHIFT | Key::KP_3) });
|
||||
|
||||
ED_SHORTCUT_ARRAY("canvas_item_editor/zoom_25_percent", TTR("Zoom to 25%"),
|
||||
{ int32_t(KeyModifierMask::SHIFT | Key::KEY_2), int32_t(KeyModifierMask::SHIFT | Key::KP_2) });
|
||||
|
||||
ED_SHORTCUT_ARRAY("canvas_item_editor/zoom_50_percent", TTR("Zoom to 50%"),
|
||||
{ int32_t(KeyModifierMask::SHIFT | Key::KEY_1), int32_t(KeyModifierMask::SHIFT | Key::KP_1) });
|
||||
|
||||
ED_SHORTCUT_ARRAY("canvas_item_editor/zoom_100_percent", TTR("Zoom to 100%"),
|
||||
{ int32_t(Key::KEY_1), int32_t(KeyModifierMask::CMD | Key::KEY_0), int32_t(Key::KP_1), int32_t(KeyModifierMask::CMD | Key::KP_0) });
|
||||
|
||||
ED_SHORTCUT_ARRAY("canvas_item_editor/zoom_200_percent", TTR("Zoom to 200%"),
|
||||
{ int32_t(Key::KEY_2), int32_t(Key::KP_2) });
|
||||
|
||||
ED_SHORTCUT_ARRAY("canvas_item_editor/zoom_400_percent", TTR("Zoom to 400%"),
|
||||
{ int32_t(Key::KEY_3), int32_t(Key::KP_3) });
|
||||
|
||||
ED_SHORTCUT_ARRAY("canvas_item_editor/zoom_800_percent", TTR("Zoom to 800%"),
|
||||
{ int32_t(Key::KEY_4), int32_t(Key::KP_4) });
|
||||
|
||||
ED_SHORTCUT_ARRAY("canvas_item_editor/zoom_1600_percent", TTR("Zoom to 1600%"),
|
||||
{ int32_t(Key::KEY_5), int32_t(Key::KP_5) });
|
||||
|
||||
zoom_widget = memnew(EditorZoomWidget);
|
||||
controls_vb->add_child(zoom_widget);
|
||||
|
|
Loading…
Reference in a new issue