mirror of
https://github.com/penpot/penpot.git
synced 2025-02-10 09:08:31 -05:00
✨ Remove restriction to move mask layers
This commit is contained in:
parent
bc9be7846a
commit
f38197b227
1 changed files with 1 additions and 13 deletions
|
@ -200,21 +200,9 @@
|
||||||
(cph/insert-at-index prev-shapes index shapes)
|
(cph/insert-at-index prev-shapes index shapes)
|
||||||
(cph/append-at-the-end prev-shapes shapes))))
|
(cph/append-at-the-end prev-shapes shapes))))
|
||||||
|
|
||||||
(check-insert-items [prev-shapes parent index shapes]
|
|
||||||
(if-not (:masked-group? parent)
|
|
||||||
(insert-items prev-shapes index shapes)
|
|
||||||
;; For masked groups, the first shape is the mask
|
|
||||||
;; and it cannot be moved.
|
|
||||||
(let [mask-id (first prev-shapes)
|
|
||||||
other-ids (rest prev-shapes)
|
|
||||||
not-mask-shapes (without-obj shapes mask-id)
|
|
||||||
new-index (if (nil? index) nil (max (dec index) 0))
|
|
||||||
new-shapes (insert-items other-ids new-index not-mask-shapes)]
|
|
||||||
(into [mask-id] new-shapes))))
|
|
||||||
|
|
||||||
(add-to-parent [parent index shapes]
|
(add-to-parent [parent index shapes]
|
||||||
(let [parent (-> parent
|
(let [parent (-> parent
|
||||||
(update :shapes check-insert-items parent index shapes)
|
(update :shapes insert-items index shapes)
|
||||||
;; We need to ensure that no `nil` in the
|
;; We need to ensure that no `nil` in the
|
||||||
;; shapes list after adding all the
|
;; shapes list after adding all the
|
||||||
;; incoming shapes to the parent.
|
;; incoming shapes to the parent.
|
||||||
|
|
Loading…
Add table
Reference in a new issue