diff options
Diffstat (limited to 'script.it/script_event/property.ml')
-rwxr-xr-x | script.it/script_event/property.ml | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/script.it/script_event/property.ml b/script.it/script_event/property.ml index dbdc1de..b41d3f8 100755 --- a/script.it/script_event/property.ml +++ b/script.it/script_event/property.ml @@ -1,52 +1,52 @@ module State = Script_state.State module Selection = Script_state.Selection +module Path = Script_path let update_property worker state value f = function | None -> state | Some (Selection.Path outline) -> - (* Change width for the whole path *) - let outline = { outline with - Outline.path = Path.Fixed.map outline.Outline.path (fun p -> - f p value) - } in - State.post worker (`Back outline); - state + (* Change width for the whole path *) + let outline = + { outline with + Outline.path = + Path.Fixed.map outline.Outline.path (fun p -> f p value) + } + in + State.post worker (`Back outline); + state | Some (Point (outline, point)) -> - let path = Path.Fixed.map - outline.path - (fun pt -> - match Path.Point.id pt = Path.Point.id point with - | false -> pt - | true -> f pt value) - in - let outline = {outline with path} in - State.post worker (`Back outline); - state + let path = + Path.Fixed.map outline.path (fun pt -> + match Path.Point.id pt = Path.Point.id point with + | false -> pt + | true -> f pt value ) + in + let outline = { outline with path } in + State.post worker (`Back outline); + state -type t = { prop : [`Angle | `Width ] - ; value : float - ; worker : Brr_webworkers.Worker.t - } -let process { prop; value ; worker } state = +type t = + { prop : [ `Angle | `Width ] + ; value : float + ; worker : Brr_webworkers.Worker.t + } + +let process { prop; value; worker } state = match prop with | `Angle -> - let angle = value in - begin match state.State.mode with - + let angle = value in + ( match state.State.mode with | Selection t -> - let state = { state with angle } in - Selection.find_selection t state.paths - |> update_property worker state angle Path.Point.set_angle - | _ -> { state with angle } - end + let state = { state with angle } in + Selection.find_selection t state.paths + |> update_property worker state angle Path.Point.set_angle + | _ -> { state with angle } ) | `Width -> - let width = value in - begin match state.State.mode with - + let width = value in + ( match state.State.mode with | Selection t -> - let state = { state with width } in - Selection.find_selection t state.paths - |> update_property worker state width Path.Point.set_width - | _ -> { state with width } - end + let state = { state with width } in + Selection.find_selection t state.paths + |> update_property worker state width Path.Point.set_width + | _ -> { state with width } ) |