add image-overlay
This commit is contained in:
parent
cd4fc18585
commit
26b17f57cd
10 changed files with 132 additions and 77 deletions
|
|
@ -310,6 +310,23 @@ module Error_popup = struct
|
|||
el
|
||||
end
|
||||
|
||||
module Image_overlay = struct
|
||||
let mk opt =
|
||||
match opt with
|
||||
| None -> []
|
||||
| Some img ->
|
||||
let el = mk_image ~is_small:false img in
|
||||
[ el ]
|
||||
|
||||
let f t_s =
|
||||
let el = El.div ~at:[ class' "image-overlay" ] [] in
|
||||
def_visibility `On (S.map (fun t -> Option.is_some t.opened_image) t_s) el;
|
||||
Elr.def_children el (S.map (fun t -> mk t.opened_image) t_s);
|
||||
(* on overlay click (that should cover whole screen) send action to close overlay *)
|
||||
hold_on el Ev.click (fun _ev -> Events.send_action (Image_change None));
|
||||
el
|
||||
end
|
||||
|
||||
module Main = struct
|
||||
let f t_s =
|
||||
let l =
|
||||
|
|
@ -326,6 +343,7 @@ module Main = struct
|
|||
; Delete.f
|
||||
; Report.f
|
||||
; Error_popup.f
|
||||
; Image_overlay.f
|
||||
]
|
||||
in
|
||||
let main = El.v (str "main") l in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue