mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
[RTL UI] update widgets and apps for UI mirroring
Small tweaks all around to handle UI mirroring: - swap existing symbols like arrows, or use alternative ones - rotate some images, like chevrons and dogear icons - flip some left and right swipe handling - flip some geometry arithmetic like tap on left or right side of page or dict window - use new ProgressWidget:getPercentageFromPosition() instead of geometry arithmetic - BD.wrap() some concatenated string bits, like in reader and menu footers - flip inverse_reading_order when UI is mirrored More specific tweaks: - ReaderGesture: reset some specific gestures when UI direction has changed (tap on top/bottom left/right corners, for bookmarks and FileManager "Plus menu"). - ReaderRolling: show markers on the correct side of page, in single or dual page mode. - KoptOptions: swap left and right icons in Alignment toggle - CheckMark: proper rendering in all 4 mirroring/rtl combinations. - VirtualKeyboard: forbid any mirroring - Move util.getMenuText into Menu.lua
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
Text widget with vertical scroll bar.
|
||||
--]]
|
||||
|
||||
local BD = require("ui/bidi")
|
||||
local Blitbuffer = require("ffi/blitbuffer")
|
||||
local Device = require("device")
|
||||
local Geom = require("ui/geometry")
|
||||
@@ -161,6 +162,9 @@ function ScrollTextWidget:moveCursorToCharPos(charpos)
|
||||
end
|
||||
|
||||
function ScrollTextWidget:moveCursorToXY(x, y, no_overflow)
|
||||
if BD.mirroredUILayout() then -- the scroll bar is on the left
|
||||
x = x - self.scroll_bar_width - self.text_scroll_span
|
||||
end
|
||||
self.text_widget:moveCursorToXY(x, y, no_overflow)
|
||||
self:updateScrollBar()
|
||||
end
|
||||
@@ -238,7 +242,7 @@ function ScrollTextWidget:onTapScrollText(arg, ges)
|
||||
return false
|
||||
end
|
||||
-- same tests as done in TextBoxWidget:scrollUp/Down
|
||||
if ges.pos.x < Screen:getWidth()/2 then
|
||||
if BD.flipIfMirroredUILayout(ges.pos.x < Screen:getWidth()/2) then
|
||||
if self.text_widget.virtual_line_num > 1 then
|
||||
self:scrollText(-1)
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user