StatusView: reposition left and right panel offsets on window resize.

This commit is contained in:
jgmdev 2022-02-28 17:04:37 -04:00
parent 15a31418ca
commit 4c80aa7a40
1 changed files with 11 additions and 0 deletions

View File

@ -725,6 +725,17 @@ function StatusView:update_active_items()
lw = self.size.x / 2 - (style.padding.x + style.padding.x / 2) lw = self.size.x / 2 - (style.padding.x + style.padding.x / 2)
rw = self.size.x / 2 - (style.padding.x + style.padding.x / 2) rw = self.size.x / 2 - (style.padding.x + style.padding.x / 2)
end end
-- reposition left and right offsets when window is resized
if rw >= self.r_right_width then
self.right_xoffset = 0
elseif rw > self.right_xoffset + self.r_right_width then
self.right_xoffset = rw - self.r_right_width
end
if lw >= self.r_left_width then
self.left_xoffset = 0
elseif lw > self.left_xoffset + self.r_left_width then
self.left_xoffset = lw - self.r_left_width
end
else else
self.left_xoffset = 0 self.left_xoffset = 0
self.right_xoffset = 0 self.right_xoffset = 0