@@ -104,9 +104,9 @@ let outside_color = Js.string (*"#0c1a0d"*) "#070718"
104104let option var = Js.Optdef. get var (fun () -> Js.Unsafe. coerce (new % js Js. array_empty))
105105
106106class type style = object
107- method border : float Js. optdef Js. readonly_prop
107+ method border : Js. number Js. t Js. optdef Js. readonly_prop
108108
109- method padding : float Js. optdef Js. readonly_prop
109+ method padding : Js. number Js. t Js. optdef Js. readonly_prop
110110
111111 method backgroundColor : Js. js_string Js. t Js. optdef Js. readonly_prop
112112
@@ -553,7 +553,10 @@ let local_messages msgs : messages Js.t = option (Js.Unsafe.get msgs !language)
553553(* *****)
554554
555555let screen_transform canvas =
556- let offset = opt_style style##.border 0.5 +. opt_style style##.padding 0. in
556+ let offset =
557+ Js. to_float (opt_style style##.border (Js. float 0.5 ))
558+ +. Js. to_float (opt_style style##.padding (Js. float 0. ))
559+ in
557560 let w = canvas##.width in
558561 let h = canvas##.height in
559562 (*
@@ -587,13 +590,13 @@ let arc c (rx, ry, dx, dy) z0 z1 z2 =
587590 c##beginPath ;
588591 let alpha = mod_float (fin -. start +. (2. *. pi)) (2. *. pi) in
589592 c##ellipse
590- (( z0.x *. rx) +. dx)
591- (( z0.y *. ry) +. dy)
592- (rd *. rx)
593- (rd *. ry)
594- 0.
595- start
596- fin
593+ (Js. float (( z0.x *. rx) +. dx) )
594+ (Js. float (( z0.y *. ry) +. dy) )
595+ (Js. float ( rd *. rx) )
596+ (Js. float ( rd *. ry) )
597+ ( Js. float 0. )
598+ ( Js. float start)
599+ ( Js. float fin)
597600 (Js. bool (alpha > pi));
598601 c##stroke
599602
@@ -640,9 +643,17 @@ let draw canvas vertices edges nodes boxes =
640643 (Js. float 0. )
641644 (Js. float (float canvas##.width))
642645 (Js. float (float canvas##.height));
643- let padding = opt_style style##.padding 0. in
646+ let padding = Js. to_float ( opt_style style##.padding ( Js. float 0. )) in
644647 c##beginPath ;
645- c##ellipse dx dy (rx +. padding) (ry +. padding) 0. 0. 7. Js. _false;
648+ c##ellipse
649+ (Js. float dx)
650+ (Js. float dy)
651+ (Js. float (rx +. padding))
652+ (Js. float (ry +. padding))
653+ (Js. float 0. )
654+ (Js. float 0. )
655+ (Js. float 7. )
656+ Js. _false;
646657 Js.Optdef. iter style##.backgroundColor (fun color ->
647658 c##.fillStyle := color;
648659 c##fill );
@@ -1107,12 +1118,12 @@ let close_button over =
11071118 c##.shadowBlur := Js. float offset;
11081119 c##.shadowColor := color);
11091120 c##beginPath ;
1110- let a = Js. float ( offset +. (lw /. sqrt 2. ) ) in
1111- let b = Js. float ( float size -. offset -. (lw /. sqrt 2. ) ) in
1112- c##moveTo a a ;
1113- c##lineTo b b ;
1114- c##moveTo a b ;
1115- c##lineTo b a ;
1121+ let a = offset +. (lw /. sqrt 2. ) in
1122+ let b = float size -. offset -. (lw /. sqrt 2. ) in
1123+ c##moveTo ( Js. float a) ( Js. float a) ;
1124+ c##lineTo ( Js. float b) ( Js. float b) ;
1125+ c##moveTo ( Js. float a) ( Js. float b) ;
1126+ c##lineTo ( Js. float b) ( Js. float a) ;
11161127 c##stroke ;
11171128 c##restore ;
11181129 canvas##.className := Js. string (if over then " on" else " off" );
0 commit comments