mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 17:11:30 +00:00
Implement zooming using Ctrl + Mouse wheel in the TileMap editor
This was previously implemented in the GridMap editor. This makes the same feature available in the TileMap editor.
This commit is contained in:
parent
dc67d0737b
commit
def2059d67
2 changed files with 17 additions and 0 deletions
|
|
@ -194,6 +194,21 @@ void TileMapEditor::_palette_multi_selected(int index, bool selected) {
|
|||
_update_palette();
|
||||
}
|
||||
|
||||
void TileMapEditor::_palette_input(const Ref<InputEvent> &p_event) {
|
||||
const Ref<InputEventMouseButton> mb = p_event;
|
||||
|
||||
// Zoom in/out using Ctrl + mouse wheel.
|
||||
if (mb.is_valid() && mb->is_pressed() && mb->get_command()) {
|
||||
if (mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_UP) {
|
||||
size_slider->set_value(size_slider->get_value() + 0.2);
|
||||
}
|
||||
|
||||
if (mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_DOWN) {
|
||||
size_slider->set_value(size_slider->get_value() - 0.2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TileMapEditor::_canvas_mouse_enter() {
|
||||
mouse_over = true;
|
||||
CanvasItemEditor::get_singleton()->update_viewport();
|
||||
|
|
@ -1913,6 +1928,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
|
|||
palette->add_theme_constant_override("vseparation", 8 * EDSCALE);
|
||||
palette->connect("item_selected", callable_mp(this, &TileMapEditor::_palette_selected));
|
||||
palette->connect("multi_selected", callable_mp(this, &TileMapEditor::_palette_multi_selected));
|
||||
palette->connect("gui_input", callable_mp(this, &TileMapEditor::_palette_input));
|
||||
palette_container->add_child(palette);
|
||||
|
||||
// Add message for when no texture is selected.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue