mirror of
https://github.com/penpot/penpot.git
synced 2025-03-18 10:41:29 -05:00
🐛 Properly setup group on creation.
This commit is contained in:
parent
4bdaab637c
commit
b8dab7253e
2 changed files with 16 additions and 17 deletions
|
@ -227,14 +227,11 @@
|
|||
|
||||
(defn- setup-image
|
||||
[{:keys [metadata] :as shape} {:keys [x y width height] :as props}]
|
||||
(assoc shape
|
||||
:x x
|
||||
:y y
|
||||
:width width
|
||||
:height height
|
||||
:proportion (/ (:width metadata)
|
||||
(:height metadata))
|
||||
:proportion-lock true))
|
||||
(-> (setup-rect shape props)
|
||||
(assoc
|
||||
:proportion (/ (:width metadata)
|
||||
(:height metadata))
|
||||
:proportion-lock true)))
|
||||
|
||||
;; --- Coerce to Rect-like shape.
|
||||
|
||||
|
|
|
@ -1209,21 +1209,23 @@
|
|||
(when (not-empty selected)
|
||||
(let [page-id (get-in state [:workspace-page :id])
|
||||
objects (get-in state [:workspace-data page-id :objects])
|
||||
|
||||
selected-objects (map (partial get objects) selected)
|
||||
selection-rect (geom/selection-rect selected-objects)
|
||||
selrect (geom/selection-rect selected-objects)
|
||||
frame-id (-> selected-objects first :frame-id)
|
||||
group-shape (group-shape id frame-id selected selection-rect)
|
||||
frame-children (get-in objects [frame-id :shapes])
|
||||
index-frame (->> frame-children
|
||||
(map-indexed vector)
|
||||
(filter #(selected (second %)))
|
||||
(ffirst))
|
||||
group (-> (group-shape id frame-id selected selrect)
|
||||
(geom/setup selrect))
|
||||
|
||||
index (->> (get-in objects [frame-id :shapes])
|
||||
(map-indexed vector)
|
||||
(filter #(selected (second %)))
|
||||
(ffirst))
|
||||
|
||||
rchanges [{:type :add-obj
|
||||
:id id
|
||||
:frame-id frame-id
|
||||
:obj group-shape
|
||||
:index index-frame}
|
||||
:obj group
|
||||
:index index}
|
||||
{:type :mov-objects
|
||||
:parent-id id
|
||||
:shapes (vec selected)}]
|
||||
|
|
Loading…
Add table
Reference in a new issue