diff --git a/CHANGES.md b/CHANGES.md index 91f4fcf69..8ed3fb5f6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -9,6 +9,7 @@ - Fix overlay closed on clicked outside [Taiga #4027](https://tree.taiga.io/project/penpot/issue/4027) - Fix animate multiple overlays [Taiga #3993](https://tree.taiga.io/project/penpot/issue/3993) - Fix problem with snap to grids [#2221](https://github.com/penpot/penpot/issues/2221) +- Fix issue when scaling to value 0 [Taiga #4109](https://tree.taiga.io/project/penpot/issue/4109) ## 1.15.3-beta diff --git a/common/src/app/common/geom/point.cljc b/common/src/app/common/geom/point.cljc index 7c82ee0c9..e60b97d7f 100644 --- a/common/src/app/common/geom/point.cljc +++ b/common/src/app/common/geom/point.cljc @@ -317,9 +317,14 @@ (unit) (scale value)))) +(defn no-zeros + "Remove zero values from either coordinate" + [point] + (-> point + (update :x #(if (mth/almost-zero? %) 0.001 %)) + (update :y #(if (mth/almost-zero? %) 0.001 %)))) ;; --- Debug (defmethod pp/simple-dispatch Point [obj] (pr obj)) - diff --git a/frontend/src/app/main/data/workspace/transforms.cljs b/frontend/src/app/main/data/workspace/transforms.cljs index 0cf7664d3..6595caf87 100644 --- a/frontend/src/app/main/data/workspace/transforms.cljs +++ b/frontend/src/app/main/data/workspace/transforms.cljs @@ -463,7 +463,8 @@ (gpt/multiply handler-mult)) ;; Resize vector - scalev (gpt/divide (gpt/add shapev deltav) shapev) + scalev (-> (gpt/divide (gpt/add shapev deltav) shapev) + (gpt/no-zeros)) scalev (if lock? (let [v (cond