2
0
mirror of https://github.com/koreader/koreader synced 2024-11-16 06:12:56 +00:00

chore: more luacheck fixes

This commit is contained in:
Qingping Hou 2016-09-11 21:47:24 -07:00
parent 6d578b26f5
commit c619de324e
3 changed files with 4 additions and 7 deletions

View File

@ -8,4 +8,4 @@ make all
make testfront
set +o pipefail
luajit $(which luacheck) --no-color -q frontend | tee ./luacheck.out
test $(grep Total ./luacheck.out | awk '{print $2}') -le 19
test $(grep Total ./luacheck.out | awk '{print $2}') -le 17

View File

@ -707,15 +707,13 @@ function ReaderPaging:onGotoPageRel(diff)
local new_va = self.visible_area:copy()
local x_pan_off, y_pan_off = 0, 0
if self.zoom_mode == "free" then
-- do nothing in free zoom mode
elseif self.zoom_mode:find("width") then
if self.zoom_mode:find("width") then
y_pan_off = self.visible_area.h * diff
elseif self.zoom_mode:find("height") then
-- negative x panning if writing direction is right to left
local direction = self.ui.document.configurable.writing_direction
x_pan_off = self.visible_area.w * diff * (direction == 1 and -1 or 1)
else
elseif self.zoom_mode ~= "free" then -- do nothing in "free" zoom mode
-- must be fit content or page zoom mode
if self.visible_area.w == self.page_area.w then
y_pan_off = self.visible_area.h * diff

View File

@ -160,8 +160,7 @@ function GestureDetector:getPath(slot)
local y_diff = self.last_tevs[slot].y - self.first_tevs[slot].y
local direction = nil
local distance = math.sqrt(x_diff*x_diff + y_diff*y_diff)
if x_diff == 0 and y_diff == 0 then
else
if x_diff ~= 0 or y_diff ~= 0 then
local v_direction = y_diff < 0 and "north" or "south"
local h_direction = x_diff < 0 and "west" or "east"
if math.abs(y_diff) > 0.577*math.abs(x_diff)