[HtmlBoxWidget, DictQuickLookup] add capability to search within dictionary definitions (#15001)
Adds in-definition search to DictQuickLookup relaying on MuPDF's word-matching implementation, uses tap handling for navigation by allowing temporary disable/restore of Tap events.
This commit is contained in:
1 parent
9e44aa5cf4
commit
80cb27dbf5
3 files changed
+318
-55
No files matched your search
@@ -30,6 +30,7 @@ local ScrollHtmlWidget = InputContainer:extend{
|
||||
height = 0,
|
||||
scroll_bar_width = Screen:scaleBySize(6),
|
||||
text_scroll_span = Screen:scaleBySize(12),
|
||||
on_clear_search = nil,
|
||||
}
|
||||
|
||||
function ScrollHtmlWidget:init()
|
||||
@@ -41,6 +42,7 @@ function ScrollHtmlWidget:init()
|
||||
dialog = self.dialog,
|
||||
highlight_text_selection = self.highlight_text_selection,
|
||||
html_link_tapped_callback = self.html_link_tapped_callback,
|
||||
on_clear_search = self.on_clear_search,
|
||||
}
|
||||
|
||||
self.htmlbox_widget:setContent(self.html_body, self.css, self.default_font_size, self.is_xhtml, nil, self.html_resource_directory)
|
||||
@@ -187,6 +189,7 @@ function ScrollHtmlWidget:onScrollText(arg, ges)
|
||||
end
|
||||
|
||||
function ScrollHtmlWidget:onTapScrollText(arg, ges)
|
||||
if self.ignore_taps then return false end
|
||||
if BD.flipIfMirroredUILayout(ges.pos.x < Screen:getWidth()/2) then
|
||||
return self:onScrollUp()
|
||||
else
|
||||
@@ -194,6 +197,10 @@ function ScrollHtmlWidget:onTapScrollText(arg, ges)
|
||||
end
|
||||
end
|
||||
|
||||
function ScrollHtmlWidget:setTapScrollEnabled(enabled)
|
||||
self.ignore_taps = not enabled
|
||||
end
|
||||
|
||||
function ScrollHtmlWidget:onScrollUp()
|
||||
if self.htmlbox_widget.page_number > 1 then
|
||||
self:scrollText(-1)
|
||||
|
||||
Reference in new issue
Block a user