Fix some issues with movable dict window (#3722)

Some Hold and move (hold on title and move away from it) would not work.
Pan (=swipe with hold at end) while selecting text would move the
window (it now does nothing: proper text selection still needs Hold
on word at start).
Also increase hold duration from 2s to 3s (for switching lookup
between dict/wikipedia) to be consistent with the 3s duration in
readerhighlight.
This commit is contained in:
poire-z
2018-03-05 21:27:55 +01:00
committed by Frans de Jonge
parent 076bf406fd
commit e7f705bf10
4 changed files with 107 additions and 22 deletions

View File

@@ -762,11 +762,25 @@ end
local FIND_START = 1
local FIND_END = 2
function TextBoxWidget:onHoldStartText(_, ges)
-- just store hold start position and timestamp, will be used on release
function TextBoxWidget:onHoldStartText(callback, ges)
-- store hold start position and timestamp, will be used on release
self.hold_start_x = ges.pos.x - self.dimen.x
self.hold_start_y = ges.pos.y - self.dimen.y
-- check coordinates are actually inside our area
if self.hold_start_x < 0 or self.hold_start_x > self.dimen.w or
self.hold_start_y < 0 or self.hold_start_y > self.dimen.h then
self.hold_start_tv = nil -- don't process coming HoldRelease event
if callback then
callback(false) -- let know we are not selecting
end
return false -- let event be processed by other widgets
end
self.hold_start_tv = TimeVal.now()
if callback then
callback(true) -- let know we are selecting
end
return true
end