Skip to content

Commit dff23f8

Browse files
falbrechtskirchingerFlamefire
authored andcommitted
Place tooltip at consistent distance to cursor
Avoids overlapping the tooltip with the cursor when drawing the tooltip to the right of the mouse position.
1 parent 9dd260a commit dff23f8

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

libs/s25main/WindowManager.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -857,9 +857,11 @@ void WindowManager::DrawToolTip()
857857
// Tooltip zeichnen
858858
if(curTooltip && lastMousePos.isValid())
859859
{
860-
// Horizontal pace between mouse position and tooltip border
861-
constexpr unsigned rightSpacing = 25;
862-
constexpr unsigned leftSpacing = 10;
860+
constexpr unsigned cursorWidth = 32;
861+
constexpr unsigned cursorPadding = 5;
862+
// Horizontal space between mouse position and tooltip border
863+
constexpr unsigned rightSpacing = cursorWidth + cursorPadding;
864+
constexpr unsigned leftSpacing = cursorPadding;
863865
DrawPoint ttPos = DrawPoint(lastMousePos.x + rightSpacing, lastMousePos.y);
864866
unsigned right_edge = ttPos.x + curTooltip->getWidth();
865867

0 commit comments

Comments
 (0)