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

pull/303/head
scrawl 7 years ago
parent 269094ba8d
commit 531e7ac586

@ -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;

@ -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);

@ -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

Loading…
Cancel
Save