From 03bbba249aa1e230f4318dbe0641f7126ba0908e Mon Sep 17 00:00:00 2001 From: poire-z Date: Wed, 26 Jun 2019 13:48:02 +0200 Subject: [PATCH] MovableContainer: avoid refresh glitches on close (#5094) The contained widget may not have integer position/dimen (which should probably be fixed in those that don't ensure that), and our maths could eventually make them even more shifted by fractional parts. In the end, when closing the widget, the refresh code may miss painting/cleaning 1px and leave a border of the widget on the screen. --- frontend/ui/widget/container/movablecontainer.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/ui/widget/container/movablecontainer.lua b/frontend/ui/widget/container/movablecontainer.lua index d0c73966b..55426bce7 100644 --- a/frontend/ui/widget/container/movablecontainer.lua +++ b/frontend/ui/widget/container/movablecontainer.lua @@ -147,6 +147,9 @@ function MovableContainer:_moveBy(dx, dy, restrict_to_screen) self._moved_offset_y = screen_h - self._orig_y - self.dimen.h end end + -- Ensure the offsets are integers, to avoid refresh area glitches + self._moved_offset_x = Math.round(self._moved_offset_x) + self._moved_offset_y = Math.round(self._moved_offset_y) -- if not restrict_to_screen, we don't need to check anything: -- we trust gestures' position and distances: if we started with our -- finger on widget, and moved our finger to screen border, a part