0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-09 00:28:20 -05:00

Remove restriction to move mask layers

This commit is contained in:
alonso.torres 2023-01-19 15:10:36 +01:00
parent bc9be7846a
commit f38197b227

View file

@ -200,21 +200,9 @@
(cph/insert-at-index prev-shapes index 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]
(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
;; shapes list after adding all the
;; incoming shapes to the parent.