diff options
| author | Francesco Abbate <francesco.bbt@gmail.com> | 2021-05-17 15:11:06 +0200 |
|---|---|---|
| committer | Francesco Abbate <francesco.bbt@gmail.com> | 2021-05-17 15:11:06 +0200 |
| commit | 1fb01f36df1adb9b2e2ae0c39de3757b65a63f57 (patch) | |
| tree | 7b8c612544b7b46f3d87b43ac8afdfa56720e1bb | |
| parent | 13529c28d4a3a16e94053de524d26b9b5ca6cc00 (diff) | |
| download | lite-xl-1fb01f36df1adb9b2e2ae0c39de3757b65a63f57.tar.gz lite-xl-1fb01f36df1adb9b2e2ae0c39de3757b65a63f57.zip | |
Avoid overflowing tab rectangles when animating
| -rw-r--r-- | data/core/rootview.lua | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/data/core/rootview.lua b/data/core/rootview.lua index 3f300b45..17bb7c77 100644 --- a/data/core/rootview.lua +++ b/data/core/rootview.lua @@ -321,9 +321,12 @@ end function Node:get_tab_rect(idx) local sbw = get_scroll_button_width() - local x = self.position.x + sbw + self.tab_width * (idx - 1) - self.tab_shift + local maxw = self.size.x - 2 * sbw + local x0 = self.position.x + sbw + local x1 = x0 + common.clamp(self.tab_width * (idx - 1) - self.tab_shift, 0, maxw) + local x2 = x0 + common.clamp(self.tab_width * idx - self.tab_shift, 0, maxw) local h = style.font:get_height() + style.padding.y * 2 - return x, self.position.y, self.tab_width, h + return x1, self.position.y, x2 - x1, h end |
