From 59d5eedf61d31a0812e2acec55e4dd6fff6fa546 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 14 Jul 2024 07:37:05 +0200 Subject: [PATCH] Fix logic. --- modules/tile_map/tile_map_editor_plugin.cpp | 6 ++++-- modules/tile_map/tile_map_editor_plugin.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/tile_map/tile_map_editor_plugin.cpp b/modules/tile_map/tile_map_editor_plugin.cpp index c80239fdc..5aef266cc 100644 --- a/modules/tile_map/tile_map_editor_plugin.cpp +++ b/modules/tile_map/tile_map_editor_plugin.cpp @@ -1028,9 +1028,9 @@ bool TileMapEditor::forward_gui_input(const Ref &p_event) { // Keep track internally of which mouse buttons are pressed // so we can disallow changing tool. if (mb->is_pressed()) { - _mouse_buttons_pressed |= mb->get_button_index(); + _mouse_buttons_pressed |= (1 << mb->get_button_index()); } else { - _mouse_buttons_pressed &= ~mb->get_button_index(); + _mouse_buttons_pressed &= ~(1 << mb->get_button_index()); } if (mb->get_button_index() == BUTTON_LEFT) { @@ -1948,6 +1948,8 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { editor = p_editor; undo_redo = EditorNode::get_undo_redo(); + _mouse_buttons_pressed = 0; + tool = TOOL_NONE; selection_active = false; mouse_over = false; diff --git a/modules/tile_map/tile_map_editor_plugin.h b/modules/tile_map/tile_map_editor_plugin.h index 29203c13b..aff880c5e 100644 --- a/modules/tile_map/tile_map_editor_plugin.h +++ b/modules/tile_map/tile_map_editor_plugin.h @@ -111,7 +111,7 @@ class TileMapEditor : public VBoxContainer { Tool tool; Tool last_tool; - uint32_t _mouse_buttons_pressed = 0; + uint32_t _mouse_buttons_pressed; bool selection_active; bool mouse_over;