From b9559d99da014f2701ed64021df2c93e61b892e9 Mon Sep 17 00:00:00 2001
From: Aitor <asakon28@gmail.com>
Date: Tue, 14 Mar 2023 11:24:15 +0100
Subject: [PATCH] :sparkles: Improve scale matrix computation

---
 common/src/app/common/geom/matrix.cljc | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/common/src/app/common/geom/matrix.cljc b/common/src/app/common/geom/matrix.cljc
index 01ee53c9d..2e552664c 100644
--- a/common/src/app/common/geom/matrix.cljc
+++ b/common/src/app/common/geom/matrix.cljc
@@ -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)))