From af0a516a79667c66bc89c1fa556efb07d4c78c86 Mon Sep 17 00:00:00 2001 From: Aitor Moreno Date: Fri, 28 Mar 2025 09:43:46 +0100 Subject: [PATCH] :bug: Fix path editing with wrong selrect (#6168) --- CHANGES.md | 1 + common/src/app/common/geom/shapes/path.cljc | 6 +++++- common/src/app/common/svg/path/subpath.cljc | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index e7ac35c1e..c6e9a25e3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,6 +12,7 @@ ### :bug: Bugs fixed +- Fix path having a wrong selrect [Taiga #10257](https://tree.taiga.io/project/penpot/issue/10257) - Fix SVG `stroke-linecap` property when importing SVGs [Taiga #9489](https://tree.taiga.io/project/penpot/issue/9489) ## 2.6.0 (Unreleased) diff --git a/common/src/app/common/geom/shapes/path.cljc b/common/src/app/common/geom/shapes/path.cljc index c9863d9f3..a7e56f3d2 100644 --- a/common/src/app/common/geom/shapes/path.cljc +++ b/common/src/app/common/geom/shapes/path.cljc @@ -347,7 +347,11 @@ move-p nil content (seq content)] (if content - (let [command (first content) + (let [last-p (last content) + content (if (= :move-to (:command last-p)) + (butlast content) + content) + command (first content) to-p (command->point command) [from-p move-p command-pts] diff --git a/common/src/app/common/svg/path/subpath.cljc b/common/src/app/common/svg/path/subpath.cljc index 2000debb3..d5117f5f8 100644 --- a/common/src/app/common/svg/path/subpath.cljc +++ b/common/src/app/common/svg/path/subpath.cljc @@ -126,7 +126,7 @@ (pt= (:from subpath) (:to subpath))) (defn close-subpaths - "Searches a path for possible supaths that can create closed loops and merge them" + "Searches a path for possible subpaths that can create closed loops and merge them" [content] (let [subpaths (get-subpaths content) closed-subpaths