From cd365b77d3246e6575cb8a539560acdf96a4e975 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 19 Aug 2016 22:19:32 +0300 Subject: [PATCH] Add update-path event. --- src/uxbox/main/data/shapes.cljs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/uxbox/main/data/shapes.cljs b/src/uxbox/main/data/shapes.cljs index 67b7048d86..e990381efa 100644 --- a/src/uxbox/main/data/shapes.cljs +++ b/src/uxbox/main/data/shapes.cljs @@ -387,6 +387,18 @@ {:pre [(uuid? id) (uuid? shape)]} (DeleteInteracton. shape id)) +;; --- Path Modifications + +(defrecord UpdatePath [id index delta] + rs/UpdateEvent + (-apply-update [_ state] + (update-in state [:shapes-by-id id :points index] gpt/add delta))) + +(defn update-path + "Update a concrete point in the path shape." + [id index delta] + {:pre [(uuid? id) (number? index) (gpt/point? delta)]} + (UpdatePath. id index delta)) ;; --- Events (implicit) (for selected)