From d2a53444071b7799b136ec42184f7a9e310a35ce Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Fri, 15 Jul 2022 14:39:15 +0200 Subject: [PATCH] :bug: Fix problem with snap-pixel on resize --- common/src/app/common/geom/matrix.cljc | 9 +++++++++ frontend/src/app/main/data/workspace/transforms.cljs | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/common/src/app/common/geom/matrix.cljc b/common/src/app/common/geom/matrix.cljc index f891532a1..f83f5cca7 100644 --- a/common/src/app/common/geom/matrix.cljc +++ b/common/src/app/common/geom/matrix.cljc @@ -74,6 +74,15 @@ (mth/close? (.-e m1) (.-e m2)) (mth/close? (.-f m1) (.-f m2)))) +(defn unit? [m1] + (and (some? m1) + (mth/close? (.-a m1) 1) + (mth/close? (.-b m1) 0) + (mth/close? (.-c m1) 0) + (mth/close? (.-d m1) 1) + (mth/close? (.-e m1) 0) + (mth/close? (.-f m1) 0))) + (defn multiply ([^Matrix m1 ^Matrix m2] (let [m1a (.-a m1) diff --git a/frontend/src/app/main/data/workspace/transforms.cljs b/frontend/src/app/main/data/workspace/transforms.cljs index 09ec05e42..5a20b2946 100644 --- a/frontend/src/app/main/data/workspace/transforms.cljs +++ b/frontend/src/app/main/data/workspace/transforms.cljs @@ -282,9 +282,9 @@ (defn set-pixel-precision "Adjust modifiers so they adjust to the pixel grid" - [modifiers shape] + [{:keys [resize-transform] :as modifiers} shape] - (if (some? (:resize-transform modifiers)) + (if (and (some? resize-transform) (not (gmt/unit? resize-transform))) ;; If we're working with a rotation we don't handle pixel precision because ;; the transformation won't have the precision anyway modifiers