noggit: mapview: fix set area ID menu shortcut preventing other tool to use the keybind

894a2bcfa0
This commit is contained in:
T1ti
2024-09-01 03:54:33 +02:00
parent f192343144
commit 6211c578eb

View File

@@ -1353,9 +1353,8 @@ void MapView::setupAssistMenu()
assist_menu->addSeparator(); assist_menu->addSeparator();
assist_menu->addAction(createTextSeparator("Current ADT")); assist_menu->addAction(createTextSeparator("Current ADT"));
assist_menu->addSeparator(); assist_menu->addSeparator();
ADD_ACTION ( assist_menu ADD_ACTION_NS( assist_menu
, "Set Area ID" , "Set Area ID"
, "F"
, [this] , [this]
{ {
if (terrainMode == editing_mode::areaid && _selected_area_id != -1) if (terrainMode == editing_mode::areaid && _selected_area_id != -1)
@@ -2662,6 +2661,20 @@ void MapView::setupHotkeys()
, [&] { return terrainMode == editing_mode::holes && !NOGGIT_CUR_ACTION; } , [&] { return terrainMode == editing_mode::holes && !NOGGIT_CUR_ACTION; }
); );
addHotkey(Qt::Key_F
, MOD_none
, [&]
{
if (_selected_area_id != -1)
{
NOGGIT_ACTION_MGR->beginAction(this, Noggit::ActionFlags::eCHUNKS_AREAID);
_world->setAreaID(_camera.position, _selected_area_id, true);
NOGGIT_ACTION_MGR->endAction();
}
}
, [&] { return terrainMode == editing_mode::areaid && !NOGGIT_CUR_ACTION; }
);
addHotkey ( Qt::Key_T addHotkey ( Qt::Key_T
, MOD_none , MOD_none
, [&] , [&]
@@ -5049,6 +5062,11 @@ void MapView::draw_map()
void MapView::keyPressEvent (QKeyEvent *event) void MapView::keyPressEvent (QKeyEvent *event)
{ {
if (event->key() == Qt::Key_Space)
{
_mod_space_down = true;
}
size_t const modifier size_t const modifier
( ((event->modifiers() & Qt::ShiftModifier) ? MOD_shift : 0) ( ((event->modifiers() & Qt::ShiftModifier) ? MOD_shift : 0)
| ((event->modifiers() & Qt::ControlModifier) ? MOD_ctrl : 0) | ((event->modifiers() & Qt::ControlModifier) ? MOD_ctrl : 0)
@@ -5070,9 +5088,6 @@ void MapView::keyPressEvent (QKeyEvent *event)
} }
} }
if (event->key() == Qt::Key_Space)
_mod_space_down = true;
checkInputsSettings(); checkInputsSettings();
// movement // movement