0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-12 18:18:24 -05:00

🐛 Fix set border radius for groups

This commit is contained in:
Andrés Moya 2020-07-10 11:23:49 +02:00
parent 8de55ce054
commit e3e148c569
2 changed files with 25 additions and 4 deletions

View file

@ -38,7 +38,25 @@
type (:type shape) ; always be :group
measure-values
(select-keys shape measure-attrs)
(merge
;; All values extracted from the group shape, except
;; border radius, that needs to be looked up from children
(geom/get-attrs-multi (map #(get-shape-attrs
%
measure-attrs
nil
nil
nil)
[shape])
measure-attrs)
(geom/get-attrs-multi (map #(get-shape-attrs
%
[:rx :ry]
nil
nil
nil)
shape-with-children)
[:rx :ry]))
fill-values
(geom/get-attrs-multi shape-with-children fill-attrs)
@ -114,6 +132,7 @@
text-transform-attrs)]
[:*
[:& measures-menu {:ids [id]
:ids-with-children ids-with-children
:type type
:values measure-values}]
[:& fill-menu {:ids ids-with-children

View file

@ -35,10 +35,12 @@
;; -- User/drawing coords
(mf/defc measures-menu
[{:keys [options ids values] :as props}]
[{:keys [options ids ids-with-children values] :as props}]
(let [options (or options #{:size :position :rotation :radius})
locale (i18n/use-locale)
ids-with-children (or ids-with-children ids)
old-shapes (deref (refs/objects-by-id ids))
frames (map #(deref (refs/object-by-id (:frame-id %))) old-shapes)
shapes (map gsh/transform-shape frames old-shapes)
@ -93,8 +95,8 @@
(let [value (-> (dom/get-target event)
(dom/get-value)
(d/parse-integer 0))]
(st/emit! (dwc/update-shapes-recursive
ids
(st/emit! (dwc/update-shapes
ids-with-children
#(if (:rx %)
(assoc % :rx value :ry value)
%)))))