Update koptoptions.lua (#13350)
Some checks are pending
macos / macOS 13 x86-64 🔨15.2 🎯10.15 (push) Waiting to run
macos / macOS 14 ARM64 🔨15.4 🎯11.0 (push) Waiting to run

This commit is contained in:
hius07
2025-03-02 11:22:59 +02:00
committed by GitHub
parent daeacef838
commit 946080294d

View File

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