Skip to content

Commit

Permalink
show tooltip even when mouse is outside of map
Browse files Browse the repository at this point in the history
  • Loading branch information
myk002 committed Nov 6, 2023
1 parent 2382a33 commit b9c1db0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions gui/design.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down

0 comments on commit b9c1db0

Please sign in to comment.