mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user