From 1794765f07f46709a790d4b545c47f323608ae9d Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: Thu, 14 Oct 2021 09:13:06 +0200 Subject: [PATCH] Fix problem with treeview keeping the editor busy Fix a problem introduced when fixing the dirty pixel problem, commit cb08c5c. The node, when determining the layout was rounding the size of the fixed-size view. In turns this latter was calling move_towards to the default_size it wanted. If default_size was non-integer the value vas never archieved because it was rounded during layout and move_towars was keeping the editor busy by setting the core.need_redraw flag. --- data/core/rootview.lua | 6 +++++- data/plugins/treeview.lua | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/data/core/rootview.lua b/data/core/rootview.lua index f5b1e534..04a091c4 100644 --- a/data/core/rootview.lua +++ b/data/core/rootview.lua @@ -412,7 +412,7 @@ end -- 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 ds = ((x1 and x1 < 1) or (x2 and x2 < 1)) and 0 or style.divider_size - local n = math.floor(x1 and x1 + ds or (x2 and self.size[x] - x2 or self.size[x] * self.divider)) + local n = x1 and x1 + ds or (x2 and self.size[x] - x2 or math.floor(self.size[x] * self.divider)) self.a.position[x] = self.position[x] self.a.position[y] = self.position[y] self.a.size[x] = n - ds @@ -675,6 +675,10 @@ end function Node:resize(axis, value) + -- the application works fine with non-integer values but to have pixel-perfect + -- placements of view elements, like the scrollbar, we round the value to be + -- an integer. + value = math.floor(value) if self.type == 'leaf' then -- If it is not locked we don't accept the -- resize operation here because for proportional panes the resize is diff --git a/data/plugins/treeview.lua b/data/plugins/treeview.lua index 5202cc78..d08db03e 100644 --- a/data/plugins/treeview.lua +++ b/data/plugins/treeview.lua @@ -238,6 +238,8 @@ function TreeView:update() if self.init_size then self.size.x = dest self.init_size = false + else + self:move_towards(self.size, "x", dest) end local duration = system.get_time() - self.tooltip.begin