mirror of
https://github.com/koreader/koreader
synced 2024-11-02 15:40:16 +00:00
Merge pull request #1662 from chrox/fixes_for_stable_release
Fixes for stable release
This commit is contained in:
commit
ada7de404e
2
base
2
base
@ -1 +1 @@
|
||||
Subproject commit 5d2ad62a04701fb233b362551f0cbc44b0ee62f1
|
||||
Subproject commit d0bed73cd630aa7f304cd7447eea8abfd3500aec
|
@ -59,7 +59,7 @@ local function is_follow_links_on()
|
||||
end
|
||||
|
||||
local function swipe_to_go_back()
|
||||
return G_reader_settings:readSetting("swipe_to_go_back") ~= false
|
||||
return G_reader_settings:readSetting("swipe_to_go_back") == true
|
||||
end
|
||||
|
||||
function ReaderLink:addToMainMenu(tab_item_table)
|
||||
|
@ -24,11 +24,7 @@ end
|
||||
function ReaderWikipedia:onLookupWikipedia(word, box)
|
||||
-- detect language of the text
|
||||
local ok, lang = pcall(Translator.detect, Translator, word)
|
||||
-- prompt users to turn on Wifi if network is unreachable
|
||||
if not ok and lang and lang:find("Network is unreachable") then
|
||||
NetworkMgr:promptWifiOn()
|
||||
return
|
||||
end
|
||||
if not ok then return end
|
||||
-- convert "zh-CN" and "zh-TW" to "zh"
|
||||
lang = lang:match("(.*)-") or lang
|
||||
-- strip punctuation characters around selected word
|
||||
|
@ -256,7 +256,10 @@ end
|
||||
get first page image
|
||||
--]]
|
||||
function KoptInterface:getCoverPageImage(doc)
|
||||
local tile = self:renderPage(doc, 1, nil, 1, 0, 1, 0)
|
||||
local native_size = Document.getNativePageDimensions(doc, 1)
|
||||
local screen_size = Screen:getSize()
|
||||
local zoom = math.min(screen_size.w / native_size.w, screen_size.h / native_size.h)
|
||||
local tile = Document.renderPage(doc, 1, nil, zoom, 0, 1, 0)
|
||||
if tile then
|
||||
return tile.bb
|
||||
end
|
||||
|
@ -1,3 +1,4 @@
|
||||
local Math = require("optmath")
|
||||
local DEBUG = require("dbg")
|
||||
|
||||
--[[
|
||||
@ -62,8 +63,8 @@ scale rectangle (grow to bottom and to the right) or dimension
|
||||
if a single factor is given, it is applied to both width and height
|
||||
]]--
|
||||
function Geom:scaleBy(zx, zy)
|
||||
self.w = self.w * zx
|
||||
self.h = self.h * (zy or zx)
|
||||
self.w = Math.round(self.w * zx)
|
||||
self.h = Math.round(self.h * (zy or zx))
|
||||
return self
|
||||
end
|
||||
|
||||
@ -71,8 +72,8 @@ end
|
||||
this method also takes care of x and y
|
||||
]]--
|
||||
function Geom:transformByScale(zx, zy)
|
||||
self.x = self.x * zx
|
||||
self.y = self.y * (zx or zy)
|
||||
self.x = Math.round(self.x * zx)
|
||||
self.y = Math.round(self.y * (zx or zy))
|
||||
self:scaleBy(zx, zy)
|
||||
end
|
||||
|
||||
@ -327,8 +328,8 @@ return the midpoint of two geoms
|
||||
]]--
|
||||
function Geom:midpoint(geom)
|
||||
return Geom:new{
|
||||
x = (self.x + geom.x) / 2,
|
||||
y = (self.y + geom.y) / 2,
|
||||
x = Math.round((self.x + geom.x) / 2),
|
||||
y = Math.round((self.y + geom.y) / 2),
|
||||
w = 0, h = 0,
|
||||
}
|
||||
end
|
||||
@ -338,8 +339,8 @@ return center point in this geom
|
||||
]]--
|
||||
function Geom:center()
|
||||
return Geom:new{
|
||||
x = self.x + self.w / 2,
|
||||
y = self.y + self.h / 2,
|
||||
x = self.x + Math.round(self.w / 2),
|
||||
y = self.y + Math.round(self.h / 2),
|
||||
w = 0, h = 0,
|
||||
}
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user