aboutsummaryrefslogtreecommitdiff
path: root/script.it/state.ml
diff options
context:
space:
mode:
Diffstat (limited to 'script.it/state.ml')
-rwxr-xr-xscript.it/state.ml16
1 files changed, 8 insertions, 8 deletions
diff --git a/script.it/state.ml b/script.it/state.ml
index f08c3a1..b91c614 100755
--- a/script.it/state.ml
+++ b/script.it/state.ml
@@ -92,13 +92,11 @@ let update_selection id state f =
(** Select the given segment, and modify angle and width accordingly *)
let select_segment _ (_, selected, p0, p1) state dist =
- let angle0 = Path.Point.get_angle p0
- and angle1 = Path.Point.get_angle p1 in
- let width0 = Path.Point.get_width p0
- and width1 = Path.Point.get_width p1 in
- let angle = angle0 +. dist *. ( angle1 -. angle0 ) in
- let width = width0 +. dist *. ( width1 -. width0 ) in
+ let point' = Path.Point.mix dist (Path.Point.get_coord p0) p0 p1 in
+
+ let angle = Path.Point.get_angle point'
+ and width = Path.Point.get_width point' in
let id = Selection.select_path selected in
{ state with
@@ -159,6 +157,9 @@ let do_action
else
(* On the same segment, check for a point *)
let selection = Selection.select_point path (Gg.V2.of_tuple position) in
+
+ (* In order to handle the point move, start the timer *)
+ Elements.Timer.start timer 0.3;
{state with mode= Selection selection}
end
@@ -221,10 +222,9 @@ let do_action
(* Send the job to the worker *)
Brr_webworkers.Worker.post worker (`DeletePoint (id, point, p))
);
- state
+ { state with mode = Selection (Path id) }
| `Export, _ ->
-
let my_host = Uri.host @@ Window.location @@ G.window in
if (Hashtbl.hash my_host) = Blog.Hash_host.expected_host then (
(* Convert the path into an sVG element *)