Skip to content

Commit a09044a

Browse files
authored
Merge pull request #885 from myk002/myk_design_oob
[gui/design] show tooltip even when mouse is outside of map
2 parents 3683a1b + b9c1db0 commit a09044a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

gui/design.lua

+7-3
Original file line numberDiff line numberDiff line change
@@ -1795,14 +1795,18 @@ DimensionsOverlay.ATTRS{
17951795
local selection_rect = df.global.selection_rect
17961796

17971797
local function is_choosing_area()
1798-
return selection_rect.start_x >= 0 and dfhack.gui.getMousePos()
1798+
return selection_rect.start_z >= 0 and dfhack.gui.getMousePos(true)
17991799
end
18001800

18011801
local function get_cur_area_dims()
1802-
local pos1 = dfhack.gui.getMousePos()
1803-
if not pos1 or selection_rect.start_x < 0 then return 1, 1, 1 end
1802+
local pos1 = dfhack.gui.getMousePos(true)
1803+
if not pos1 or selection_rect.start_z < 0 then return 1, 1, 1 end
18041804

18051805
-- clamp to map edges (since you can start selection out of bounds)
1806+
pos1 = xyz2pos(
1807+
math.max(0, math.min(df.global.world.map.x_count-1, pos1.x)),
1808+
math.max(0, math.min(df.global.world.map.y_count-1, pos1.y)),
1809+
math.max(0, math.min(df.global.world.map.z_count-1, pos1.z)))
18061810
local pos2 = xyz2pos(
18071811
math.max(0, math.min(df.global.world.map.x_count-1, selection_rect.start_x)),
18081812
math.max(0, math.min(df.global.world.map.y_count-1, selection_rect.start_y)),

0 commit comments

Comments
 (0)