🐛 Fix keep name of component equal to the shape name

This commit is contained in:
alonso.torres 2022-01-11 12:40:23 +01:00
parent e5430259e9
commit badb5c6a9b
3 changed files with 12 additions and 11 deletions

View file

@ -130,11 +130,12 @@
(if (and (= (count shapes) 1)
(:component-id (first shapes)))
empty-changes
(let [[group rchanges uchanges]
(let [name (if (= 1 (count shapes)) (:name (first shapes)) "Component-1")
[group rchanges uchanges]
(if (and (= (count shapes) 1)
(= (:type (first shapes)) :group))
[(first shapes) [] []]
(dwg/prepare-create-group objects page-id shapes "Component-1" true))
(dwg/prepare-create-group objects page-id shapes name true))
;; Asserts for documentation purposes
_ (us/assert vector? rchanges)
@ -146,7 +147,7 @@
rchanges (conj rchanges
{:type :add-component
:id (:id new-shape)
:name (:name new-shape)
:name name
:shapes new-shapes})
rchanges (into rchanges