File tree 5 files changed +36
-1
lines changed
5 files changed +36
-1
lines changed Original file line number Diff line number Diff line change 1
1
(executable
2
2
(modes js)
3
3
(name main)
4
- (libraries communication brr normalization browser rescale table_of_content undoable step universe drawing))
4
+ (libraries communication brr normalization browser rescale table_of_content undoable step universe drawing mouse_disappearing ))
5
5
6
6
(rule
7
7
(action
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ let start id step =
10
10
(* TODO: move out of here (Later: Why?) *)
11
11
let () = Rescale. setup_rescalers () in
12
12
let () = Drawing. setup body in
13
+ let () = Mouse_disappearing. setup () in
13
14
let initial_step =
14
15
match step with
15
16
| Some _ as step -> step
Original file line number Diff line number Diff line change
1
+ (library
2
+ (name mouse_disappearing)
3
+ (libraries brr))
Original file line number Diff line number Diff line change
1
+ (*
2
+ document.body.style.cursor = "auto";
3
+ let timeOutIds = [];
4
+ document.body.addEventListener("mousemove", (ev) => {
5
+ timeOutIds.forEach((id) => { clearTimeout(id); });
6
+ document.body.style.cursor = "auto";
7
+ timeOutIds.push(setTimeout(() => { document.body.style.cursor = "none";}, 5000));
8
+ });
9
+ *)
10
+ let body = Brr.Document. body Brr.G. document
11
+
12
+ let show_cursor () =
13
+ Brr.El. set_inline_style Brr.El.Style. cursor (Jstr. v " auto" ) body
14
+
15
+ let hide_cursor () =
16
+ Brr.El. set_inline_style Brr.El.Style. cursor (Jstr. v " none" ) body
17
+
18
+ let setup () =
19
+ show_cursor () ;
20
+ let timeout_id = ref None in
21
+ let _unlisten =
22
+ Brr.Ev. listen Brr.Ev. mousemove
23
+ (fun _ ->
24
+ (match ! timeout_id with None -> () | Some id -> Brr.G. stop_timer id);
25
+ show_cursor () ;
26
+ let id = Brr.G. set_timeout ~ms: 5000 (fun _ -> hide_cursor () ) in
27
+ timeout_id := Some id)
28
+ (Brr.El. as_target body)
29
+ in
30
+ ()
Original file line number Diff line number Diff line change
1
+ val setup : unit -> unit
You can’t perform that action at this time.
0 commit comments