diff options
author | Sébastien Dailly <sebastien@chimrod.com> | 2021-01-11 11:33:32 +0100 |
---|---|---|
committer | Sébastien Dailly <sebastien@chimrod.com> | 2021-01-11 13:55:43 +0100 |
commit | 42c3c122c4f53dd68bcdd89411835887c3ae0af9 (patch) | |
tree | 856a54955c4bf1648e7f5f1cea809e5601b60c7d /script.it/script.ml | |
parent | 979be5f588a1ffd6e1d060cd794e87526d517b7a (diff) |
Outline module
Diffstat (limited to 'script.it/script.ml')
-rwxr-xr-x | script.it/script.ml | 22 |
1 files changed, 12 insertions, 10 deletions
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 ); |