mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Update koptoptions.lua (#13350)
This commit is contained in:
@@ -644,25 +644,28 @@ You might need to set it to 1 column if, in a full width document, text is incor
|
||||
}
|
||||
|
||||
if BD.mirroredUILayout() then
|
||||
-- The justification items {AUTO, LEFT, CENTER, RIGHT, JUSTIFY} will
|
||||
-- be mirrored - but that's not enough: we need to swap LEFT and RIGHT,
|
||||
-- so they appear in a more expected and balanced order to RTL users:
|
||||
-- {JUSTIFY, LEFT, CENTER, RIGHT, AUTO}
|
||||
local j = KoptOptions[4].options[5]
|
||||
assert(j.name == "justification")
|
||||
j.item_icons[2], j.item_icons[4] = j.item_icons[4], j.item_icons[2]
|
||||
j.values[2], j.values[4] = j.values[4], j.values[2]
|
||||
j.labels[2], j.labels[4] = j.labels[4], j.labels[2]
|
||||
-- The zoom direction items will be mirrored, but we want them to
|
||||
-- stay as is, as the RTL directions are at the end of the arrays.
|
||||
-- By reverting the mirroring, RTL directions will be on the right,
|
||||
-- so, at the start of the options for a RTL reader.
|
||||
j = KoptOptions[3].options[7]
|
||||
assert(j.name == "zoom_direction")
|
||||
util.arrayReverse(j.item_icons)
|
||||
util.arrayReverse(j.values)
|
||||
util.arrayReverse(j.args)
|
||||
j.default_value = 0
|
||||
for _, tab in ipairs(KoptOptions) do
|
||||
for _, option in ipairs(tab.options) do
|
||||
if option.name == "zoom_direction" then
|
||||
-- The zoom direction items will be mirrored, but we want them to
|
||||
-- stay as is, as the RTL directions are at the end of the arrays.
|
||||
-- By reverting the mirroring, RTL directions will be on the right,
|
||||
-- so, at the start of the options for a RTL reader.
|
||||
util.arrayReverse(option.item_icons)
|
||||
util.arrayReverse(option.values)
|
||||
util.arrayReverse(option.args)
|
||||
option.default_value = 0
|
||||
elseif option.name == "justification" then
|
||||
-- The justification items {AUTO, LEFT, CENTER, RIGHT, JUSTIFY} will
|
||||
-- be mirrored - but that's not enough: we need to swap LEFT and RIGHT,
|
||||
-- so they appear in a more expected and balanced order to RTL users:
|
||||
-- {JUSTIFY, LEFT, CENTER, RIGHT, AUTO}
|
||||
option.item_icons[2], option.item_icons[4] = option.item_icons[4], option.item_icons[2]
|
||||
option.values[2], option.values[4] = option.values[4], option.values[2]
|
||||
option.labels[2], option.labels[4] = option.labels[4], option.labels[2]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return KoptOptions
|
||||
|
||||
Reference in New Issue
Block a user