QtWebEngine: Round scroll percentages

This commit is contained in:
Florian Bruhin 2016-09-11 19:58:47 +02:00
parent fff777404b
commit 8eeb3b9c75

View File

@ -233,9 +233,9 @@ class WebEngineScroller(browsertab.AbstractScroller):
self._pos_px = QPoint(jsret['px']['x'], jsret['px']['y'])
dx = jsret['scroll']['width'] - jsret['inner']['width']
perc_x = 0 if dx == 0 else 100 / dx * jsret['px']['x']
perc_x = 0 if dx == 0 else round(100 / dx * jsret['px']['x'])
dy = jsret['scroll']['height'] - jsret['inner']['height']
perc_y = 0 if dy == 0 else 100 / dy * jsret['px']['y']
perc_y = 0 if dy == 0 else round(100 / dy * jsret['px']['y'])
self._at_bottom = dy == jsret['px']['y']
self._pos_perc = perc_x, perc_y