From 59e327ae0e9f006111e370a90039568c5c5d3cc4 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 20 Apr 2016 16:03:55 +0300 Subject: [PATCH] Add missing group matrix transformation. --- src/uxbox/util/geom.cljs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/uxbox/util/geom.cljs b/src/uxbox/util/geom.cljs index 5059497a56..d17109b8f0 100644 --- a/src/uxbox/util/geom.cljs +++ b/src/uxbox/util/geom.cljs @@ -492,6 +492,19 @@ (gmt/rotate rotation) (gmt/translate (- cx) (- cy)))) +(defn- group-transformation-matrix + [state {:keys [dx dy rotation items] :or {rotation 0} :as shape}] + (let [shapes-by-id (get state :shapes-by-id) + shapes (map #(get shapes-by-id %) items) + {:keys [x y width height]} (outer-rect shapes) + center-x (+ x (/ width 2)) + center-y (+ y (/ height 2))] + (-> (gmt/matrix) + (gmt/translate (or dx 0) (or dy 0)) + (gmt/translate center-x center-y) + (gmt/rotate rotation) + (gmt/translate (- center-x) (- center-y))))) + ;; --- Helpers (defn apply-rotation