From 6e78745ed5415d15089f39f948b5ab1ce1592e27 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 29 Mar 2023 11:22:26 +0200 Subject: [PATCH] :bug: Fix problem with SVG and flex layout --- CHANGES.md | 1 + common/src/app/common/geom/point.cljc | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 594c60481..46273e093 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 d83a46c99..5517bc5a2 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]