From 42c3c122c4f53dd68bcdd89411835887c3ae0af9 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Mon, 11 Jan 2021 11:33:32 +0100 Subject: Outline module --- script.it/script.ml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'script.it/script.ml') diff --git a/script.it/script.ml b/script.it/script.ml index 05bec1b..9ef15fe 100755 --- a/script.it/script.ml +++ b/script.it/script.ml @@ -225,7 +225,7 @@ let on_change canva mouse_position timer state = in - Layer.Paths.to_canva (module Path.Path_Builder) current context state.rendering; + Layer.Paths.to_canva (module Layer.Paths.ReprBuild) (current, current) context state.rendering; List.iter state.paths ~f:(fun path -> @@ -233,7 +233,7 @@ let on_change canva mouse_position timer state = let () = match state.mode with | Selection (Path id) | Selection (Point (id, _)) -> - begin match id = (Path.Fixed.id path) with + begin match id = path.Outline.id with | true -> (* If the element is the selected one, change the color *) Cd2d.set_fill_style context (Cd2d.color Blog.Nord.nord8); @@ -245,7 +245,8 @@ let on_change canva mouse_position timer state = | _ -> () in - Layer.Paths.to_canva (module Layer.Paths.ReprFixed) (path, path) context state.rendering + let p = path.Outline.path in + Layer.Paths.to_canva (module Layer.Paths.ReprFixed) (p, p) context state.rendering ); let () = match state.mode with @@ -254,8 +255,9 @@ let on_change canva mouse_position timer state = List.iter state.paths ~f:(fun path -> - if id = Path.Fixed.id path then - Layer.Paths.to_canva (module Layer.Paths.ReprFixed) (path, path) context `Line + if id = path.Outline.id then + let p = path.Outline.path in + Layer.Paths.to_canva (module Layer.Paths.ReprFixed) (p, p) context `Line ) | Selection (Point (id, point)) -> (* As before, mark the selected path *) @@ -264,20 +266,20 @@ let on_change canva mouse_position timer state = List.iter state.paths ~f:(fun path -> - if id = Path.Fixed.id path then + if id = path.Outline.id then let path = begin match pos with | Some pos -> let pos_v2 = Gg.V2.of_tuple pos in if Elements.Timer.delay timer < 0.3 then - path + path.Outline.path else let point' = Path.Point.copy point pos_v2 in - begin match Path.Fixed.replace_point path point' with - | None -> path + begin match Path.Fixed.replace_point path.Outline.path point' with + | None -> path.Outline.path | Some p -> p end - | None -> path end in + | None -> path.Outline.path end in Layer.Paths.to_canva (module Layer.Paths.ReprFixed) (path, path) context `Line ); -- cgit v1.2.3