mirror of
https://github.com/penpot/penpot.git
synced 2025-04-04 19:11:20 -05:00
Merge pull request #3082 from penpot/alotor-bugfixing-12
🐛 Fix problem with invalid SVG shape
This commit is contained in:
commit
aca242046e
2 changed files with 19 additions and 2 deletions
|
@ -9,7 +9,8 @@
|
|||
[app.common.data :as d]
|
||||
[app.common.geom.matrix :as gmt]
|
||||
[app.common.geom.point :as gpt]
|
||||
[app.common.geom.shapes.rect :as gpr]))
|
||||
[app.common.geom.shapes.rect :as gpr]
|
||||
[app.common.math :as mth]))
|
||||
|
||||
(defn center-rect
|
||||
[{:keys [x y width height]}]
|
||||
|
@ -71,3 +72,15 @@
|
|||
[{:keys [x1 y1 x2 y2] :as sr} matrix]
|
||||
(let [[c1 c2] (transform-points [(gpt/point x1 y1) (gpt/point x2 y2)] matrix)]
|
||||
(gpr/corners->selrect c1 c2)))
|
||||
|
||||
(defn invalid-geometry?
|
||||
[{:keys [points selrect]}]
|
||||
|
||||
(or (mth/nan? (:x selrect))
|
||||
(mth/nan? (:y selrect))
|
||||
(mth/nan? (:width selrect))
|
||||
(mth/nan? (:height selrect))
|
||||
(some (fn [p]
|
||||
(or (mth/nan? (:x p))
|
||||
(mth/nan? (:y p))))
|
||||
points)))
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
[app.common.data :as d]
|
||||
[app.common.data.macros :as dm]
|
||||
[app.common.geom.point :as gpt]
|
||||
[app.common.geom.shapes.common :as gco]
|
||||
[app.common.geom.shapes.constraints :as gct]
|
||||
[app.common.geom.shapes.flex-layout :as gcfl]
|
||||
[app.common.geom.shapes.grid-layout :as gcgl]
|
||||
|
@ -180,6 +181,7 @@
|
|||
(let [children (->> children
|
||||
(map (d/getf objects))
|
||||
(remove :hidden)
|
||||
(remove gco/invalid-geometry?)
|
||||
(map apply-modifiers))
|
||||
layout-data (gcfl/calc-layout-data parent children @transformed-parent-bounds)
|
||||
children (into [] (cond-> children (not (:reverse? layout-data)) reverse))
|
||||
|
@ -215,6 +217,7 @@
|
|||
modif-tree))]
|
||||
(let [children (->> (cph/get-immediate-children objects (:id parent))
|
||||
(remove :hidden)
|
||||
(remove gco/invalid-geometry?)
|
||||
(map apply-modifiers))
|
||||
grid-data (gcgl/calc-layout-data parent children @transformed-parent-bounds)]
|
||||
(loop [modif-tree modif-tree
|
||||
|
@ -249,7 +252,8 @@
|
|||
(ctm/resize (gpt/point 1 scale-height) origin (:transform parent) (:transform-inverse parent)))))
|
||||
|
||||
children (->> (cph/get-immediate-children objects parent-id)
|
||||
(remove :hidden))
|
||||
(remove :hidden)
|
||||
(remove gco/invalid-geometry?))
|
||||
|
||||
content-bounds
|
||||
(when (and (d/not-empty? children) (or (ctl/auto-height? parent) (ctl/auto-width? parent)))
|
||||
|
|
Loading…
Add table
Reference in a new issue