Skip to content

Commit

Permalink
Merge pull request #148 from ocsigen/carousel
Browse files Browse the repository at this point in the history
Carousel: fix rounding error while computing number of visible elements
  • Loading branch information
vouillon authored Jul 27, 2017
2 parents 5c98c0f + 546c265 commit eabe49d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/widgets/ot_carousel.eliom
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ TODO:
- Wheel: do not take face_size as parameter but compute it
(what if generated server side?)
- number of visible elements: fix computation
(for example if we have 1 fully visible and 2 * 2/3 elements,
the current version will return 2)
and add first/last (partially)
visible elements.
*)


Expand Down Expand Up @@ -171,7 +177,8 @@ let%shared make
let width_carousel =
if vertical then d##.offsetHeight else d##.offsetWidth
in
truncate ((float width_carousel) /. (float width_element))
(* +1 below is to avoid rounding error observed on Chrome for MacOS: *)
truncate ((float (width_carousel + 1)) /. (float width_element))
in
Lwt.async (fun () ->
let%lwt () = Ot_nodeready.nodeready d2' in
Expand Down

0 comments on commit eabe49d

Please sign in to comment.