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.
This commit is contained in:
poire-z
2019-06-26 13:48:02 +02:00
committed by GitHub
parent 1714e74040
commit 03bbba249a

View File

@@ -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