summaryrefslogtreecommitdiff
path: root/script.it/selection.ml
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@chimrod.com>2021-01-12 13:41:00 +0100
committerSébastien Dailly <sebastien@chimrod.com>2021-01-12 14:07:56 +0100
commit228eceeed40b0f86e75a394fe8d65e6e93ca2370 (patch)
tree1409c2d9aa6924a35464e30af78e7281502ab36e /script.it/selection.ml
parent1aa90219e3e74bac3afbde0ec120e098b50bd0c5 (diff)
Move path, some refactoring
Diffstat (limited to 'script.it/selection.ml')
-rwxr-xr-xscript.it/selection.ml15
1 files changed, 12 insertions, 3 deletions
diff --git a/script.it/selection.ml b/script.it/selection.ml
index d00f026..f5f135a 100755
--- a/script.it/selection.ml
+++ b/script.it/selection.ml
@@ -1,8 +1,17 @@
open StdLabels
-type t =
- | Path of int
- | Point of (int * Path.Point.t)
+type 'a selection =
+ | Path of 'a
+ | Point of ('a * Path.Point.t)
+
+type t = int selection
+
+let find_selection
+ : int selection -> Outline.t list -> Outline.t selection option
+ = fun selection paths ->
+ match selection with
+ | Path id -> Option.map (fun p -> Path p) (Outline.find paths id)
+ | Point (id, pt) -> Option.map (fun p -> Point (p, pt)) (Outline.find paths id)
let threshold = 20.