mirror of
https://github.com/penpot/penpot.git
synced 2025-02-14 19:19:09 -05:00
🐛 Locks shapes when moved inside a locked parent
This commit is contained in:
parent
1b0a6b26ce
commit
369192a353
2 changed files with 10 additions and 5 deletions
|
@ -73,6 +73,7 @@
|
||||||
- Fix paste elements at bottom of frame [Taig #5253](https://tree.taiga.io/project/penpot/issue/5253)
|
- Fix paste elements at bottom of frame [Taig #5253](https://tree.taiga.io/project/penpot/issue/5253)
|
||||||
- Fix new-file button on project not redirecting to the new file [Taiga #5610](https://tree.taiga.io/project/penpot/issue/5610)
|
- Fix new-file button on project not redirecting to the new file [Taiga #5610](https://tree.taiga.io/project/penpot/issue/5610)
|
||||||
- Fix retrieve user comments in dashboard [Taiga #5607](https://tree.taiga.io/project/penpot/issue/5607)
|
- Fix retrieve user comments in dashboard [Taiga #5607](https://tree.taiga.io/project/penpot/issue/5607)
|
||||||
|
- Locks shapes when moved inside a locked parent [Taiga #5252](https://tree.taiga.io/project/penpot/issue/5252)
|
||||||
|
|
||||||
### :arrow_up: Deps updates
|
### :arrow_up: Deps updates
|
||||||
|
|
||||||
|
|
|
@ -717,17 +717,18 @@
|
||||||
groups-to-delete groups-to-unmask shapes-to-detach
|
groups-to-delete groups-to-unmask shapes-to-detach
|
||||||
shapes-to-reroot shapes-to-deroot shapes-to-unconstraint]
|
shapes-to-reroot shapes-to-deroot shapes-to-unconstraint]
|
||||||
(let [ordered-indexes (cph/order-by-indexed-shapes objects ids)
|
(let [ordered-indexes (cph/order-by-indexed-shapes objects ids)
|
||||||
shapes (map (d/getf objects) ordered-indexes)]
|
shapes (map (d/getf objects) ordered-indexes)
|
||||||
|
parent (get objects parent-id)]
|
||||||
|
|
||||||
(-> (pcb/empty-changes it page-id)
|
(-> (pcb/empty-changes it page-id)
|
||||||
(pcb/with-objects objects)
|
(pcb/with-objects objects)
|
||||||
|
|
||||||
;; Remove layout-item properties when moving a shape outside a layout
|
;; Remove layout-item properties when moving a shape outside a layout
|
||||||
(cond-> (not (ctl/any-layout? objects parent-id))
|
(cond-> (not (ctl/any-layout? parent))
|
||||||
(pcb/update-shapes ordered-indexes ctl/remove-layout-item-data))
|
(pcb/update-shapes ordered-indexes ctl/remove-layout-item-data))
|
||||||
|
|
||||||
;; Remove the hide in viewer flag
|
;; Remove the hide in viewer flag
|
||||||
(cond-> (and (not= uuid/zero parent-id) (cph/frame-shape? objects parent-id))
|
(cond-> (and (not= uuid/zero parent-id) (cph/frame-shape? parent))
|
||||||
(pcb/update-shapes ordered-indexes #(cond-> % (cph/frame-shape? %) (assoc :hide-in-viewer true))))
|
(pcb/update-shapes ordered-indexes #(cond-> % (cph/frame-shape? %) (assoc :hide-in-viewer true))))
|
||||||
|
|
||||||
;; Move the shapes
|
;; Move the shapes
|
||||||
|
@ -759,8 +760,7 @@
|
||||||
;; Reset constraints depending on the new parent
|
;; Reset constraints depending on the new parent
|
||||||
(pcb/update-shapes shapes-to-unconstraint
|
(pcb/update-shapes shapes-to-unconstraint
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
(let [parent (get objects parent-id)
|
(let [frame-id (if (= (:type parent) :frame)
|
||||||
frame-id (if (= (:type parent) :frame)
|
|
||||||
(:id parent)
|
(:id parent)
|
||||||
(:frame-id parent))
|
(:frame-id parent))
|
||||||
moved-shape (assoc shape
|
moved-shape (assoc shape
|
||||||
|
@ -783,6 +783,10 @@
|
||||||
(assoc :layout-item-v-sizing :fix))
|
(assoc :layout-item-v-sizing :fix))
|
||||||
parent)))
|
parent)))
|
||||||
|
|
||||||
|
;; If parent locked, lock the added shapes
|
||||||
|
(cond-> (:blocked parent)
|
||||||
|
(pcb/update-shapes ordered-indexes #(assoc % :blocked true)))
|
||||||
|
|
||||||
;; Resize parent containers that need to
|
;; Resize parent containers that need to
|
||||||
(pcb/resize-parents parents))))
|
(pcb/resize-parents parents))))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue