Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gui/design] show tooltip even when mouse is outside of map #885

Merged
merged 1 commit into from
Nov 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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