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

@@ -30,6 +30,7 @@ local InputText = InputContainer:new{
parent = nil, -- parent dialog that will be set dirty
edit_callback = nil, -- called with true when text modified, false on init or text re-set
scroll_callback = nil, -- called with (low, high) when view is scrolled (cf ScrollTextWidget)
scroll_by_pan = false, -- allow scrolling by lines with Pan (needs scroll=true)
width = nil,
height = nil, -- when nil, will be set to original text height (possibly
@@ -322,6 +323,7 @@ function InputText:initTextBox(text, char_added)
height = self.height,
dialog = self.parent,
scroll_callback = self.scroll_callback,
scroll_by_pan = self.scroll_by_pan,
}
else
self.text_widget = TextBoxWidget:new{