diff --git a/base b/base index 5d2ad62a0..d0bed73cd 160000 --- a/base +++ b/base @@ -1 +1 @@ -Subproject commit 5d2ad62a04701fb233b362551f0cbc44b0ee62f1 +Subproject commit d0bed73cd630aa7f304cd7447eea8abfd3500aec diff --git a/frontend/apps/reader/modules/readerlink.lua b/frontend/apps/reader/modules/readerlink.lua index 0345367b6..f8145ed00 100644 --- a/frontend/apps/reader/modules/readerlink.lua +++ b/frontend/apps/reader/modules/readerlink.lua @@ -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) diff --git a/frontend/apps/reader/modules/readerwikipedia.lua b/frontend/apps/reader/modules/readerwikipedia.lua index 214378675..87587e286 100644 --- a/frontend/apps/reader/modules/readerwikipedia.lua +++ b/frontend/apps/reader/modules/readerwikipedia.lua @@ -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 diff --git a/frontend/document/koptinterface.lua b/frontend/document/koptinterface.lua index 316d08e4d..94bc73cdb 100644 --- a/frontend/document/koptinterface.lua +++ b/frontend/document/koptinterface.lua @@ -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 diff --git a/frontend/ui/geometry.lua b/frontend/ui/geometry.lua index c7552296c..29231333c 100644 --- a/frontend/ui/geometry.lua +++ b/frontend/ui/geometry.lua @@ -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