From 867b8fca0cdc62d5071b997f8bb615257276f036 Mon Sep 17 00:00:00 2001 From: Skarn Date: Thu, 15 Oct 2020 10:54:20 +0300 Subject: [PATCH] reject selection reset if Ctrl is pressed --- src/noggit/MapView.cpp | 48 ++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/src/noggit/MapView.cpp b/src/noggit/MapView.cpp index 64873ef6..8bafab51 100644 --- a/src/noggit/MapView.cpp +++ b/src/noggit/MapView.cpp @@ -2249,33 +2249,41 @@ void MapView::doSelection (bool selectTerrainOnly, bool mouseMove) { auto const& hit (results.front().second); - if (QGuiApplication::queryKeyboardModifiers().testFlag(Qt::ShiftModifier)) + if (terrainMode == editing_mode::object) { - if (hit.which() == eEntry_Model || hit.which() == eEntry_WMO) + if (QGuiApplication::queryKeyboardModifiers().testFlag(Qt::ShiftModifier)) { - if (!_world->is_selected(hit)) + if (hit.which() == eEntry_Model || hit.which() == eEntry_WMO) { - _world->add_to_selection(hit); + if (!_world->is_selected(hit)) + { + _world->add_to_selection(hit); + } + else if (!mouseMove) + { + _world->remove_from_selection(hit); + } } - else if (!mouseMove) + else if (hit.which() == eEntry_MapChunk) { - _world->remove_from_selection(hit); + _world->range_add_to_selection(_cursor_pos, objectEditor->brushRadius(), false); } - } - else if (hit.which() == eEntry_MapChunk) - { - _world->range_add_to_selection(_cursor_pos, objectEditor->brushRadius(), false); - } - } - else if (QGuiApplication::queryKeyboardModifiers().testFlag(Qt::ControlModifier)) - { - if (hit.which() == eEntry_MapChunk) + } + else if (QGuiApplication::queryKeyboardModifiers().testFlag(Qt::ControlModifier)) { - _world->range_add_to_selection(_cursor_pos, objectEditor->brushRadius(), true); + if (hit.which() == eEntry_MapChunk) + { + _world->range_add_to_selection(_cursor_pos, objectEditor->brushRadius(), true); + } + } + else if (!_mod_space_down && !_mod_alt_down && !_mod_ctrl_down) + { + _world->reset_selection(); + _world->add_to_selection(hit); } } - else if (!_mod_space_down && !_mod_alt_down) + else if (hit.which() == eEntry_MapChunk) { _world->reset_selection(); _world->add_to_selection(hit); @@ -2854,10 +2862,14 @@ void MapView::mousePressEvent(QMouseEvent* event) if (leftMouse) { - if (!(terrainMode == editing_mode::mccv && _mod_ctrl_down)) + if (terrainMode == editing_mode::object && !_mod_ctrl_down) { doSelection(false); } + else + { + doSelection(true); + } } else if (rightMouse) {