Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 49f2834

Browse files
committed
[[ DataGrid2 ]] Allow swipe and hold
This patch allows a user to swipe and reveal the action button and then hold the touch for a period of time. If they release the touch while the button is fully exposed then it remains revealed. Previously if they did not release the touch within the swipe detection time the action button would be hidden.
1 parent 886f418 commit 49f2834

1 file changed

Lines changed: 30 additions & 3 deletions

File tree

Toolset/palettes/revdatagridlibrary/behaviorsrowchainedbehavior.livecodescript

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,35 @@ end LayoutControl
252252

253253
private command DG2_DragFinished
254254
__EnableMobileScroller
255-
255+
256+
-- first check if we are already there
257+
get word 2 of the last line of sDragLocs
258+
local tLocDiff
259+
local tSwipeControl
260+
261+
put item 1 of the mouseLoc - it into tLocDiff
262+
if tLocDiff > 0 then
263+
put DG2_CustomisableControlsGetLeftSwipeControlForControl(the long id of me) into tSwipeControl
264+
if tSwipeControl is not empty and \
265+
the left of me is the right of tSwipeControl then
266+
put false into sPreDragging
267+
put false into sDragging
268+
put empty into sDragLocs
269+
RowSwipeShowControlForIndexAndSide the dgIndex of me, "left"
270+
return the result
271+
end if
272+
else if tLocDiff < 0 then
273+
put DG2_CustomisableControlsGetRightSwipeControlForControl(the long id of me) into tSwipeControl
274+
if tSwipeControl is not empty and \
275+
the right of me is the left of tSwipeControl then
276+
put false into sPreDragging
277+
put false into sDragging
278+
put empty into sDragLocs
279+
RowSwipeShowControlForIndexAndSide the dgIndex of me, "right"
280+
return the result
281+
end if
282+
end if
283+
256284
local tNow
257285
put the milliseconds into tNow
258286

@@ -286,8 +314,7 @@ private command DG2_DragFinished
286314

287315
put tDragLoc into tPrevDragLoc
288316
end repeat
289-
290-
local tLocDiff
317+
291318
put item 1 of the mouseLoc - tMatchedLoc into tLocDiff
292319
if tMatchedLoc is not empty and abs(tLocDiff) > kSwipeLocDiff then
293320
-- The mouse has moved sufficiently to instantiate a swipe.

0 commit comments

Comments
 (0)