@@ -63,12 +63,9 @@ module Make (Conf:PAGE_TRANSITION_CONF) = struct
6363 wrapper,container
6464
6565 let forward_animation_ transition_duration id =
66- Eliom_client. onload ( fun () ->
67- Lwt. async (fun () ->
68- let h =
69- Js.Optdef. get
70- Dom_html. window##.innerHeight
71- (fun () -> assert false ) in
66+ Eliom_client. onload @@ fun () ->
67+ Lwt. async @@ fun () ->
68+ let h = React.S. value Ot_size. height in
7269 let new_body = Of_dom. of_body Dom_html. document##.body in
7370 let style = Js.Unsafe. coerce Dom_html. document##.body##.style in
7471 let initial_height = style##.height in
@@ -91,7 +88,6 @@ module Make (Conf:PAGE_TRANSITION_CONF) = struct
9188 Manip.SetCss. height new_body (Js. to_string initial_height);
9289 style##.transitionDuration := initial_transition_duration;
9390 Lwt. return_unit
94- ))
9591
9692 let forward_animation ?(transition_duration =0.5 ) take_screenshot id =
9793 try
@@ -104,18 +100,14 @@ module Make (Conf:PAGE_TRANSITION_CONF) = struct
104100 transition_duration history_screenshot current_screenshot =
105101 let current_screenshot_container =
106102 Conf. screenshot_container current_screenshot in
107- let h =
108- Js.Optdef. get
109- Dom_html. window##.innerHeight
110- (fun () -> assert false ) in
103+ let h = React.S. value Ot_size. height in
111104 Manip.SetCss. heightPx current_screenshot_container h;
112105 let history_screenshot_wrapper,history_screenshot_container =
113106 wrap_screenshot history_screenshot transition_duration in
114107 Manip.Class. add
115108 history_screenshot_container " ot-page-transition-transform-2" ;
116109 let temporary_body =
117- body [current_screenshot_container;
118- history_screenshot_wrapper] in
110+ D. body [current_screenshot_container; history_screenshot_wrapper] in
119111 Manip. replaceSelf
120112 (Of_dom. of_body Dom_html. document##.body) temporary_body;
121113 let % lwt () = Lwt_js_events. request_animation_frame () in
@@ -129,14 +121,11 @@ module Make (Conf:PAGE_TRANSITION_CONF) = struct
129121 let backward_animation ?(transition_duration =0.5 ) take_screenshot id =
130122 try
131123 let scr_width,scr_height = Ot_size. get_screen_size () in
132- let history_screenshot ,w,h = pop_screenshot id in
124+ let hist_screenshot ,w,h = pop_screenshot id in
133125 if w = scr_width && h = scr_height
134126 then begin
135- let f current_screenshot =
136- Lwt. async
137- (fun () ->
138- backward_animation_
139- transition_duration history_screenshot current_screenshot)
127+ let f cur_screenshot = Lwt. async @@ fun () ->
128+ backward_animation_ transition_duration hist_screenshot cur_screenshot
140129 in
141130 take_screenshot f;
142131 Lwt_js. sleep transition_duration
0 commit comments