TextEditor: allow scrolling by lines with Pan (#4145)

Feature of ScrollTextWidget, only used for now by TextEditor.
Pan is like Swipe, but wait a bit at end of gesture to release:
the line on which Pan was started will be moved to where Pan is
released.

May conflict with MovableContainer (so not enabled for DictQuickLookup,
where it could have been nice - but it would work only with text
dictionaries, not with HTML ones, as ScrollHtmlWidget can't really
do that).
This commit is contained in:
poire-z
2018-08-10 18:05:09 +02:00
committed by GitHub
parent d222fe25b6
commit adceda15b7
5 changed files with 71 additions and 0 deletions

View File

@@ -128,6 +128,8 @@ local InputDialog = InputContainer:new{
-- note that the text widget can be scrolled with Swipe North/South even when no button
keyboard_hidden = false, -- start with keyboard hidden in full fullscreen mode
-- needs add_nav_bar to have a Show keyboard button to get it back
scroll_by_pan = false, -- allow scrolling by lines with Pan (= Swipe, but wait a bit at end
-- of gesture before releasing) (may conflict with movable)
-- If save_callback provided, a Save and a Close buttons will be added to the first row
-- if reset_callback provided, a Reset button will be added (before Save) to the first row
@@ -359,6 +361,7 @@ function InputDialog:init()
edit_callback = self._buttons_edit_callback, -- nil if no Save/Close buttons
scroll_callback = self._buttons_scroll_callback, -- nil if no Nav or Scroll buttons
scroll = true,
scroll_by_pan = self.scroll_by_pan,
cursor_at_end = self.cursor_at_end,
readonly = self.readonly,
parent = self,