Put tooltip above the cursor

This commit is contained in:
pelya
2017-03-26 23:34:52 +03:00
parent 41b4fbaa67
commit ed7ec153fc
2 changed files with 5 additions and 5 deletions

View File

@@ -690,8 +690,8 @@ struct TooltipsWindow : public Window
/* Correctly position the tooltip position, watch out for window and cursor size
* Clamp value to below main toolbar and above statusbar. If tooltip would
* go below window, flip it so it is shown above the cursor */
pt.y = Clamp(_cursor.pos.y + _cursor.total_size.y + _cursor.total_offs.y + 5, scr_top, scr_bot);
if (pt.y + sm_height > scr_bot) pt.y = min(_cursor.pos.y + _cursor.total_offs.y - 5, scr_bot) - sm_height;
pt.y = min(_cursor.pos.y + _cursor.total_offs.y - 5, scr_bot) - sm_height - GetMinSizing(NWST_STEP);
if (pt.y < scr_top) pt.y = Clamp(_cursor.pos.y + _cursor.total_size.y + _cursor.total_offs.y + 5, scr_top, scr_bot) + GetMinSizing(NWST_STEP);
pt.x = sm_width >= _screen.width ? 0 : Clamp(_cursor.pos.x - (sm_width >> 1), 0, _screen.width - sm_width);
if (_settings_client.gui.windows_titlebars) {

View File

@@ -2080,7 +2080,7 @@ static void HandleMouseDragNoTitlebars()
if (_settings_client.gui.windows_titlebars || _dragging_window ||
!_left_button_down || _focused_window == NULL || _dragging_widget) return;
unsigned distance = abs(_cursor.pos.x - _left_button_down_pos.x) + abs(_cursor.pos.y - _left_button_down_pos.y);
if (distance * 2 > GetMinSizing(NWST_STEP, 6)) {
if (distance * 2 > GetMinSizing(NWST_STEP)) {
//SendLeftClickEventToWindow(_focused_window, _left_button_down_pos.x, _left_button_down_pos.y, 1);
StartWindowDrag(_focused_window);
_drag_delta.x += _cursor.pos.x - _left_button_down_pos.x;
@@ -2296,8 +2296,8 @@ static bool GetWindowDraggedOffScreen(Window *w)
if (_settings_client.gui.windows_titlebars) return false;
Rect edge = { 0, GetMainViewTop(), _screen.width, _screen.height };
if (_settings_client.gui.vertical_toolbar && _game_mode != GM_EDITOR) {
edge.left += GetMinSizing(NWST_BUTTON, 1);
edge.right -= GetMinSizing(NWST_BUTTON, 1);
edge.left += GetMinSizing(NWST_BUTTON);
edge.right -= GetMinSizing(NWST_BUTTON);
}
if (w->left < edge.left && w->left + w->width < edge.right) return true;
if (w->left + w->width > edge.right && w->left > edge.left) return true;