summaryrefslogtreecommitdiff
path: root/src/gui/widgets/skillrectanglelistbox.h
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-12-15 21:34:03 +0300
committerAndrei Karas <akaras@inbox.ru>2016-12-15 21:34:03 +0300
commit1a934c4064abc2675fe199ff906dd08e6fcc0a85 (patch)
treea3a1ac84c8dd6e3af92c3320e1d14e4739fa2fba /src/gui/widgets/skillrectanglelistbox.h
parent8b162cba1ae30c00cb875b24fe12e4d60307ba55 (diff)
downloadplus-1a934c4064abc2675fe199ff906dd08e6fcc0a85.tar.gz
plus-1a934c4064abc2675fe199ff906dd08e6fcc0a85.tar.bz2
plus-1a934c4064abc2675fe199ff906dd08e6fcc0a85.tar.xz
plus-1a934c4064abc2675fe199ff906dd08e6fcc0a85.zip
Fix skill level menu selection in rectangular skill tabs.
Diffstat (limited to 'src/gui/widgets/skillrectanglelistbox.h')
-rw-r--r--src/gui/widgets/skillrectanglelistbox.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/gui/widgets/skillrectanglelistbox.h b/src/gui/widgets/skillrectanglelistbox.h
index 584e2208c..6d65912ed 100644
--- a/src/gui/widgets/skillrectanglelistbox.h
+++ b/src/gui/widgets/skillrectanglelistbox.h
@@ -333,11 +333,22 @@ class SkillRectangleListBox final : public Widget,
model->getSkillAt(mSelected) == skill)
{
skillPopup->hide();
- if (button == MouseButton::LEFT &&
- event.getX() >
- getWidth() - mPadding - skill->skillLevelWidth)
+
+ const int x = skill->x * mBoxWidth + mPadding;
+ const int y = skill->y * mBoxHeight + mPadding;
+ Font *const font = getFont();
+ const int height = font->getHeight();
+ const int eventX = event.getX();
+ const int eventY = event.getY() - mTextYOffset;
+ if (button == MouseButton::LEFT)
{
- popupMenu->showSkillLevelPopup(skill);
+ if (eventX >= x + mTextXOffset &&
+ eventX <= x + mBoxWidth - mTextXOffset &&
+ eventY >= y &&
+ eventY <= y + height)
+ {
+ popupMenu->showSkillLevelPopup(skill);
+ }
}
else if (button == MouseButton::RIGHT)
{