From 461eb3a21a6872cf9a639ecbd6f9f21c8ff751b5 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 14 Aug 2016 19:48:58 +0300 Subject: Allow open submenus in same position with parent menu. --- src/gui/popups/popupmenu.cpp | 20 ++++++++++++++++++-- src/gui/popups/popupmenu.h | 2 ++ 2 files changed, 20 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 1bfa0e3e1..c3bd94087 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -482,6 +482,22 @@ void PopupMenu::setMousePos() } } +void PopupMenu::setMousePos2() +{ + if (mX == 0 && mY == 0) + { + if (viewport) + { + mX = viewport->mMouseX; + mY = viewport->mMouseY; + } + else + { + Gui::getMouseState(mX, mY); + } + } +} + void PopupMenu::showPopup(const int x, const int y, const std::vector &beings) { @@ -2392,7 +2408,7 @@ void PopupMenu::showSkillLevelPopup(const SkillInfo *const info) { if (!info) return; - setMousePos(); + setMousePos2(); // using mItemId as skill id mItemId = info->id; @@ -2430,7 +2446,7 @@ void PopupMenu::showSkillTypePopup(const SkillInfo *const info) { if (!info) return; - setMousePos(); + setMousePos2(); // using mItemId as skill id mItemId = info->id; diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h index ba88e93f1..b84375dcd 100644 --- a/src/gui/popups/popupmenu.h +++ b/src/gui/popups/popupmenu.h @@ -188,6 +188,8 @@ class PopupMenu final : public Popup, public LinkHandler private: void setMousePos(); + void setMousePos2(); + void addPlayerRelation(const std::string &name); void addFollow(); -- cgit v1.2.3-70-g09d2