mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
allow emulator to specify a viewport
This allows for Viewport debugging. It is configured via an environment
variable, EMULATE_READER_VIEWPORT. It works with Lua table syntax, e.g.:
EMULATE_READER_VIEWPORT="{x=10,w=550,y=5,h=790}"
This commit is contained in:
@@ -13,6 +13,13 @@ local Device = Generic:new{
|
||||
}
|
||||
|
||||
function Device:init()
|
||||
-- allows to set a viewport via environment variable
|
||||
-- syntax is Lua table syntax, e.g. EMULATE_READER_VIEWPORT="{x=10,w=550,y=5,h=790}"
|
||||
local viewport = os.getenv("EMULATE_READER_VIEWPORT")
|
||||
if viewport then
|
||||
self.viewport = require("ui/geometry"):new(loadstring("return " .. viewport)())
|
||||
end
|
||||
|
||||
if util.haveSDL2() then
|
||||
self.screen = require("ffi/framebuffer_SDL2_0"):new{device = self}
|
||||
self.input = require("device/input"):new{
|
||||
|
||||
Reference in New Issue
Block a user