consider also the screen size when scaling by DPI

pull/1216/head
chrox 10 years ago
parent e66801039b
commit 8384eba810

@ -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()

Loading…
Cancel
Save