keep windows on the screen when the DF window is resized

develop
Myk Taylor 2023-01-15 20:41:48 -08:00
parent 86ddf43230
commit fb5675ef1b
No known key found for this signature in database
1 changed files with 14 additions and 0 deletions

@ -456,6 +456,20 @@ end
function Panel:computeFrame(parent_rect) function Panel:computeFrame(parent_rect)
local sw, sh = parent_rect.width, parent_rect.height local sw, sh = parent_rect.width, parent_rect.height
if self.frame then
if self.frame.t and self.frame.h and self.frame.t + self.frame.h > sh then
self.frame.t = math.max(0, sh - self.frame.h)
end
if self.frame.b and self.frame.h and self.frame.b + self.frame.h > sh then
self.frame.b = math.max(0, sh - self.frame.h)
end
if self.frame.l and self.frame.w and self.frame.l + self.frame.w > sw then
self.frame.l = math.max(0, sw - self.frame.w)
end
if self.frame.r and self.frame.w and self.frame.r + self.frame.w > sw then
self.frame.r = math.max(0, sw - self.frame.w)
end
end
return gui.compute_frame_body(sw, sh, self.frame, self.frame_inset, return gui.compute_frame_body(sw, sh, self.frame, self.frame_inset,
self.frame_style and 1 or 0) self.frame_style and 1 or 0)
end end