0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-10 08:50:57 -05:00

🐛 Fix problem with gradient and rotations in booleans

This commit is contained in:
alonso.torres 2024-01-24 14:44:48 +01:00
parent 46b767ab0b
commit 50774bebb3
2 changed files with 8 additions and 9 deletions

View file

@ -18,19 +18,19 @@
(mf/fnc bool-shape (mf/fnc bool-shape
{::mf/wrap-props false} {::mf/wrap-props false}
[props] [props]
(let [shape (unchecked-get props "shape") (let [shape (unchecked-get props "shape")
children (unchecked-get props "childs") child-objs (unchecked-get props "childs")
children (h/use-equal-memo children) child-objs (h/use-equal-memo child-objs)
metadata? (mf/use-ctx use/include-metadata-ctx) metadata? (mf/use-ctx use/include-metadata-ctx)
content (mf/with-memo [shape children] content (mf/with-memo [shape child-objs]
(let [content (:bool-content shape)] (let [content (:bool-content shape)]
(cond (cond
(some? content) (some? content)
content content
(some? children) (some? child-objs)
(gsh/calc-bool-content shape children)))) (gsh/calc-bool-content shape child-objs))))
shape (mf/with-memo [shape content] shape (mf/with-memo [shape content]
(assoc shape :content content))] (assoc shape :content content))]
@ -40,9 +40,8 @@
[:& path-shape {:shape shape}]) [:& path-shape {:shape shape}])
(when metadata? (when metadata?
;; FIXME: get children looks wrong
[:> "penpot:bool" {} [:> "penpot:bool" {}
(for [item (map #(get children %) (:shapes shape))] (for [item (map #(get child-objs %) (:shapes shape))]
[:& shape-wrapper [:& shape-wrapper
{:shape item {:shape item
:key (dm/str (dm/get-prop item :id))}])])]))) :key (dm/str (dm/get-prop item :id))}])])])))

View file

@ -58,7 +58,7 @@
:width width :width width
:height height} :height height}
pat-props (if (= :path type) pat-props (if (or (= :path type) (= :bool type))
(obj/set! pat-props "patternTransform" transform) (obj/set! pat-props "patternTransform" transform)
pat-props)] pat-props)]