mirror of
https://github.com/penpot/penpot.git
synced 2025-08-06 15:08:27 +02:00
✨ Improve scale matrix computation
This commit is contained in:
parent
4eeef41ed4
commit
b9559d99da
1 changed files with 5 additions and 4 deletions
|
@ -187,10 +187,11 @@
|
||||||
|
|
||||||
(defn scale-matrix
|
(defn scale-matrix
|
||||||
([pt center]
|
([pt center]
|
||||||
(-> (matrix)
|
(let [sx (dm/get-prop pt :x)
|
||||||
(multiply! (translate-matrix center))
|
sy (dm/get-prop pt :y)
|
||||||
(multiply! (scale-matrix pt))
|
cx (dm/get-prop center :x)
|
||||||
(multiply! (translate-matrix (gpt/negate center)))))
|
cy (dm/get-prop center :y)]
|
||||||
|
(Matrix. sx 0 0 sy (- cx (* cx sx)) (- cy (* cy sy)))))
|
||||||
([pt]
|
([pt]
|
||||||
(assert (gpt/point? pt))
|
(assert (gpt/point? pt))
|
||||||
(Matrix. (dm/get-prop pt :x) 0 0 (dm/get-prop pt :y) 0 0)))
|
(Matrix. (dm/get-prop pt :x) 0 0 (dm/get-prop pt :y) 0 0)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue