Use rounded value for node's size when splitting

Rouding node's size to an integer value ensure drawing are pixel
perfect in sizing.
This commit is contained in:
Francesco Abbate 2021-10-10 21:48:16 +02:00
parent c7aa3ebe01
commit 8b634daa66
1 changed files with 1 additions and 8 deletions

View File

@ -411,15 +411,8 @@ end
-- calculating the sizes is the same for hsplits and vsplits, except the x/y -- calculating the sizes is the same for hsplits and vsplits, except the x/y
-- axis are swapped; this function lets us use the same code for both -- axis are swapped; this function lets us use the same code for both
local function calc_split_sizes(self, x, y, x1, x2, y1, y2) local function calc_split_sizes(self, x, y, x1, x2, y1, y2)
local n
local ds = ((x1 and x1 < 1) or (x2 and x2 < 1)) and 0 or style.divider_size local ds = ((x1 and x1 < 1) or (x2 and x2 < 1)) and 0 or style.divider_size
if x1 then local n = math.floor(x1 and x1 + ds or (x2 and self.size[x] - x2 or self.size[x] * self.divider))
n = x1 + ds
elseif x2 then
n = self.size[x] - x2
else
n = math.floor(self.size[x] * self.divider)
end
self.a.position[x] = self.position[x] self.a.position[x] = self.position[x]
self.a.position[y] = self.position[y] self.a.position[y] = self.position[y]
self.a.size[x] = n - ds self.a.size[x] = n - ds