mirror of
https://github.com/penpot/penpot.git
synced 2025-02-09 16:48:16 -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 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 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 "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
|
### :arrow_up: Deps updates
|
||||||
|
|
||||||
|
|
|
@ -537,6 +537,7 @@
|
||||||
:blocked
|
:blocked
|
||||||
:hidden
|
:hidden
|
||||||
|
|
||||||
|
:fills
|
||||||
:fill-color
|
:fill-color
|
||||||
:fill-opacity
|
:fill-opacity
|
||||||
:fill-color-ref-id
|
:fill-color-ref-id
|
||||||
|
|
|
@ -247,6 +247,18 @@
|
||||||
(= (:type shape) :path)
|
(= (:type shape) :path)
|
||||||
(dissoc :content)))
|
(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/defc options
|
||||||
{::mf/wrap [#(mf/memo' % (mf/check-props ["shapes" "shapes-with-children" "page-id" "file-id"]))]
|
{::mf/wrap [#(mf/memo' % (mf/check-props ["shapes" "shapes-with-children" "page-id" "file-id"]))]
|
||||||
::mf/wrap-props false}
|
::mf/wrap-props false}
|
||||||
|
@ -254,6 +266,10 @@
|
||||||
(let [shapes (unchecked-get props "shapes")
|
(let [shapes (unchecked-get props "shapes")
|
||||||
shapes-with-children (unchecked-get props "shapes-with-children")
|
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)
|
workspace-modifiers (mf/deref refs/workspace-modifiers)
|
||||||
shapes (map #(gsh/transform-shape % (get-in workspace-modifiers [(:id %) :modifiers])) shapes)
|
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)
|
[measure-ids measure-values] (get-attrs shapes objects :measure)
|
||||||
|
|
||||||
|
|
||||||
[layer-ids layer-values
|
[layer-ids layer-values
|
||||||
constraint-ids constraint-values
|
constraint-ids constraint-values
|
||||||
fill-ids fill-values
|
fill-ids fill-values
|
||||||
|
|
Loading…
Add table
Reference in a new issue