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

updtae

parent 7a0e25dd
Pipeline #1323 failed with stage
in 13 seconds
......@@ -11,9 +11,9 @@ SERVER_FILES := $(wildcard *.eliomi *.eliom)
CLIENT_FILES := $(wildcard *.eliomi *.eliom) TikzGraph.ml MarkovChain.ml tikzLexer.ml tikzParser.ml
# OCamlfind packages for the server
SERVER_PACKAGES := lwt.ppx js_of_ocaml-ppx.deriving xml-light
SERVER_PACKAGES := lwt_ppx js_of_ocaml-ppx.deriving xml-light
# OCamlfind packages for the client
CLIENT_PACKAGES := lwt.ppx js_of_ocaml-ppx js_of_ocaml-ppx.deriving xml-light GraphEditor
CLIENT_PACKAGES := lwt_ppx js_of_ocaml-ppx js_of_ocaml-ppx.deriving xml-light GraphEditor
# Directory with files to be statically served
LOCAL_STATIC = static
......
......@@ -4,24 +4,24 @@ open Eliom_content
open Html.D
]
let width = 4096
let height = 2048
module Cosmosweb_app =
Eliom_registration.App (
struct
let application_name = "cosmosweb"
let global_data_path = None
end)
let canvas_elt =
canvas ~a:[a_width width; a_height height]
[pcdata "your browser doesn't support canvas"]
[txt "your browser doesn't support canvas"]
let attribute_list_div =
div [ul ~a:[a_id "attributelist"] []]
let attribute_div =
div ~a:[ a_class ["attributelistdiv"] ] [
attribute_list_div;
......@@ -31,71 +31,70 @@ let attribute_div =
module GenGraph = GraphDrawing.GraphEditor(SimpleGraph.S(MarkovChain))
module TikzGraph = GraphDrawing.GraphEditor(SimpleGraph.S(TikzGraph))
]
let create_form =
div []
let page content =
html
(head (title (pcdata "TikZ Editor"))
[ meta ~a:[a_charset "utf-8"] ();
meta ~a:[a_http_equiv "X-UA-Compatible"; a_content "IE=edge"] ();
meta ~a:[a_name "viewport"; a_content "width=device-width, initial-scale=1"] ();
link ~rel:[`Stylesheet] ~href:(Raw.uri_of_string "css/bootstrap.min.css") ()])
(head (title (txt "TikZ Editor"))
[ meta ~a:[a_charset "utf-8"] ();
meta ~a:[a_http_equiv "X-UA-Compatible"; a_content "IE=edge"] ();
meta ~a:[a_name "viewport"; a_content "width=device-width, initial-scale=1"] ();
link ~rel:[`Stylesheet] ~href:(Raw.uri_of_string "css/bootstrap.min.css") ()])
(body [
nav ~a:[a_class ["navba";"navbar-expand-md";"navbar-dark";"fixed-top";"bg-dark"]]
[Raw.a ~a:[a_class ["navbar-brand"]; a_href (Raw.uri_of_string "#")]
[pcdata "TikZ Editor"]];
nav ~a:[a_class ["navba";"navbar-expand-md";"navbar-dark";"fixed-top";"bg-dark"]]
[Raw.a ~a:[a_class ["navbar-brand"]; a_href (Raw.uri_of_string "#")]
[txt "TikZ Editor"]];
content;
script ~a:[a_src (Xml.uri_of_string "https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js")] (pcdata "");
script ~a:[a_src (Xml.uri_of_string "js/bootstrap.min.js")] (pcdata "");
script ~a:[a_src (Xml.uri_of_string "js/download.min.js")] (pcdata "");
script ~a:[a_src (Xml.uri_of_string "js/upload.js")] (pcdata "");
])
script ~a:[a_src (Xml.uri_of_string "https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js")] (txt "");
script ~a:[a_src (Xml.uri_of_string "js/bootstrap.min.js")] (txt "");
script ~a:[a_src (Xml.uri_of_string "js/download.min.js")] (txt "");
script ~a:[a_src (Xml.uri_of_string "js/upload.js")] (txt "");
])
let slider = input ~a:[a_id "zoomslider";
a_input_type `Range;
a_value "40"] ()
a_input_type `Range;
a_value "40"] ()
let graph_editor () =
(*let zoomchange = [%client fun ev ->
let slide = Eliom_content.Html.To_dom.of_input zoom_slider in
let zoom = int_of_string @@ Js.to_string slide##.value in () ]
let zoom = int_of_string @@ Js.to_string slide##.value in () ]
and zoom_slider = Raw.input ~a:[a_id "speedid";
a_input_type `Range;
a_input_type `Range;
a_onchange zoomchange;
a_value "100"] () in *)
a_value "100"] () in *)
div ~a:[a_class ["row"; "jumbotron"]] [
div ~a:[a_class ["col-8"]] [
div ~a:[a_class ["col-8"]] [
create_form;
div ~a:[a_class ["container"]] [
div ~a:[a_style "overflow: auto; height:768px;";
div ~a:[a_class ["container"]] [
div ~a:[a_style "overflow: auto; height:768px;";
a_oncontextmenu [%client fun ev -> () ]] [canvas_elt];
div ~a:[a_style "float: right;"] [pcdata "zoom: "; slider]
div ~a:[a_style "float: right;"] [txt "zoom: "; slider]
]];
div ~a:[a_class ["col-4"]] [ attribute_div ]
]
let main_service =
Eliom_service.create
~path:(Eliom_service.Path [])
~meth:(Eliom_service.Get Eliom_parameter.unit)
()
let () =
let () =
Cosmosweb_app.register
~service:main_service
(fun () () ->
let _ = [%client
(let editor_state = TikzGraph.init ~%canvas_elt ~%attribute_list_div ~%create_form ~%slider in
TikzGraph.init_client editor_state :unit) ] in
Lwt.return (page (graph_editor ())))
......@@ -10,4 +10,4 @@ Library "GraphEditor"
BuildTools: ocamlbuild
Modules: Data, DrawingGeom, GenericSerializer, GraphDrawing, Layout,
SimpleGraph, UtilsWeb
BuildDepends: eliom.client,lwt.ppx,js_of_ocaml-ppx,js_of_ocaml-ppx.deriving,xml-light
BuildDepends: eliom.client,lwt_ppx,js_of_ocaml-ppx,js_of_ocaml-ppx.deriving,xml-light
Markdown is supported
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