mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Allow locking the gyro to the current screen mode (#6347)
* Allow locking the gyro to the current screen mode (i.e., orientation). * Tweak the "sticky rota" option to work both ways * More rotation constant usage instead of magic numbers
This commit is contained in:
@@ -724,13 +724,19 @@ end
|
||||
|
||||
function ReaderView:onReadSettings(config)
|
||||
self.render_mode = config:readSetting("render_mode") or 0
|
||||
local locked = G_reader_settings:readSetting("lock_rotation")
|
||||
local rotation_mode = config:readSetting("rotation_mode")
|
||||
if not rotation_mode and locked then
|
||||
if self.ui.document.info.has_pages then
|
||||
rotation_mode = G_reader_settings:readSetting("kopt_rotation_mode") or 0
|
||||
else
|
||||
rotation_mode = G_reader_settings:readSetting("copt_rotation_mode") or 0
|
||||
local rotation_mode = nil
|
||||
local locked = G_reader_settings:isTrue("lock_rotation")
|
||||
-- Keep current rotation by doing nothing when sticky rota is enabled.
|
||||
if not locked then
|
||||
-- Honor docsettings's rotation
|
||||
rotation_mode = config:readSetting("rotation_mode") -- Doc's
|
||||
if not rotation_mode then
|
||||
-- No doc specific rotation, pickup global defaults for the doc type
|
||||
if self.ui.document.info.has_pages then
|
||||
rotation_mode = G_reader_settings:readSetting("kopt_rotation_mode") or Screen.ORIENTATION_PORTRAIT
|
||||
else
|
||||
rotation_mode = G_reader_settings:readSetting("copt_rotation_mode") or Screen.ORIENTATION_PORTRAIT
|
||||
end
|
||||
end
|
||||
end
|
||||
if rotation_mode then
|
||||
|
||||
Reference in New Issue
Block a user