From c619de324e78a221bfd3d179329238f05832f12b Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Sun, 11 Sep 2016 21:47:24 -0700 Subject: [PATCH] chore: more luacheck fixes --- .ci/script.sh | 2 +- frontend/apps/reader/modules/readerpaging.lua | 6 ++---- frontend/device/gesturedetector.lua | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.ci/script.sh b/.ci/script.sh index 2c1bfc48c..d0bb499e5 100755 --- a/.ci/script.sh +++ b/.ci/script.sh @@ -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 diff --git a/frontend/apps/reader/modules/readerpaging.lua b/frontend/apps/reader/modules/readerpaging.lua index e1c6da5a7..69931be91 100644 --- a/frontend/apps/reader/modules/readerpaging.lua +++ b/frontend/apps/reader/modules/readerpaging.lua @@ -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 diff --git a/frontend/device/gesturedetector.lua b/frontend/device/gesturedetector.lua index 3b5fb0147..a99273ed5 100644 --- a/frontend/device/gesturedetector.lua +++ b/frontend/device/gesturedetector.lua @@ -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)