mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
consider also the screen size when scaling by DPI
This commit is contained in:
@@ -52,7 +52,7 @@ local KoboPhoenix = Kobo:new{
|
||||
model = "Kobo_phoenix",
|
||||
hasFrontlight = yes,
|
||||
touch_phoenix_protocol = true,
|
||||
display_dpi = 212.8,
|
||||
display_dpi = 212,
|
||||
-- the bezel covers 12 pixels at the bottom:
|
||||
viewport = Geom:new{x=0, y=0, w=758, h=1012},
|
||||
}
|
||||
|
||||
@@ -169,8 +169,11 @@ function Screen:setDPI(dpi)
|
||||
end
|
||||
|
||||
function Screen:scaleByDPI(px)
|
||||
local dpi = self:getDPI()
|
||||
-- larger screen needs larger scale
|
||||
local size_scale = math.min(self:getWidth(), self:getHeight())/dpi/3.6
|
||||
-- scaled positive px should also be positive
|
||||
return math.ceil(px * self:getDPI()/167)
|
||||
return math.ceil(px * size_scale * dpi/167)
|
||||
end
|
||||
|
||||
function Screen:getRotationMode()
|
||||
|
||||
Reference in New Issue
Block a user