1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-06 02:15:32 +00:00

Allow drag-and-drop to be cancelled (Esc or Inventory key)

This commit is contained in:
scrawl 2017-09-22 23:25:20 +02:00
parent 269094ba8d
commit 531e7ac586
3 changed files with 18 additions and 4 deletions

View file

@ -125,6 +125,8 @@ void DragAndDrop::finish()
{
mIsOnDragAndDrop = false;
mSourceSortModel->clearDragItems();
// since mSourceView doesn't get updated in drag()
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->updateItemView();
MyGUI::Gui::getInstance().destroyWidget(mDraggedWidget);
mDraggedWidget = 0;

View file

@ -755,7 +755,14 @@ namespace MWGui
mGarbageDialogs.push_back(dialog);
}
void WindowManager::exitCurrentGuiMode() {
void WindowManager::exitCurrentGuiMode()
{
if (mDragAndDrop && mDragAndDrop->mIsOnDragAndDrop)
{
mDragAndDrop->finish();
return;
}
switch(mGuiModes.back()) {
case GM_QuickKeysMenu:
mQuickKeysMenu->exit();
@ -1247,6 +1254,11 @@ namespace MWGui
void WindowManager::popGuiMode()
{
if (mDragAndDrop && mDragAndDrop->mIsOnDragAndDrop)
{
mDragAndDrop->finish();
}
if (!mGuiModes.empty())
{
mGuiModeStates[mGuiModes.back()].update(false);

View file

@ -177,13 +177,13 @@ namespace MWInput
void InputManager::channelChanged(ICS::Channel* channel, float currentValue, float previousValue)
{
if (mDragDrop)
return;
resetIdleTime ();
int action = channel->getNumber();
if (mDragDrop && action != A_GameMenu && action != A_Inventory)
return;
if((previousValue == 1 || previousValue == 0) && (currentValue==1 || currentValue==0))
{
//Is a normal button press, so don't change it at all