mirror of
https://github.com/penpot/penpot.git
synced 2025-01-26 08:29:42 -05:00
Merge pull request #2702 from penpot/palba-fix-boolean-shapes-color
🐛 Fix incorrect color in properties of multiple bool shapes
This commit is contained in:
commit
0144939f34
3 changed files with 18 additions and 1 deletions
|
@ -34,6 +34,7 @@
|
|||
- Fix selection stroke missing in properties of multiple texts [Taiga #4048](https://tree.taiga.io/project/penpot/issue/4048)
|
||||
- Fix missing create component menu for frames [Github #2670](https://github.com/penpot/penpot/issues/2670)
|
||||
- Fix "currentColor" is not converted when importing SVG [Github 2276](https://github.com/penpot/penpot/issues/2276)
|
||||
- Fix incorrect color in properties of multiple bool shapes [Taiga #4355](https://tree.taiga.io/project/penpot/issue/4355)
|
||||
|
||||
### :arrow_up: Deps updates
|
||||
|
||||
|
|
|
@ -537,6 +537,7 @@
|
|||
:blocked
|
||||
:hidden
|
||||
|
||||
:fills
|
||||
:fill-color
|
||||
:fill-opacity
|
||||
:fill-color-ref-id
|
||||
|
|
|
@ -247,6 +247,18 @@
|
|||
(= (:type shape) :path)
|
||||
(dissoc :content)))
|
||||
|
||||
(defn- is-bool-descendant?
|
||||
[shape all-shapes selected-shape-ids]
|
||||
(let [parent-id (:parent-id shape)
|
||||
parent (->> all-shapes
|
||||
(filter #(= (:id %) parent-id))
|
||||
first)]
|
||||
(cond
|
||||
(nil? shape) false ;; failsafe
|
||||
(some #{(:id shape)} selected-shape-ids) false ;; if it is one of the selected shapes, it is considerer not a bool descendant
|
||||
(= :bool (:type parent)) true ;; if its parent is of type bool, it is a bool descendant
|
||||
:else (is-bool-descendant? parent all-shapes selected-shape-ids)))) ;; else, check its parent
|
||||
|
||||
(mf/defc options
|
||||
{::mf/wrap [#(mf/memo' % (mf/check-props ["shapes" "shapes-with-children" "page-id" "file-id"]))]
|
||||
::mf/wrap-props false}
|
||||
|
@ -254,6 +266,10 @@
|
|||
(let [shapes (unchecked-get props "shapes")
|
||||
shapes-with-children (unchecked-get props "shapes-with-children")
|
||||
|
||||
;; remove children from bool shapes
|
||||
shape-ids (map :id shapes)
|
||||
shapes-with-children (filter #(not (is-bool-descendant? % shapes-with-children shape-ids)) shapes-with-children)
|
||||
|
||||
workspace-modifiers (mf/deref refs/workspace-modifiers)
|
||||
shapes (map #(gsh/transform-shape % (get-in workspace-modifiers [(:id %) :modifiers])) shapes)
|
||||
|
||||
|
@ -279,7 +295,6 @@
|
|||
|
||||
[measure-ids measure-values] (get-attrs shapes objects :measure)
|
||||
|
||||
|
||||
[layer-ids layer-values
|
||||
constraint-ids constraint-values
|
||||
fill-ids fill-values
|
||||
|
|
Loading…
Add table
Reference in a new issue