mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-04 00:15:53 +02:00
Merge pull request #4665 from SoundSSGood/quickbackpack-shift+click
QuickBackpack window is now accessible by shift-clicking
This commit is contained in:
commit
dc45d82558
@ -254,6 +254,10 @@ void EventDispatcher::handleLeftButtonClick(const Point & position, int toleranc
|
||||
i->mouseClickedState = isPressed;
|
||||
i->clickCancel(position);
|
||||
}
|
||||
else if(isPressed)
|
||||
{
|
||||
i->notFocusedClick();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ public:
|
||||
virtual void clickCancel(const Point & cursorPosition) {}
|
||||
virtual void showPopupWindow(const Point & cursorPosition) {}
|
||||
virtual void clickDouble(const Point & cursorPosition) {}
|
||||
virtual void notFocusedClick() {};
|
||||
|
||||
/// Called when user pans screen by specified distance
|
||||
virtual void gesturePanning(const Point & initialPosition, const Point & currentPosition, const Point & lastUpdateDistance) {}
|
||||
|
@ -77,6 +77,7 @@ CHeroQuickBackpackWindow::CHeroQuickBackpackWindow(const CGHeroInstance * hero,
|
||||
addSet(arts);
|
||||
arts->setHero(hero);
|
||||
addUsedEvents(GESTURE);
|
||||
addUsedEvents(LCLICK);
|
||||
pos.w = stretchedBackground->pos.w = arts->pos.w + 2 * windowMargin;
|
||||
pos.h = stretchedBackground->pos.h = arts->pos.h + windowMargin;
|
||||
}
|
||||
@ -96,6 +97,11 @@ void CHeroQuickBackpackWindow::gesturePanning(const Point & initialPosition, con
|
||||
redraw();
|
||||
}
|
||||
|
||||
void CHeroQuickBackpackWindow::notFocusedClick()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
void CHeroQuickBackpackWindow::showAll(Canvas & to)
|
||||
{
|
||||
if(arts->getSlotsNum() == 0)
|
||||
|
@ -33,6 +33,7 @@ public:
|
||||
CHeroQuickBackpackWindow(const CGHeroInstance * hero, ArtifactPosition targetSlot);
|
||||
void gesture(bool on, const Point & initialPosition, const Point & finalPosition) override;
|
||||
void gesturePanning(const Point & initialPosition, const Point & currentPosition, const Point & lastUpdateDistance) override;
|
||||
void notFocusedClick() override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<CArtifactsOfHeroQuickBackpack> arts;
|
||||
|
@ -86,6 +86,11 @@ void CWindowWithArtifacts::clickPressedOnArtPlace(const CGHeroInstance * hero, c
|
||||
if(allowExchange || hero->id == heroArtOwner->id)
|
||||
putPickedArtifact(*hero, slot);
|
||||
}
|
||||
else if(GH.isKeyboardShiftDown())
|
||||
{
|
||||
if(ArtifactUtils::isSlotEquipment(slot))
|
||||
GH.windows().createAndPushWindow<CHeroQuickBackpackWindow>(hero, slot);
|
||||
}
|
||||
else if(auto art = hero->getArt(slot))
|
||||
{
|
||||
if(hero->getOwner() == LOCPLINT->playerID)
|
||||
|
Loading…
Reference in New Issue
Block a user