Skip to content

Commit

Permalink
Merge pull request #1205 from myk002/myk_sandbox
Browse files Browse the repository at this point in the history
[gui/sandbox] don't let the "assume control of unit" button
  • Loading branch information
myk002 authored Jun 25, 2024
2 parents ec4a025 + 4d287d3 commit c879d44
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion gui/sandbox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,20 @@ function Sandbox:onInput(keys)
return true
end
if keys._MOUSE_L then
if self:getMouseFramePos() then return true end
-- don't click "through" the gui/sandbox ui
if self:getMouseFramePos() then
return true
end
-- don't allow clicking on the "assume control" button of a unit
local scr = dfhack.gui.getDFViewscreen(true)
if dfhack.gui.matchFocusString('dwarfmode/ViewSheets/UNIT/Overview', scr) then
local interface_rect = gui.ViewRect{rect=gui.get_interface_rect()}
local button_rect = interface_rect:viewport(interface_rect.width-77, interface_rect.height-7, 20, 3)
local mouse_x, mouse_y = dfhack.screen.getMousePos()
if mouse_x and button_rect:inClipGlobalXY(mouse_x, mouse_y) then
return true
end
end
for _,mask_panel in ipairs(self.interface_masks) do
if mask_panel:getMousePos() then return true end
end
Expand Down

0 comments on commit c879d44

Please sign in to comment.