summaryrefslogtreecommitdiff
path: root/src/gui/widgets/skillrectanglelistbox.h
diff options
context:
space:
mode:
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)
{