Misc: Use the ^ operator instead of math.pow (#9550)

And some minor code simplifications, thanks to @zwim ;).
This commit is contained in:
NiLuJe
2022-09-28 01:11:34 +02:00
committed by GitHub
parent 62059f8d68
commit 4d48b6e2fe
4 changed files with 15 additions and 17 deletions

View File

@@ -384,7 +384,7 @@ function ReaderScrolling:_setupAction()
end
-- Decrease velocity at each step
self._velocity = self._velocity * math.pow(self.scroll_friction, self._inertial_scroll_interval)
self._velocity = self._velocity * self.scroll_friction^self._inertial_scroll_interval
local dist = math.floor(self._velocity * self._inertial_scroll_interval)
if math.abs(dist) < self.end_scroll_dist then
-- Decrease it even more so scrolling stops sooner