mirror of
https://github.com/penpot/penpot.git
synced 2025-07-20 20:07:14 +02: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
|
(defn- setup-image
|
||||||
[{:keys [metadata] :as shape} {:keys [x y width height] :as props}]
|
[{:keys [metadata] :as shape} {:keys [x y width height] :as props}]
|
||||||
(assoc shape
|
(-> (setup-rect shape props)
|
||||||
:x x
|
(assoc
|
||||||
:y y
|
:proportion (/ (:width metadata)
|
||||||
:width width
|
(:height metadata))
|
||||||
:height height
|
:proportion-lock true)))
|
||||||
:proportion (/ (:width metadata)
|
|
||||||
(:height metadata))
|
|
||||||
:proportion-lock true))
|
|
||||||
|
|
||||||
;; --- Coerce to Rect-like shape.
|
;; --- Coerce to Rect-like shape.
|
||||||
|
|
||||||
|
|
|
@ -1209,21 +1209,23 @@
|
||||||
(when (not-empty selected)
|
(when (not-empty selected)
|
||||||
(let [page-id (get-in state [:workspace-page :id])
|
(let [page-id (get-in state [:workspace-page :id])
|
||||||
objects (get-in state [:workspace-data page-id :objects])
|
objects (get-in state [:workspace-data page-id :objects])
|
||||||
|
|
||||||
selected-objects (map (partial get objects) selected)
|
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)
|
frame-id (-> selected-objects first :frame-id)
|
||||||
group-shape (group-shape id frame-id selected selection-rect)
|
group (-> (group-shape id frame-id selected selrect)
|
||||||
frame-children (get-in objects [frame-id :shapes])
|
(geom/setup selrect))
|
||||||
index-frame (->> frame-children
|
|
||||||
(map-indexed vector)
|
index (->> (get-in objects [frame-id :shapes])
|
||||||
(filter #(selected (second %)))
|
(map-indexed vector)
|
||||||
(ffirst))
|
(filter #(selected (second %)))
|
||||||
|
(ffirst))
|
||||||
|
|
||||||
rchanges [{:type :add-obj
|
rchanges [{:type :add-obj
|
||||||
:id id
|
:id id
|
||||||
:frame-id frame-id
|
:frame-id frame-id
|
||||||
:obj group-shape
|
:obj group
|
||||||
:index index-frame}
|
:index index}
|
||||||
{:type :mov-objects
|
{:type :mov-objects
|
||||||
:parent-id id
|
:parent-id id
|
||||||
:shapes (vec selected)}]
|
:shapes (vec selected)}]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue