0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-22 23:06:08 -05:00

Improve scale matrix computation

This commit is contained in:
Aitor 2023-03-14 11:24:15 +01:00
parent 4eeef41ed4
commit b9559d99da

View file

@ -187,10 +187,11 @@
(defn scale-matrix
([pt center]
(-> (matrix)
(multiply! (translate-matrix center))
(multiply! (scale-matrix pt))
(multiply! (translate-matrix (gpt/negate center)))))
(let [sx (dm/get-prop pt :x)
sy (dm/get-prop pt :y)
cx (dm/get-prop center :x)
cy (dm/get-prop center :y)]
(Matrix. sx 0 0 sy (- cx (* cx sx)) (- cy (* cy sy)))))
([pt]
(assert (gpt/point? pt))
(Matrix. (dm/get-prop pt :x) 0 0 (dm/get-prop pt :y) 0 0)))