From f2d38336c17832137962356313a1cefe674ca400 Mon Sep 17 00:00:00 2001 From: chrox Date: Sun, 4 Oct 2015 00:16:31 +0800 Subject: [PATCH 1/5] fix #1642 GFW block in China may also cause Network unavailable error --- frontend/apps/reader/modules/readerwikipedia.lua | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) 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 From 96dc3388126879dc95ef7244da86a7c0c79abe57 Mon Sep 17 00:00:00 2001 From: chrox Date: Sun, 4 Oct 2015 00:20:41 +0800 Subject: [PATCH 2/5] fix #1570 to disable swipe to go back by default --- frontend/apps/reader/modules/readerlink.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) From f73f8916c0da0c30bf372c11fe90d67875e95c60 Mon Sep 17 00:00:00 2001 From: chrox Date: Sun, 4 Oct 2015 00:36:16 +0800 Subject: [PATCH 3/5] fix #1569 use fit to page zoom cover image even in reflow mode --- frontend/document/koptinterface.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 From 1f094657dcc49f7a858e4784c8c88e134d0154ad Mon Sep 17 00:00:00 2001 From: chrox Date: Sun, 4 Oct 2015 01:06:24 +0800 Subject: [PATCH 4/5] fix #1529 by rounding off the scaled dimension --- frontend/ui/geometry.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) 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 From ba50308fbbf5e047f6ab4fcbff31f18f87601170 Mon Sep 17 00:00:00 2001 From: chrox Date: Sun, 4 Oct 2015 08:16:58 +0800 Subject: [PATCH 5/5] fix #1345 and fix #1589 by scale font size by dpi if users custom screen dpi in the "Screen" menu it will stay with the same font size when the screen dpi is set to 'auto'. --- base | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base b/base index 5d2ad62a0..d0bed73cd 160000 --- a/base +++ b/base @@ -1 +1 @@ -Subproject commit 5d2ad62a04701fb233b362551f0cbc44b0ee62f1 +Subproject commit d0bed73cd630aa7f304cd7447eea8abfd3500aec