aboutsummaryrefslogtreecommitdiff
path: root/script.ml
diff options
context:
space:
mode:
Diffstat (limited to 'script.ml')
-rwxr-xr-xscript.ml43
1 files changed, 29 insertions, 14 deletions
diff --git a/script.ml b/script.ml
index d501b10..398e4f2 100755
--- a/script.ml
+++ b/script.ml
@@ -142,6 +142,18 @@ let set_sidebar
)
);
+
+ let br = El.br () in
+ let render =
+ El.select
+ [ El.option ~at:At.[value (Jstr.v "Fill")]
+ [ txt' "Fill"]
+ ; El.option ~at:At.[value (Jstr.v "Wireframe")]
+ [ txt' "Wireframe"]
+ ; El.option ~at:At.[value (Jstr.v "Ductus")]
+ [ txt' "Ductus"]
+ ] in
+
let () =
El.append_children element
[ hr ()
@@ -155,6 +167,9 @@ let set_sidebar
; angle
; input_angle
+ ; br
+ ; render
+
]
in
delete_event, angle_event, nib_size_event, export_event
@@ -165,20 +180,20 @@ let green = Jstr.v "#a3be8c"
(** Redraw the canva on update *)
let on_change canva mouse_position state =
- let open Brr_canvas.C2d in
+ let module Cd2d = Brr_canvas.C2d in
let w, h = Brr_canvas.Canvas.(float_of_int @@ w canva, float_of_int @@ h canva) in
- let context = create canva in
+ let context = Cd2d.create canva in
- set_fill_style context (color backgroundColor);
- fill_rect context
+ Cd2d.set_fill_style context (Cd2d.color backgroundColor);
+ Cd2d.fill_rect context
~x:0.0
~y:0.0
~w
~h;
- set_stroke_style context (color white);
- set_fill_style context (color white);
+ Cd2d.set_stroke_style context (Cd2d.color white);
+ Cd2d.set_fill_style context (Cd2d.color white);
(* If we are in edit mode, we add a point under the cursor.
@@ -197,28 +212,28 @@ let on_change canva mouse_position state =
end
in
- let repr = `Wire in
+ let repr = `Fill in
- Paths.to_canva (module Paths.Path_Builder) current context repr;
+ Path.to_canva (module Path.Path_Builder) current context repr;
List.iter state.paths
~f:(fun path ->
let () = match state.mode with
| Selection id ->
- begin match id = (Paths.Fixed.id path) with
+ begin match id = (Path.Fixed.id path) with
| true ->
(* If the element is the selected one, change the color *)
- set_fill_style context (color Blog.Nord.nord8);
- set_stroke_style context (color Blog.Nord.nord8)
+ Cd2d.set_fill_style context (Cd2d.color Blog.Nord.nord8);
+ Cd2d.set_stroke_style context (Cd2d.color Blog.Nord.nord8)
| false ->
- set_stroke_style context (color white);
- set_fill_style context (color white);
+ Cd2d.set_stroke_style context (Cd2d.color white);
+ Cd2d.set_fill_style context (Cd2d.color white);
end
| _ -> ()
in
- Paths.to_canva (module Paths.Fixed) path context repr
+ Path.to_canva (module Path.Fixed) path context repr
);
()