edit field editsdune build -w ./boot_js.bc.js

This commit is contained in:
cqc
2022-12-08 12:27:36 -06:00
parent 44879eb947
commit cb263b5758
2 changed files with 188 additions and 149 deletions

View File

@ -86,9 +86,48 @@ let _ =
let webgl_ctx = webgl_initialize canvas in
let vg = graphv_initialize webgl_ctx in
let open Js_of_ocaml_lwt.Lwt_js_events in
let edit_me = Lwd.var ("edit me?", 0) in
let root =
Lwd_utils.pack Nottui.Ui.pack_x
[ Lwd.pure @@ Nottui_widgets.string "hello daddy" ]
Lwd_utils.pack Nottui.Ui.pack_y
[
(* Lwd_utils.pack Nottui.Ui.pack_x
[
Lwd.pure @@ Nottui_widgets.string "hello daddy";
Lwd.pure
@@ Nottui_widgets.string
"What is going to be displayed here?";
];
Lwd_utils.pack Nottui.Ui.pack_x
[
Lwd.pure @@ Nottui_widgets.string "hello daddy";
Lwd.pure
@@ Nottui_widgets.string
"What is going to be displayed here?";
];
Lwd_utils.pack Nottui.Ui.pack_x
[
Lwd.pure @@ Nottui_widgets.string "hello";
Lwd.pure @@ Nottui_widgets.string "hello";
Lwd.pure @@ Nottui_widgets.string "hello";
Lwd.pure @@ Nottui_widgets.string "hello";
Lwd.pure @@ Nottui_widgets.string "hello";
];
Lwd_utils.pack Nottui.Ui.pack_x
[
Lwd.pure @@ Nottui_widgets.string "it ";
Lwd.pure @@ Nottui_widgets.string "want ";
Lwd.pure @@ Nottui_widgets.string "you ";
Lwd.pure @@ Nottui_widgets.string "do ";
Lwd.pure @@ Nottui_widgets.string "when ";
];
Lwd.pure @@ Nottui_widgets.string "when when when when";
Lwd.pure @@ Nottui_widgets.string "when when when when";*)
Nottui_widgets.edit_field (Lwd.get edit_me)
~on_change:(fun ((text, pos) as state) ->
Log.debug (fun m -> m "--- on_change (%s,%d)" text pos);
Lwd.set edit_me state)
~on_submit:ignore;
]
in
let events, push_event = Lwt_stream.create () in
@ -102,7 +141,6 @@ let _ =
(fun vg ?(time = 0.) p i ->
Log.debug (fun m ->
m "Drawing image: p=%a n=%a" Gg.V2.pp p I.Draw.pp i);
let p' = I.Draw.node vg A.dark p i in
Logs.debug (fun m ->
m "Drawing finished: p'=%a" Gg.V2.pp p'))