mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-03 17:19:39 +00:00
simplify drag and drop on avatar for potions and ingredients
This commit is contained in:
parent
33ceddc58b
commit
43f94a8890
2 changed files with 17 additions and 5 deletions
|
@ -213,11 +213,13 @@ namespace MWGui
|
||||||
|
|
||||||
void InventoryWindow::onItemSelected (int index)
|
void InventoryWindow::onItemSelected (int index)
|
||||||
{
|
{
|
||||||
onItemSelectedFromSourceModel (mSortModel->mapToSource(index));
|
onItemSelectedFromSourceModel (mSortModel->mapToSource(index), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InventoryWindow::onItemSelectedFromSourceModel (int index)
|
void InventoryWindow::onItemSelectedFromSourceModel (int index, bool takeMaxItemCount)
|
||||||
{
|
{
|
||||||
|
mLastItemIndex = index;
|
||||||
|
|
||||||
if (mDragAndDrop->mIsOnDragAndDrop)
|
if (mDragAndDrop->mIsOnDragAndDrop)
|
||||||
{
|
{
|
||||||
mDragAndDrop->drop(mTradeModel, mItemView);
|
mDragAndDrop->drop(mTradeModel, mItemView);
|
||||||
|
@ -230,7 +232,8 @@ namespace MWGui
|
||||||
MWWorld::Ptr object = item.mBase;
|
MWWorld::Ptr object = item.mBase;
|
||||||
int count = item.mCount;
|
int count = item.mCount;
|
||||||
|
|
||||||
bool shift = MyGUI::InputManager::getInstance().isShiftPressed();
|
bool shift = takeMaxItemCount ? true : MyGUI::InputManager::getInstance().isShiftPressed();
|
||||||
|
|
||||||
if (MyGUI::InputManager::getInstance().isControlPressed())
|
if (MyGUI::InputManager::getInstance().isControlPressed())
|
||||||
count = 1;
|
count = 1;
|
||||||
|
|
||||||
|
@ -528,6 +531,8 @@ namespace MWGui
|
||||||
if (mDragAndDrop->mIsOnDragAndDrop)
|
if (mDragAndDrop->mIsOnDragAndDrop)
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptr = mDragAndDrop->mItem.mBase;
|
MWWorld::Ptr ptr = mDragAndDrop->mItem.mBase;
|
||||||
|
int itemType = ptr.getContainerStore()->getType(ptr);
|
||||||
|
|
||||||
mDragAndDrop->finish();
|
mDragAndDrop->finish();
|
||||||
|
|
||||||
if (mDragAndDrop->mSourceModel != mTradeModel)
|
if (mDragAndDrop->mSourceModel != mTradeModel)
|
||||||
|
@ -536,6 +541,12 @@ namespace MWGui
|
||||||
ptr = mDragAndDrop->mSourceModel->moveItem(mDragAndDrop->mItem, mDragAndDrop->mDraggedCount, mTradeModel);
|
ptr = mDragAndDrop->mSourceModel->moveItem(mDragAndDrop->mItem, mDragAndDrop->mDraggedCount, mTradeModel);
|
||||||
}
|
}
|
||||||
useItem(ptr);
|
useItem(ptr);
|
||||||
|
|
||||||
|
if ((itemType == MWWorld::ContainerStore::Type_Ingredient || itemType == MWWorld::ContainerStore::Type_Potion) && mDragAndDrop->mDraggedCount > 1)
|
||||||
|
{
|
||||||
|
onItemSelectedFromSourceModel(mLastItemIndex, true);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -550,7 +561,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
if (mTradeModel->getItem(i).mBase == itemSelected)
|
if (mTradeModel->getItem(i).mBase == itemSelected)
|
||||||
{
|
{
|
||||||
onItemSelectedFromSourceModel(i);
|
onItemSelectedFromSourceModel(i, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,7 @@ namespace MWGui
|
||||||
DragAndDrop* mDragAndDrop;
|
DragAndDrop* mDragAndDrop;
|
||||||
|
|
||||||
int mSelectedItem;
|
int mSelectedItem;
|
||||||
|
int mLastItemIndex;
|
||||||
|
|
||||||
MWWorld::Ptr mPtr;
|
MWWorld::Ptr mPtr;
|
||||||
|
|
||||||
|
@ -103,7 +104,7 @@ namespace MWGui
|
||||||
bool mTrading;
|
bool mTrading;
|
||||||
|
|
||||||
void onItemSelected(int index);
|
void onItemSelected(int index);
|
||||||
void onItemSelectedFromSourceModel(int index);
|
void onItemSelectedFromSourceModel(int index, bool takeMaxCount);
|
||||||
|
|
||||||
void onBackgroundSelected();
|
void onBackgroundSelected();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue