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 _ = ...@@ -36,8 +36,7 @@ let _ =
div ~class_:"col-4" [ attribute_div ] div ~class_:"col-4" [ attribute_div ]
] in ] in
run @@ fun () -> run @@ fun () ->
let ed = TAGraphEd.init canvas attribute_list_div let ed = TAGraphEd.init ~saveload:create_form ~slider canvas attribute_list_div in
create_form slider in
TAGraphEd.init_client ed; TAGraphEd.init_client ed;
graph_editor graph_editor
...@@ -96,7 +96,7 @@ let tikz_init canvas_el attribute_list_el create_form_el slider_el = ...@@ -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 attribute_list = of_div attribute_list_el in
let create_form_dom = of_div create_form_el in let create_form_dom = of_div create_form_el in
let slider_dom = of_input slider_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 TikzGraph.init_client editor_state
] ]
......
...@@ -195,11 +195,12 @@ let rec list_buff b f pos = ...@@ -195,11 +195,12 @@ let rec list_buff b f pos =
else pos,[] else pos,[]
(*let t = Buffer.create 10 in let id l =
buff_list t buff_int [54443;1;1;1;1;1;-2556;5]; let t = Buffer.create 10 in
let s = Bytes.to_string @@ Buffer.to_bytes t in buff_list t buff_int l;
print_endline s; let s = Bytes.to_string @@ Buffer.to_bytes t in
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 let buff_attribute b = function
......
...@@ -309,7 +309,7 @@ module GraphEditor (G: GRAPH ) = struct ...@@ -309,7 +309,7 @@ module GraphEditor (G: GRAPH ) = struct
update_link "Direct Link" (fun n -> (n^"?q="^(get_exchange_string s.graph))) 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 init canvas_elt attr_list_div saveload_elt slider_elt =
let canvas = Eliom_content.Html.To_dom.of_canvas canvas_elt in 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 let attribute_list = Eliom_content.Html.To_dom.of_div attr_list_div in
...@@ -332,12 +332,17 @@ module GraphEditor (G: GRAPH ) = struct ...@@ -332,12 +332,17 @@ module GraphEditor (G: GRAPH ) = struct
then s.graph<-parse_exchange_string str then s.graph<-parse_exchange_string str
| None -> ()) | None -> ())
with _ -> ()); with _ -> ());
slider##.value := Js.string @@ string_of_float @@ (s.zoom -. 0.2 ) *. 50. ; (match slider with
slider##.oninput := Dom.handler (fun _ -> Some sl ->
s.zoom <- 0.2 +. (float_of_string @@ Js.to_string slider##.value) /. 50.0; sl##.value := Js.string @@ string_of_float @@ (s.zoom -. 0.2 ) *. 50. ;
draw s (0.0,0.0); sl##.oninput := Dom.handler (fun _ ->
Js._true); s.zoom <- 0.2 +. (float_of_string @@ Js.to_string sl##.value) /. 50.0;
Dom.appendChild saveload ((*Eliom_content.Html.To_dom.of_div*) (save_load_html s)); draw s (0.0,0.0);
Js._true)
| None -> ());
(match saveload with
Some div -> Dom.appendChild div ((*Eliom_content.Html.To_dom.of_div*) (save_load_html s))
| None -> ());
s s
let draw_choice s (x,y) = 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