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
This commit is contained in:
rxi 2020-04-30 14:40:26 +01:00
parent 2090379892
commit 4d39dcaded
1 changed files with 3 additions and 1 deletions

View File

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