From 4d39dcaded84dac5e5c76983a74c4270d4ee52df Mon Sep 17 00:00:00 2001 From: rxi Date: Thu, 30 Apr 2020 14:40:26 +0100 Subject: [PATCH] Changed `View:get_content_offset()` to round resultant values Avoids some issues that occur with fractional offsets, most noticable on rectangles drawn on DocView jittering by 1-pixel when scrolling --- data/core/view.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data/core/view.lua b/data/core/view.lua index 805547c..36979cc 100644 --- a/data/core/view.lua +++ b/data/core/view.lua @@ -111,7 +111,9 @@ end function View:get_content_offset() - return self.position.x - self.scroll.x, self.position.y - self.scroll.y + local x = common.round(self.position.x - self.scroll.x) + local y = common.round(self.position.y - self.scroll.y) + return x, y end