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:
parent
f400a242d9
commit
59e327ae0e
1 changed files with 13 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue