mirror of
https://github.com/penpot/penpot.git
synced 2025-08-07 14:38:33 +02: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/rotate rotation)
|
||||||
(gmt/translate (- cx) (- cy))))
|
(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
|
;; --- Helpers
|
||||||
|
|
||||||
(defn apply-rotation
|
(defn apply-rotation
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue