Skip to content

Commit 156cf8f

Browse files
balatvasilisp
authored andcommitted
Carousel: make it possible to use it inside another swipeable element (#152)
1 parent a9c7313 commit 156cf8f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/widgets/ot_carousel.eliom

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,10 @@ let%shared make
387387
then Stopped (* swiping in wrong direction (vertical/horizontal) *)
388388
else
389389
if abs move > Ot_swipe.threshold
390-
then begin
390+
then begin (* We decide to take the event *)
391+
(* We send a touchcancel to the parent
392+
(which received the start) *)
393+
Ot_swipe.dispatch_event ~ev d2' "touchcancel" (clX ev) (clY ev);
391394
Manip.Class.add ~%d2 ot_swiping;
392395
set_top_margin ();
393396
remove_transition d2';

src/widgets/ot_swipe.eliomi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@ val bind:
3131
val clX : Dom_html.touchEvent Js.t -> int
3232
val clY : Dom_html.touchEvent Js.t -> int
3333
val threshold : int
34+
val dispatch_event :
35+
ev:Dom_html.touchEvent Js.t ->
36+
Dom_html.element Js.t ->
37+
string -> int -> int -> unit

0 commit comments

Comments
 (0)