diff --git a/src/uxbox/data/workspace.cljs b/src/uxbox/data/workspace.cljs index 0f69ff5ab..aaeb83dc2 100644 --- a/src/uxbox/data/workspace.cljs +++ b/src/uxbox/data/workspace.cljs @@ -338,19 +338,13 @@ (defn drop-shape "Event used in drag and drop for transfer shape from one position to an other." - [sid tid type] + [sid tid loc] {:pre [(not (nil? tid)) (not (nil? sid))]} (reify rs/UpdateEvent (-apply-update [_ state] - (if (= tid sid) - state - (case type - :inside (stsh/drop-inside state tid sid) - :before (stsh/drop-before state tid sid) - :after (stsh/drop-after state tid sid) - (throw (ex-info "Invalid data" {}))))))) + (stsh/drop-shape state tid sid loc)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Events (for selected) diff --git a/src/uxbox/state/shapes.cljs b/src/uxbox/state/shapes.cljs index a007173a8..2c71bacab 100644 --- a/src/uxbox/state/shapes.cljs +++ b/src/uxbox/state/shapes.cljs @@ -117,3 +117,13 @@ (assoc-in $ [:shapes-by-id tid :items] (conj shapes sid)) (update-in $ [:shapes-by-id sid] assoc :group tid)) state))) + +(defn drop-shape + [state tid sid loc] + (if (= tid sid) + state + (case loc + :inside (drop-inside state tid sid) + :before (drop-before state tid sid) + :after (drop-after state tid sid) + (throw (ex-info "Invalid data" {})))))