🐛 Fix a worker error when transforming a rectangle into path

This commit is contained in:
alonso.torres 2021-11-05 15:42:49 +01:00 committed by Andrés Moya
parent b6b6b6043c
commit 959c998664
3 changed files with 18 additions and 20 deletions

View file

@ -21,6 +21,7 @@
- Fix problem with text rendering on export [Taiga #2223](https://tree.taiga.io/project/penpot/issue/2223) - Fix problem with text rendering on export [Taiga #2223](https://tree.taiga.io/project/penpot/issue/2223)
- Fix problem when flattening booleans losing styles [Taiga #2217](https://tree.taiga.io/project/penpot/issue/2217) - Fix problem when flattening booleans losing styles [Taiga #2217](https://tree.taiga.io/project/penpot/issue/2217)
- Add shortcuts to boolean icons popups [Taiga #2220](https://tree.taiga.io/project/penpot/issue/2220) - Add shortcuts to boolean icons popups [Taiga #2220](https://tree.taiga.io/project/penpot/issue/2220)
- Fix a worker error when transforming a rectangle into path
### :arrow_up: Deps updates ### :arrow_up: Deps updates
### :heart: Community contributions by (Thank you!) ### :heart: Community contributions by (Thank you!)

View file

@ -6,6 +6,7 @@
(ns app.common.geom.shapes.intersect (ns app.common.geom.shapes.intersect
(:require (:require
[app.common.data :as d]
[app.common.geom.matrix :as gmt] [app.common.geom.matrix :as gmt]
[app.common.geom.point :as gpt] [app.common.geom.point :as gpt]
[app.common.geom.shapes.path :as gpp] [app.common.geom.shapes.path :as gpp]
@ -172,6 +173,7 @@
"Checks if the given rect overlaps with the path in any point" "Checks if the given rect overlaps with the path in any point"
[shape rect] [shape rect]
(when (d/not-empty? (:content shape))
(let [ ;; If paths are too complex the intersection is too expensive (let [ ;; If paths are too complex the intersection is too expensive
;; we fallback to check its bounding box otherwise the performance penalty ;; we fallback to check its bounding box otherwise the performance penalty
;; is too big ;; is too big
@ -187,7 +189,7 @@
(or (is-point-inside-nonzero? (first rect-points) path-lines) (or (is-point-inside-nonzero? (first rect-points) path-lines)
(is-point-inside-nonzero? start-point rect-lines) (is-point-inside-nonzero? start-point rect-lines)
(intersects-lines? rect-lines path-lines)))) (intersects-lines? rect-lines path-lines)))))
(defn is-point-inside-ellipse? (defn is-point-inside-ellipse?
"checks if a point is inside an ellipse" "checks if a point is inside an ellipse"

View file

@ -177,12 +177,7 @@
(map #(get objects %)) (map #(get objects %))
(map #(convert-to-path % objects))) (map #(convert-to-path % objects)))
bool-type (:bool-type shape) bool-type (:bool-type shape)
head (if (= bool-type :difference) (first children) (last children)) content (pb/content-bool bool-type (mapv :content children))]
head (cond-> head
(and (contains? head :svg-attrs) (nil? (:fill-color head)))
(assoc :fill-color "#000000"))
content (pb/content-bool (:bool-type shape) (mapv :content children))]
(-> shape (-> shape
(assoc :type :path) (assoc :type :path)