diff --git a/defaults.lua b/defaults.lua index c422b77ca..35b798f8f 100644 --- a/defaults.lua +++ b/defaults.lua @@ -80,6 +80,12 @@ DKOPTREADER_CONFIG_DOC_DEFAULT_LANG_CODE = "eng" -- that have filenames start -- feel free to add more entries in this list DCREREADER_CONFIG_FONT_SIZES = {16, 20, 22, 24, 28, 32, 38, 44} -- range from 16 to 44 +-- crereader margin sizes +-- margin {left, top, right, bottom} in pixels +DCREREADER_CONFIG_MARGIN_SIZES_SMALL = {6, 5, 2, 5} +DCREREADER_CONFIG_MARGIN_SIZES_MEDIUM = {15, 10, 10, 10} +DCREREADER_CONFIG_MARGIN_SIZES_LARGE = {25, 10, 20, 10} + -- gesture detector defaults DGESDETECT_DISABLE_DOUBLE_TAP = true diff --git a/frontend/ui/data/creoptions.lua b/frontend/ui/data/creoptions.lua index 86dda4483..a2a96d7e2 100644 --- a/frontend/ui/data/creoptions.lua +++ b/frontend/ui/data/creoptions.lua @@ -46,15 +46,15 @@ local CreOptions = { name_text = S.PAGE_MARGIN, toggle = {S.SMALL, S.MEDIUM, S.LARGE}, values = { - {6, 5, 2, 5}, - {15, 10, 10, 10}, - {25, 10, 20, 10}, + DCREREADER_CONFIG_MARGIN_SIZES_SMALL, + DCREREADER_CONFIG_MARGIN_SIZES_MEDIUM, + DCREREADER_CONFIG_MARGIN_SIZES_LARGE, }, - default_value = {15, 10, 10, 10}, + default_value = DCREREADER_CONFIG_MARGIN_SIZES_MEDIUM, args = { - {6, 5, 2, 5}, - {15, 10, 10, 10}, - {25, 10, 20, 10}, + DCREREADER_CONFIG_MARGIN_SIZES_SMALL, + DCREREADER_CONFIG_MARGIN_SIZES_MEDIUM, + DCREREADER_CONFIG_MARGIN_SIZES_LARGE, }, event = "SetPageMargins", }, diff --git a/frontend/ui/reader/readerview.lua b/frontend/ui/reader/readerview.lua index d71a396a3..1648171eb 100644 --- a/frontend/ui/reader/readerview.lua +++ b/frontend/ui/reader/readerview.lua @@ -573,10 +573,10 @@ function ReaderView:onSetViewMode(new_mode) end function ReaderView:onSetPageMargins(margins) - local left = margins[1] - local top = margins[2] - local right = margins[3] - local bottom = margins[4] + local left = Screen:scaleByDPI(margins[1]) + local top = Screen:scaleByDPI(margins[2]) + local right = Screen:scaleByDPI(margins[3]) + local bottom = Screen:scaleByDPI(margins[4]) self.ui.document:setPageMargins(left, top, right, bottom) self.ui:handleEvent(Event:new("UpdatePos")) return true