Commit ce18f750 authored by Benoit Barbot's avatar Benoit Barbot
Browse files

progress

parent e9a4f9be
Pipeline #1752 failed with stage
in 29 seconds
......@@ -36,8 +36,7 @@ let _ =
div ~class_:"col-4" [ attribute_div ]
] in
run @@ fun () ->
let ed = TAGraphEd.init canvas attribute_list_div
create_form slider in
let ed = TAGraphEd.init ~saveload:create_form ~slider canvas attribute_list_div in
TAGraphEd.init_client ed;
graph_editor
......@@ -96,7 +96,7 @@ let tikz_init canvas_el attribute_list_el create_form_el slider_el =
let attribute_list = of_div attribute_list_el in
let create_form_dom = of_div create_form_el in
let slider_dom = of_input slider_el in
let editor_state = TikzGraph.init canvas attribute_list create_form_dom slider_dom in
let editor_state = TikzGraph.init ~saveload:create_form_dom ~slider:slider_dom canvas attribute_list in
TikzGraph.init_client editor_state
]
......
......@@ -195,11 +195,12 @@ let rec list_buff b f pos =
else pos,[]
(*let t = Buffer.create 10 in
buff_list t buff_int [54443;1;1;1;1;1;-2556;5];
let id l =
let t = Buffer.create 10 in
buff_list t buff_int l;
let s = Bytes.to_string @@ Buffer.to_bytes t in
print_endline s;
list_buff s (fun b p -> p+3,int_buff b p) 0 ;;*)
let l2 = snd @@ list_buff s int_buff 0 in
l =l2;;
let buff_attribute b = function
......
......@@ -309,7 +309,7 @@ module GraphEditor (G: GRAPH ) = struct
update_link "Direct Link" (fun n -> (n^"?q="^(get_exchange_string s.graph)))
]]
let init canvas attribute_list saveload slider =
let init ?saveload ?slider canvas attribute_list =
(*let init canvas_elt attr_list_div saveload_elt slider_elt =
let canvas = Eliom_content.Html.To_dom.of_canvas canvas_elt in
let attribute_list = Eliom_content.Html.To_dom.of_div attr_list_div in
......@@ -332,12 +332,17 @@ module GraphEditor (G: GRAPH ) = struct
then s.graph<-parse_exchange_string str
| None -> ())
with _ -> ());
slider##.value := Js.string @@ string_of_float @@ (s.zoom -. 0.2 ) *. 50. ;
slider##.oninput := Dom.handler (fun _ ->
s.zoom <- 0.2 +. (float_of_string @@ Js.to_string slider##.value) /. 50.0;
(match slider with
Some sl ->
sl##.value := Js.string @@ string_of_float @@ (s.zoom -. 0.2 ) *. 50. ;
sl##.oninput := Dom.handler (fun _ ->
s.zoom <- 0.2 +. (float_of_string @@ Js.to_string sl##.value) /. 50.0;
draw s (0.0,0.0);
Js._true);
Dom.appendChild saveload ((*Eliom_content.Html.To_dom.of_div*) (save_load_html s));
Js._true)
| None -> ());
(match saveload with
Some div -> Dom.appendChild div ((*Eliom_content.Html.To_dom.of_div*) (save_load_html s))
| None -> ());
s
let draw_choice s (x,y) =
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment