mirror of
https://github.com/koreader/koreader.git
synced 2025-12-24 12:14:05 +01:00
Paged documents: rework zoom options (#6885)
- Move zoom options from top menu to bottom config - Add option to manually define zoom (relative to page width) and overlap (in percent) - Add options to zoom to columns or rows, possibly with overlap. Add panning direction options when page forward in these modes
This commit is contained in:
@@ -339,7 +339,7 @@ function util.arrayAppend(t1, t2)
|
||||
end
|
||||
end
|
||||
|
||||
-- Reverse array elements in-place in table t
|
||||
--- Reverse array elements in-place in table t
|
||||
---- @param t Lua table
|
||||
function util.arrayReverse(t)
|
||||
local i, j = 1, #t
|
||||
@@ -350,6 +350,22 @@ function util.arrayReverse(t)
|
||||
end
|
||||
end
|
||||
|
||||
--- Test whether t contains a value equal to v
|
||||
--- (or such a value that callback returns true),
|
||||
--- and if so, return the index.
|
||||
---- @param t Lua table
|
||||
---- @param v
|
||||
---- @function callback(v1, v2)
|
||||
function util.arrayContains(t, v, cb)
|
||||
cb = cb or function(v1, v2) return v1 == v2 end
|
||||
for _k, _v in ipairs(t) do
|
||||
if cb(_v, v) then
|
||||
return _k
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- Merge t2 into t1, overwriting existing elements if they already exist
|
||||
-- Probably not safe with nested tables (c.f., https://stackoverflow.com/q/1283388)
|
||||
---- @param t1 Lua table
|
||||
|
||||
Reference in New Issue
Block a user