chore: more luacheck fixes

pull/2245/head
Qingping Hou 8 years ago
parent 6d578b26f5
commit c619de324e

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

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

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

Loading…
Cancel
Save