From b9c1db08dc1f05f9034968bc5c50b7c733a36131 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 6 Nov 2023 06:03:23 -0800 Subject: [PATCH] show tooltip even when mouse is outside of map --- gui/design.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gui/design.lua b/gui/design.lua index 7c27aaf1fd..0005263944 100644 --- a/gui/design.lua +++ b/gui/design.lua @@ -1795,14 +1795,18 @@ DimensionsOverlay.ATTRS{ local selection_rect = df.global.selection_rect local function is_choosing_area() - return selection_rect.start_x >= 0 and dfhack.gui.getMousePos() + return selection_rect.start_z >= 0 and dfhack.gui.getMousePos(true) end local function get_cur_area_dims() - local pos1 = dfhack.gui.getMousePos() - if not pos1 or selection_rect.start_x < 0 then return 1, 1, 1 end + local pos1 = dfhack.gui.getMousePos(true) + if not pos1 or selection_rect.start_z < 0 then return 1, 1, 1 end -- clamp to map edges (since you can start selection out of bounds) + pos1 = xyz2pos( + math.max(0, math.min(df.global.world.map.x_count-1, pos1.x)), + math.max(0, math.min(df.global.world.map.y_count-1, pos1.y)), + math.max(0, math.min(df.global.world.map.z_count-1, pos1.z))) local pos2 = xyz2pos( math.max(0, math.min(df.global.world.map.x_count-1, selection_rect.start_x)), math.max(0, math.min(df.global.world.map.y_count-1, selection_rect.start_y)),