mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
chore: fix some of the luacheck errors
This commit is contained in:
@@ -5,7 +5,6 @@ local UIManager = require("ui/uimanager")
|
||||
local Device = require("device")
|
||||
local GestureRange = require("ui/gesturerange")
|
||||
local Math = require("optmath")
|
||||
local DEBUG = require("dbg")
|
||||
|
||||
--[[
|
||||
BBoxWidget shows a bbox for page cropping
|
||||
@@ -20,7 +19,6 @@ local BBoxWidget = InputContainer:new{
|
||||
|
||||
function BBoxWidget:init()
|
||||
self.page_bbox = self.document:getPageBBox(self.view.state.page)
|
||||
--DEBUG("used page bbox on page", self.view.state.page, self.page_bbox)
|
||||
if Device:isTouchDevice() then
|
||||
self.ges_events = {
|
||||
TapAdjust = {
|
||||
@@ -77,7 +75,6 @@ function BBoxWidget:getScreenBBox(page_bbox)
|
||||
local bbox = {}
|
||||
local scale = self.view.state.zoom
|
||||
local screen_offset = self.view.state.offset
|
||||
--DEBUG("screen offset in page_to_screen", screen_offset)
|
||||
bbox.x0 = Math.round(page_bbox.x0 * scale + screen_offset.x)
|
||||
bbox.y0 = Math.round(page_bbox.y0 * scale + screen_offset.y)
|
||||
bbox.x1 = Math.round(page_bbox.x1 * scale + screen_offset.x)
|
||||
@@ -90,7 +87,6 @@ function BBoxWidget:getPageBBox(screen_bbox)
|
||||
local bbox = {}
|
||||
local scale = self.view.state.zoom
|
||||
local screen_offset = self.view.state.offset
|
||||
--DEBUG("screen offset in screen_to_page", screen_offset)
|
||||
bbox.x0 = Math.round((screen_bbox.x0 - screen_offset.x) / scale)
|
||||
bbox.y0 = Math.round((screen_bbox.y0 - screen_offset.y) / scale)
|
||||
bbox.x1 = Math.round((screen_bbox.x1 - screen_offset.x) / scale)
|
||||
@@ -106,7 +102,6 @@ function BBoxWidget:inPageArea(ges)
|
||||
end
|
||||
|
||||
function BBoxWidget:adjustScreenBBox(ges, relative)
|
||||
--DEBUG("adjusting crop bbox with pos", ges.pos)
|
||||
if not self:inPageArea(ges) then return end
|
||||
local bbox = self.screen_bbox
|
||||
local upper_left = Geom:new{ x = bbox.x0, y = bbox.y0}
|
||||
@@ -125,7 +120,6 @@ function BBoxWidget:adjustScreenBBox(ges, relative)
|
||||
local _, nearest = Math.tmin(anchors, function(a,b)
|
||||
return a:distance(ges.pos) > b:distance(ges.pos)
|
||||
end)
|
||||
--DEBUG("nearest anchor", nearest)
|
||||
if nearest == upper_left then
|
||||
upper_left.x = ges.pos.x
|
||||
upper_left.y = ges.pos.y
|
||||
|
||||
Reference in New Issue
Block a user