Permalink
Browse files

bug + few additional calls

  • Loading branch information...
1 parent 75c421b commit 9d772fc20608815ab175b8b27f03e4bdc3536c4b Jake Donham committed Sep 24, 2010
Showing with 20 additions and 1 deletion.
  1. +4 −1 src/froc-dom/froc_dom.ml
  2. +3 −0 src/froc-dom/froc_dom.mli
  3. +10 −0 src/froc-dom/froc_dom_anim.ml
  4. +3 −0 src/froc-dom/froc_dom_anim.mli
View
@@ -85,7 +85,7 @@ let mouse_e () =
let e, s = make_event () in
let f me = send s (me#_get_clientX, me#_get_clientY) in
Dom.document#addEventListener_mouseEvent_ "mousemove" f false;
- cleanup (fun () -> Dom.document#addEventListener_mouseEvent_ "mousemove" f false);
+ cleanup (fun () -> Dom.document#removeEventListener_mouseEvent_ "mousemove" f false);
e
let mouse_b () = hold (0, 0) (mouse_e ())
@@ -99,6 +99,9 @@ let on_event_prop_e el ev pf =
let on_event_prop_b el ev pf = hold (pf el) (on_event_prop_e el ev pf)
+let window_innerSize_e () = on_event_prop_e Dom.window "resize" (fun w -> w#_get_innerWidth, w#_get_innerHeight)
+let window_innerSize_b () = on_event_prop_b Dom.window "resize" (fun w -> w#_get_innerWidth, w#_get_innerHeight)
+
let input_value_e ?(event="change") input = on_event_prop_e input event (fun i -> i#_get_value)
let input_value_b ?(event="change") input = on_event_prop_b input event (fun i -> i#_get_value)
@@ -29,6 +29,9 @@ val delay_bb : 'a Froc.behavior -> float Froc.behavior -> 'a Froc.behavior
val mouse_e : unit -> (int * int) Froc.event
val mouse_b : unit -> (int * int) Froc.behavior
+val window_innerSize_e : unit -> (int * int) Froc.event
+val window_innerSize_b : unit -> (int * int) Froc.behavior
+
val input_value_e : ?event:string -> #Dom.input -> string Froc.event
val input_value_b : ?event:string -> #Dom.input -> string Froc.behavior
@@ -27,6 +27,16 @@ let color ?a r g b =
| None -> Printf.sprintf "rgb(%d,%d,%d)" r g b
| Some a -> Printf.sprintf "rgba(%d,%d,%d,%d)" r g b a
+let fillRect (x, y) w h color : shape =
+ (fun ctx ->
+ ctx#_set_fillStyle color;
+ ctx#fillRect x y w h)
+
+let strokeRect (x, y) w h color : shape =
+ (fun ctx ->
+ ctx#_set_strokeStyle color;
+ ctx#strokeRect x y w h)
+
let disk (cx, cy) radius color : shape =
(fun ctx ->
ctx#_set_fillStyle color;
@@ -24,6 +24,9 @@ type shape = Dom.canvasRenderingContext2D -> unit
val color : ?a:int -> int -> int -> int -> color
+val fillRect : point -> float -> float -> color -> shape
+val strokeRect : point -> float -> float -> color -> shape
+
val disk : point -> float -> color -> shape
val filled_poly : point list -> color -> shape

0 comments on commit 9d772fc

Please sign in to comment.