diff --git a/CHANGES.md b/CHANGES.md index 594c60481e..46273e0936 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -68,6 +68,7 @@ - Remove "show in view mode" flag when moving frame to frame [Taiga #5091](https://tree.taiga.io/project/penpot/issue/5091) - Fix problem creating files in project page [Taiga #5060](https://tree.taiga.io/project/penpot/issue/5060) - Disable empty names on rename files [Taiga #5088](https://tree.taiga.io/project/penpot/issue/5088) +- Fix problem with SVG and flex layout [Taiga #](https://tree.taiga.io/project/penpot/issue/5099) ### :heart: Community contributions by (Thank you!) - To @ondrejkonec: for contributing to the code with: diff --git a/common/src/app/common/geom/point.cljc b/common/src/app/common/geom/point.cljc index d83a46c991..5517bc5a24 100644 --- a/common/src/app/common/geom/point.cljc +++ b/common/src/app/common/geom/point.cljc @@ -318,8 +318,10 @@ (defn unit [p1] (let [p-length (length p1)] - (Point. (/ (dm/get-prop p1 :x) p-length) - (/ (dm/get-prop p1 :y) p-length)))) + (if (mth/almost-zero? p-length) + (Point. 0 0) + (Point. (/ (dm/get-prop p1 :x) p-length) + (/ (dm/get-prop p1 :y) p-length))))) (defn perpendicular [pt]