diff options
author | Sébastien Dailly <sebastien@chimrod.com> | 2020-12-28 21:17:20 +0100 |
---|---|---|
committer | Sébastien Dailly <sebastien@chimrod.com> | 2020-12-28 21:17:20 +0100 |
commit | 9d65e5e6a5bd8666baf0d7d3e0474c721cafc683 (patch) | |
tree | c391ced8768eca6e2f0c8292bab10fceeb48f2ee /elements | |
parent | ec812521b31471ce9ac3d9bdf1288b1569defbc8 (diff) |
Fixed width and angle sliddes
Diffstat (limited to 'elements')
-rwxr-xr-x | elements/input.ml | 29 | ||||
-rwxr-xr-x | elements/prop.ml | 15 |
2 files changed, 32 insertions, 12 deletions
diff --git a/elements/input.ml b/elements/input.ml index 790b15d..935f34a 100755 --- a/elements/input.ml +++ b/elements/input.ml @@ -3,18 +3,23 @@ open Brr_note open Note (** Create a slider element, and a signal with the value *) -let slider ~at = - let slider = - El.input ~at () in +let slider + : at:Brr.At.t list -> Brr.El.t * float S.t - let event = - Evr.on_el - Ev.input (fun _ -> - let raw_value = El.prop El.Prop.value slider in - Jstr.to_int raw_value) - slider - |> S.hold (Jstr.to_int (El.prop El.Prop.value slider)) - in - slider, event + = fun ~at -> + let slider = + El.input ~at () in + + let init_value = (Jstr.to_float (El.prop El.Prop.value slider)) in + + let event = + Evr.on_el + Ev.input (fun _ -> + let raw_value = El.prop El.Prop.value slider in + Jstr.to_float raw_value) + slider + |> S.hold init_value + in + slider, event diff --git a/elements/prop.ml b/elements/prop.ml new file mode 100755 index 0000000..715adec --- /dev/null +++ b/elements/prop.ml @@ -0,0 +1,15 @@ +open Brr + +include El.Prop + +let offsetWidth + : int t + = El.Prop.int (Jstr.v "offsetWidth") + +let offsetHeight + : int t + = El.Prop.int (Jstr.v "offsetHeight") + +let outerHTML + : Jstr.t t + = El.Prop.jstr (Jstr.v "outerHTML") |