0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-15 17:21:17 -05:00

Add missing group matrix transformation.

This commit is contained in:
Andrey Antukh 2016-04-20 16:03:55 +03:00
parent f400a242d9
commit 59e327ae0e
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95

View file

@ -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