diff --git a/CHANGES.md b/CHANGES.md index 774ad0a2b..62ca75f71 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 diff --git a/common/src/app/common/pages/common.cljc b/common/src/app/common/pages/common.cljc index dbfe83cba..f12ec2d35 100644 --- a/common/src/app/common/pages/common.cljc +++ b/common/src/app/common/pages/common.cljc @@ -537,6 +537,7 @@ :blocked :hidden + :fills :fill-color :fill-opacity :fill-color-ref-id diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/shapes/multiple.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/shapes/multiple.cljs index fe9365274..5579183e2 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/shapes/multiple.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/shapes/multiple.cljs @@ -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